5

I have a second USB keyboard I'd like my computer to recognize as a gamepad rather than just an extra keyboard. Is this possible on Ubuntu 14.04?

I've seen information on doing the opposite, treating a gamepad as a keyboard, but this is not what I'm looking for.

1 Answers1

3

You could disable the keyboard from other applications with "xinput float" or "xinput --disable" or by disabling it in xorg.conf (turn auto add devices off and configure the devices you want)

Then you could write an application that reads events from the floating keyboard or from /dev/input/eventX and sends gamepad events to /dev/uinput.

New uinput device is created with an ioctl to /dev/uinput and events sent by writing uinput_user_dev structs to /dev/uinput. There is a python library for that: http://tjjr.fi/sw/python-uinput/

A quick proof of concept could be written by piping output of "xinput test-xi2 number" to a python-uinput program.