Compare commits

..

7 Commits

Author SHA1 Message Date
e155a6cfcc Merge remote-tracking branch 'origin/master' 2022-08-09 03:15:28 -07:00
8965efd557
Merge pull request #4 from wasertech/patch-1
Update identify_evdev.py
2022-08-09 03:11:48 -07:00
Danny Waser
746fc0d499
Update identify_evdev.py
I stumbled upon https://aweirdimagination.net/2015/04/06/emulating-xbox-controllers-on-linux/ which led me to https://aweirdimagination.net/2015/04/04/identifying-joystick-devices/ and then here.

On python 3.10 you'll get a depreciation warning.
```zsh
identify_evdev.py:31: DeprecationWarning: Please use InputDevice.path instead of InputDevice.fn
  output.append(devices[fd].fn)
/dev/input/event259.
``` 
 It will still work but the output is borked.

With `path` instead:
```zsh
/dev/input/event259
```
2022-08-07 01:53:54 +02:00
cd5fdba714
Merge pull request #2 from VoodaGod/master
fix wrongful dpad y-axis inversion
2020-04-06 15:57:05 -07:00
VoodaGod
b23943510e fix wrongful dpad y-axis inversion 2020-04-03 19:31:25 +02:00
ba3f9078e3
Merge pull request #1 from VoodaGod/master
add support for mapping dpad that acts as axis
2020-03-30 13:39:48 -07:00
VoodaGod
1e1caf3469 add support for mapping dpad that acts as axis 2020-03-30 22:36:41 +02:00
2 changed files with 4 additions and 2 deletions

View File

@ -139,7 +139,7 @@ def ask_user_for_keymap(dev):
('orange', 'guitar button'), ('orange', 'guitar button'),
] ]
print("Press the corresponding button on your controller. If the button doesn't exist, press the start button again to ignore it.") print("Press the corresponding button on your controller. If the button doesn't exist, or doesn't register, press the start button again to ignore it. It might act as an axis, we will register that later.")
# Dictionary of XBox buttons to xboxdrv key names. # Dictionary of XBox buttons to xboxdrv key names.
mappings = {} mappings = {}
# Values of mappings dictionary to avoid mapping the same button twice. # Values of mappings dictionary to avoid mapping the same button twice.
@ -184,6 +184,8 @@ def ask_user_for_axismap(dev, mappings):
('y2', ('down', 'up'), 'right anlog stick (up/down)'), ('y2', ('down', 'up'), 'right anlog stick (up/down)'),
('lt', ('trigger',), 'left analog trigger (L or L2 button)'), ('lt', ('trigger',), 'left analog trigger (L or L2 button)'),
('rt', ('trigger',), 'right analog trigger (R or R2 button)'), ('rt', ('trigger',), 'right analog trigger (R or R2 button)'),
('dpad_x', ('left', 'right'), 'dpad (left/right)'),
('dpad_y', ('up', 'down'), 'dpad (up/down)'),
] ]
print("Move the corresponding axis on your controller. If the axis doesn't exist, press the start button to ignore it.") print("Move the corresponding axis on your controller. If the axis doesn't exist, press the start button to ignore it.")

View File

@ -29,7 +29,7 @@ def list_active_evdev():
for fd in r: for fd in r:
for event in list(devices[fd].read())[:1]: for event in list(devices[fd].read())[:1]:
if event.type == evdev.ecodes.EV_KEY: if event.type == evdev.ecodes.EV_KEY:
output.append(devices[fd].fn) output.append(devices[fd].path)
anyInput = True anyInput = True
return output return output