Page 1 of 1

Gamepad Joystick on RPI

Posted: Thu Nov 01, 2018 8:34 am
by xgiannak
I have a RPI 3, mounting Raspbian,
and a Gamepad controller via Bluetooth.

I would like to use the Gamepad to control the RPI in a set-top box mode, so mouse and some keys.
I have tried several options, but none of them is satisfying. Any suggestion on what could be a way to proceed is very welcome.

The gamepad has two options, which make it appear differently to the system
- Joystick option, appearing as 4 axis plus DHAT pad plus 10 buttons
- "Media" option, appearing as mouse / keyboard, with some specific keys

In the "Media" option, RPI recognises it like a mouse and keyboard, and everything is fine, but the joystick is not centered. in the sense that instead of having values
-32000 (left) ... 0 (centre) ... 32000 (right)
it has
-32000 (left) ... -16000 (centre) ... 0 (right)
And so the mouse pointer drifts leftwards.
I was not able to correct this, neither via the xorg conf, nor via the device registration.

In the Joystick option, RPI recognises it like a mouse and keyboard, and a /dev/input/js0 device. A specialised program like jstest is able to read the values, but still the mouse is not working correctly because of the not centred value.
I tried to activate the Joystick driver in xorg with
Section "InputClass"
Identifier "libinput joystick catchall"
#MatchIsJoystick "on"
MatchDevicePath "/dev/input/js*"
Driver "libinput"
EndSection
But the loading of the driver fails, and it seems that the package xserver-org-input-joystick is not available in Raspbian.
If anybody has an advice about what is the most promising way, I'll insist and review all the details to possibly fix it.

The device has no way to be identified, and this might be part of the problem. A query with udevadm yields the following.

Code: Select all

udevadm info -q all -n input/event4
P: /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:1949:0402.0005/input/input4/event4
N: input/event4
E: BACKSPACE=guess
E: DEVNAME=/dev/input/event4
E: DEVPATH=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:1949:0402.0005/input/input4/event4
E: ID_BUS=bluetooth
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_INPUT_MOUSE=1
E: LIBINPUT_DEVICE_GROUP=5/1949/402/11b:b8:27:eb:a3:d0:d5
E: MAJOR=13
E: MINOR=68
E: SUBSYSTEM=input
E: USEC_INITIALIZED=276404146
E: XKBLAYOUT=us
E: XKBMODEL=pc105
It is a pity because orientatively the hardware device is sturdy and cheap.
https://www.amazon.it/gp/product/B01MSH ... UTF8&psc=1

Thanks and have a great day, xgiannak