Using GameSir controllers in linux

Post Reply
User avatar
mad_ady
Posts: 6046
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 107 times
Been thanked: 67 times
Contact:

Using GameSir controllers in linux

Unread post by mad_ady » Tue Jun 04, 2019 11:23 pm

First of all - sorry - I'm a noob. Never used controllers (or joysticks before).

I'm running Ubuntu 19.04 on my H2 and hope to make it a light gaming computer for my son. I got the games running with Lutris, but now I want to add controllers into the mix (the GameSir variant that Hardkernel sells). Plugged in the controller, install xboxdrv (as I've seen on some forums) and the controller appears as an input device:

Code: Select all

root@lego:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 005: ID 0bda:a811 Realtek Semiconductor Corp. RTL8811AU 802.11a/b/g/n/ac WLAN Adapter
Bus 001 Device 007: ID 05ac:055b Apple, Inc. 
Bus 001 Device 004: ID 0430:00a2 Sun Microsystems, Inc. Type 7 Keyboard
Bus 001 Device 002: ID 0430:100e Sun Microsystems, Inc. 24.1" LCD Monitor v4 / FID-638 Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@lego:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/7p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/9p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 12M
        |__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 7, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Driver=rtl8812au, 480M
    |__ Port 4: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M
root@lego:~# evtest 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	Power Button
/dev/input/event1:	Power Button
/dev/input/event2:	Xiaoji Gamesir-G3w
/dev/input/event3:	Sun USB Keyboard
/dev/input/event4:	Logitech USB Receiver
/dev/input/event5:	Logitech USB Receiver Mouse
/dev/input/event6:	Logitech USB Receiver Consumer Control
/dev/input/event7:	Logitech USB Receiver System Control
/dev/input/event8:	Video Bus
/dev/input/event9:	HDA Intel PCH Mic
/dev/input/event10:	HDA Intel PCH Line Out
/dev/input/event11:	HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12:	HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event13:	HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event14:	HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event15:	HDA Intel PCH HDMI/DP,pcm=10
Select the device event number [0-15]: 2
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x5ac product 0x55b version 0x110
Input device name: "Xiaoji Gamesir-G3w"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 304 (BTN_SOUTH)
    Event code 305 (BTN_EAST)
    Event code 306 (BTN_C)
    Event code 307 (BTN_NORTH)
    Event code 308 (BTN_WEST)
    Event code 309 (BTN_Z)
    Event code 310 (BTN_TL)
    Event code 311 (BTN_TR)
    Event code 312 (BTN_TL2)
    Event code 313 (BTN_TR2)
    Event code 314 (BTN_SELECT)
    Event code 315 (BTN_START)
    Event code 316 (BTN_MODE)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 1 (ABS_Y)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 2 (ABS_Z)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 5 (ABS_RZ)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1559657736.605192, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 1
Event: time 1559657736.605192, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value -1
Event: time 1559657736.605192, -------------- SYN_REPORT ------------
Event: time 1559657736.773221, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 0
Event: time 1559657736.773221, -------------- SYN_REPORT ------------
Event: time 1559657736.821207, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
Event: time 1559657736.821207, -------------- SYN_REPORT ------------
Event: time 1559657738.749387, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1559657738.749387, type 1 (EV_KEY), code 308 (BTN_WEST), value 1
Event: time 1559657738.749387, -------------- SYN_REPORT ------------
Event: time 1559657738.997409, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1559657738.997409, type 1 (EV_KEY), code 308 (BTN_WEST), value 0
Event: time 1559657738.997409, -------------- SYN_REPORT ------------
Event: time 1559657740.845564, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1559657740.845564, type 1 (EV_KEY), code 309 (BTN_Z), value 1
Event: time 1559657740.845564, -------------- SYN_REPORT ------------
Event: time 1559657741.093604, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1559657741.093604, type 1 (EV_KEY), code 309 (BTN_Z), value 0

The linux system (and its games) don't react to key presses from the controller. I'm guessing I'm missing some intermediate layer that maybe converts those into regular key/mouse events? What should I look for? The end goal is to have the controller work in wine games (I've managed to run GTA 5 as a test on H2 under Linux). :)
But ideally I'd like to be able to map some keys to DOS games too.

