Hi everyone
I recently asked myself, why there is no generic gamepad device on the Pandora. I mean, we have the nubs and the gp-buttons, but they are all different devices (/dev/input/eventX) instead of one single device.
Now, let's say someone ports a game to the Pandora that supports joysticks/gamepads. This game would usually open '/dev/input/jsX' as input device. But all it would find is a simple 2-axis joystick with no buttons (a nub). Not very useful for that game.
So, I thought it should be possible to create a full featured gamepad device that can be used by games. I came up with a solution that uses the kernels user level input subsystem (uinput)
The tool basically creates one single joystick device (/dev/input/jsX) and maps all input from the nubs and gp-keys to that device.
- Left and right nubs are mapped to analog joysticks 0 and 1
- Dpad is mapped to hat-axis
- A/B/X/Y/Shoulders/Select/Start are mapped to the corresponding buttons
So, if a game opens this device, I would find a fully featured gamepad.
However, as I don't know, if there is actually any software on the Pandora that could profit from a gamepad device, I wanted you to judge if this might be useful.
The attached file contains the compiled binary (gamepad), it's source code (just one file) and a tool (jstest) to test 'jsX' devices (the source for 'jstest' is available here: https://aur.archlinux.org/packages.php?do_Details=1&ID=6693)
gamepad.zip
I recently asked myself, why there is no generic gamepad device on the Pandora. I mean, we have the nubs and the gp-buttons, but they are all different devices (/dev/input/eventX) instead of one single device.
Now, let's say someone ports a game to the Pandora that supports joysticks/gamepads. This game would usually open '/dev/input/jsX' as input device. But all it would find is a simple 2-axis joystick with no buttons (a nub). Not very useful for that game.
So, I thought it should be possible to create a full featured gamepad device that can be used by games. I came up with a solution that uses the kernels user level input subsystem (uinput)
The tool basically creates one single joystick device (/dev/input/jsX) and maps all input from the nubs and gp-keys to that device.
- Left and right nubs are mapped to analog joysticks 0 and 1
- Dpad is mapped to hat-axis
- A/B/X/Y/Shoulders/Select/Start are mapped to the corresponding buttons
So, if a game opens this device, I would find a fully featured gamepad.
However, as I don't know, if there is actually any software on the Pandora that could profit from a gamepad device, I wanted you to judge if this might be useful.
The attached file contains the compiled binary (gamepad), it's source code (just one file) and a tool (jstest) to test 'jsX' devices (the source for 'jstest' is available here: https://aur.archlinux.org/packages.php?do_Details=1&ID=6693)
gamepad.zip
Attachments
Last edited by a moderator: