Compare commits

..

No commits in common. "11186d3e79daec1b4bc14fb1def79a6f18b7d15c" and "73aadeb9da8c23dc860bce6c0690574683b8e91a" have entirely different histories.

2 changed files with 6 additions and 12 deletions

View File

@ -69,13 +69,8 @@ def convert_keycode_to_name(code):
def eat_events(dev):
'''Consume and ignore events on a device until there are none.'''
while True:
try:
event = dev.read_one()
if event is None:
return
except Exception, e:
return
while dev.read_one() is not None:
pass
def get_next_pressed_button_name(dev):
'''Wait for the next button press and report its xboxdrv name.'''
@ -102,9 +97,9 @@ def get_next_maxed_axis(dev, mappings):
absinfo = dict(dev.capabilities()[evdev.ecodes.EV_ABS])[event.code]
axis = evdev.ecodes.ABS[event.code]
# ... and if the min or max has been reached, return it.
if event.value <= absinfo.min + 20:
if event.value == absinfo.min:
return 'min', axis
elif event.value >= absinfo.max - 20:
elif event.value == absinfo.max:
return 'max', axis
def ask_user_for_keymap(dev):

View File

@ -28,9 +28,8 @@ def list_active_evdev():
r,w,x = select.select(devices, [], [])
for fd in r:
for event in list(devices[fd].read())[:1]:
if event.type == evdev.ecodes.EV_KEY:
output.append(devices[fd].fn)
anyInput = True
output.append(devices[fd].fn)
anyInput = True
return output