Trust GXT 542 gamepad on Linux
Motivation
These days I purchased two Trust GXT 542 gamepads. It started with our kids playing Super Mario Kart on the Nintendo Switch at our friends’ place after christmas brunch and I thought that SupertuxKart on our laser projector at home would do the trick, too. However, my last gamepad was from 20111, and caused me to write joydevmap back then.
So in any case we would need a second and since my shiny new Lenovo Thinkpad X13 has only two USB type A ports – one sort of permanently allocated by a Yubikey 5 Nano – I was looking for new wireless gamepads, i.e., via Bluetooth.
Features
This is how I came to two GXT 542 gamepads by Trust. Their main features for our use case are:
-
Can be run wireless via Bluetooth. But can also be operated via USB, and even wireless via USB using a USB-dongle that is shipped with the gamepad. Hence, there are three ways to connect the gamepad.
-
Provides vibration feedback, for instance when you fly off the road and the rescue thunderbird is triggered.
-
Runs out of the box with Linux.
Linux stuff
The gamepad worked out of the box on a T460s Thinkpad running Debian Bookworm. In the following I report on what I get on my Gentoo Linux on a Thinkpad X13 Gen 4 running kernel 6.12.8.
USB connection
You can use and charge the gamepad by connecting it via USB. When plugged in
via USB cable then dmesg
reports the following:
usb 1-1: new full-speed USB device number 6 using xhci_hcd
usb 1-1: can't set config #1, error -71
usb 1-1: USB disconnect, device number 6
usb 1-1: new full-speed USB device number 7 using xhci_hcd
input: shanwan Android GamePad as /devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/1-1/1-1:1.0/0003:2563:0526.0010/input/input41
input: shanwan Android GamePad Consumer Control as /devices/pci0000:00/0000:00:08.1/0000:c3:00.3/usb1/1-1/1-1:1.0/0003:2563:0526.0010/input/input42
hid-generic 0003:2563:0526.0010: input,hidraw7: USB HID v1.10 Gamepad [shanwan Android GamePad] on usb-0000:c3:00.3-1/input0
Note that there is an error reported, the USB device is removed, and on another
try the gamepad is added. We can test it with jstest
like this:
❯ jstest /dev/input/js1
Driver version is 2.1.0.
Joystick (shanwan Android GamePad) has 8 axes (X, Y, Z, Rz, Gas, Brake, Hat0X, Hat0Y)
and 15 buttons (BtnA, BtnB, BtnC, BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes: 0: 0 1: 0 2: 0 3: 0 4:-32767 5:-32767 6: 0 7: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off 11:off 12:off 13:off 14:off
Here axis 0 and 1 are the x- and y-axis of the left stick, likewise axis 2 and 3 are the right stick, axis 4 is a continuous trigger at the right shoulder and axis 5 is the one on the left, and axis 6 and 7 are the x- and y-axis on the left cross direction buttons.
The reason for the initial error is described at ArchWiki: the gamepad enters the Android mode a fallback mode. It basically works also in the fallback mode but it comes at limitations, e.g., no working vibration, no working gyroscope (which would be axis 6 and 7).
I have not yet managed to bypass this issue, but since I run the gamepad via Bluetooth anyways, this is not a really an issue for me.
This is what lsusb
reports:
❯ lsusb -v
Bus 001 Device 007: ID 2563:0526 ShenZhen ShanWan Technology Co., Ltd. Android GamePad
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 [unknown]
bDeviceSubClass 0 [unknown]
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x2563 ShenZhen ShanWan Technology Co., Ltd.
idProduct 0x0526 Android GamePad
bcdDevice 1.00
iManufacturer 1 shanwan
iProduct 2 Android GamePad
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 350mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 [unknown]
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 128
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 8
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
Bluetooth connection
The gamepad can also be connected via bluetooth. A little plate at the backside tells that pressing “Home + R” initiates the connection.
This is what dmesg
reports:
microsoft 0005:045E:02E0.000B: unknown main item tag 0x0
input: Xbox Wireless Controller as /devices/virtual/misc/uhid/0005:045E:02E0.000B/input/input34
microsoft 0005:045E:02E0.000B: input,hidraw7: BLUETOOTH HID v9.03 Gamepad [Xbox Wireless Controller] on 8c:3b:4a:a0:c6:92
This is what bluetoothctl
gives us as info:
[Xbox Wireless Controller]# info
Device 83:50:28:B0:22:9E (public)
Name: Xbox Wireless Controller
Alias: Xbox Wireless Controller
Class: 0x00002508 (9480)
Icon: input-gaming
Paired: yes
Bonded: yes
Trusted: no
Blocked: no
Connected: yes
WakeAllowed: yes
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: usb:v045Ep02E0d0903
RSSI: 0xffffffd6 (-42)
Note that if you have “Bonded: no” then the HID profile will not be activated and the gamepad does not work. To fix this you have to pair the gamepad, which is done under the hood if you use the usual GUI bluetooth config tools under Plasma in Debian or so.
Then you can again run jstest
and will now get something like this:
❯ jstest /dev/input/js1
Driver version is 2.1.0.
Joystick (Xbox Wireless Controller) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 10 buttons (BtnA, BtnB, BtnC, BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2).
Testing ... (interrupt to exit)
Axes: 0: 0 1: 0 2:-32767 3: 0 4: 0 5:-32767 6: 0 7: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off
Now axis 0 and 1 are the x- and y-axis of the left stick, axis 3 and 4 the one of the right stick, axis 2 and 5 the axes of the left and right continuous shoulder button and axes 6 and 7 are the discrete x- and y-axes of the left cross direction buttons. Vibration works through the Bluetooth connection.
Final comments
There is also a gamepad test in the browser by this Gamepad Tester page.
I have also tested the xpadneo briefly. It basically seems to work but after connection it did stop to rumble (vibrate).
I can connect both Gamepads using Bluetooth and they work fine with SupertuxKart for the multi player mode. So far it seems to be a nice piece of hardware.
-
It also was from Trust; the model is called Predator. ↩