Compare commits
3 Commits
73aadeb9da
...
11186d3e79
Author | SHA1 | Date | |
---|---|---|---|
11186d3e79 | |||
9b85670fc2 | |||
b607466efc |
|
@ -69,8 +69,13 @@ def convert_keycode_to_name(code):
|
|||
def eat_events(dev):
|
||||
'''Consume and ignore events on a device until there are none.'''
|
||||
|
||||
while dev.read_one() is not None:
|
||||
pass
|
||||
while True:
|
||||
try:
|
||||
event = dev.read_one()
|
||||
if event is None:
|
||||
return
|
||||
except Exception, e:
|
||||
return
|
||||
|
||||
def get_next_pressed_button_name(dev):
|
||||
'''Wait for the next button press and report its xboxdrv name.'''
|
||||
|
@ -97,9 +102,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:
|
||||
if event.value <= absinfo.min + 20:
|
||||
return 'min', axis
|
||||
elif event.value == absinfo.max:
|
||||
elif event.value >= absinfo.max - 20:
|
||||
return 'max', axis
|
||||
|
||||
def ask_user_for_keymap(dev):
|
||||
|
|
|
@ -28,8 +28,9 @@ def list_active_evdev():
|
|||
r,w,x = select.select(devices, [], [])
|
||||
for fd in r:
|
||||
for event in list(devices[fd].read())[:1]:
|
||||
output.append(devices[fd].fn)
|
||||
anyInput = True
|
||||
if event.type == evdev.ecodes.EV_KEY:
|
||||
output.append(devices[fd].fn)
|
||||
anyInput = True
|
||||
|
||||
return output
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user