Edit: I also plugged the controller in my android phone, and even if it light up it didn't seem to do anything. I installed octopus, but it didn't recognize it.
Thanks.

User avatar
odroid
Site Admin
Posts: 31099
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 31 times
Been thanked: 153 times
Contact:

Re: Using GameSir controllers in linux

Unread post by odroid » Wed Jun 05, 2019 9:53 am

As far as we tested, the G3w didn't support the Xinput mode.
Try a generic input (Android) mode.
viewtopic.php?f=169&t=32923
These users thanked the author odroid for the post:
mad_ady (Wed Jun 05, 2019 2:11 pm)

User avatar
mad_ady
Posts: 6046
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 107 times
Been thanked: 67 times
Contact:

Re: Using GameSir controllers in linux

Unread post by mad_ady » Wed Jun 05, 2019 7:06 pm

Ok, I put it in Xbox360 mode and it worked fine in android (need to figure out Octopus). I tried following this guide for linux (while in Xbox mode): https://www.howtoforge.com/tutorial/how ... on-ubuntu/

The driver recognizes it, but I don't get events:

Code: Select all


[71578.305818] usb 1-2: USB disconnect, device number 14
[71578.965819] usb 1-2: new full-speed USB device number 15 using xhci_hcd
[71579.115966] usb 1-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[71579.115969] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[71579.115970] usb 1-2: Product: XBOX 360 For Windows
[71579.115972] usb 1-2: Manufacturer: Xiaoji
[71579.117293] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/input/input31
^C
root@lego:/home/adrianp/Downloads/g# sudo xboxdrv --detach-kernel-driver
xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ 
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> 
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This program comes with ABSOLUTELY NO WARRANTY. 
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. 

Controller:        Microsoft X-Box 360 pad
Vendor/Product:    045e:028e
USB Path:          001:015
Controller Type:   Xbox360

Your Xbox/Xbox360 controller should now be available as:
  /dev/input/js0
  /dev/input/event2

Press Ctrl-C to quit, use '--silent' to suppress the event output
I'll look for more guides.

Edit: Tested on a different PC (With Ubuntu 18.04), and still no events.
These are the steps I took to set it up:
1. Put it in xbox mode:

Code: Select all

[2606213.070388] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.3/3-1.3:1.0/input/input15
2. Installed xboxdrv:
sudo apt-get install xboxdrv
3. Removed xpad and started xboxdrv:

Code: Select all

sudo rmmod xpad
sudo xboxdrv --detach-kernel-driver
4. Start jstest-gtk - I don't get any events...

@meveric: Help! :)

User avatar
meveric
Posts: 10199
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, N2
Has thanked: 11 times
Been thanked: 86 times
Contact:

Re: Using GameSir controllers in linux

Unread post by meveric » Thu Jun 06, 2019 5:02 pm

I had the same issues with the controller under Kernel 4.14 for the ODROID XU3/XU4.
The controller is found as an XBox 360 controller but doesn't work at all.
Only when you put the controller in android mode, and it's found as a GameSir controller it's working.
(Just as a Hint: The GameSir G3s - <wireless> works very well as a XBox 360 clone out of the box).
I'm no fan of xboxdrv but I also found that many use the xboxdrv to talk with wine.
I kinda want to get the same done with xpad but with real XBox360 controllers.

Anyway, I suggest putting the controller in Android mode, and see that the controller is working.
It should work with evtest and/or jstest-gtk after that you can probably worry about getting anything done with xboxdrv.
These users thanked the author meveric for the post:
mad_ady (Thu Jun 06, 2019 5:14 pm)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

User avatar
mad_ady
Posts: 6046
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 107 times
Been thanked: 67 times
Contact:

Re: Using GameSir controllers in linux

Unread post by mad_ady » Thu Jun 06, 2019 10:50 pm

Thank you. I purged xboxdrv, added my user in the input group, set the controller to Gamesur mode (two leds on on the bottom) and it worked (was seen by jstest-gtk.

I'll post an article after I polish some rough edges.

User avatar
mad_ady
Posts: 6046
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 107 times
Been thanked: 67 times
Contact:

Re: Using GameSir controllers in linux

Unread post by mad_ady » Fri Jun 07, 2019 5:43 pm

Here's the article with more details about controller setup: viewtopic.php?f=172&t=35311&p=258763#p258763

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests