paroj / xpad

Linux Kernel Driver for the Xbox/ Xbox 360/ Xbox One Controllers
843 stars 183 forks source link

Some controllers that mimic the Xbox 360 Controller are not initialized correctly #119

Open dnmodder opened 5 years ago

dnmodder commented 5 years ago

I have a fake Xbox 360 controller, specifically a Fantech GP11 Shooter, it happens that this type of controllers have problems to work on Linux because they are first recognized by usbhid and then disconnected and reconnected as controllers of xbox 360, to then not generate any key event.

In this case my problem is identical to this: Linux gamepad - no input events

And this is very similar: #118

Using VirtualBox, Wireshark and usbmon I analyzed the traffic between the device and the linux driver looking for the initialization codes, after finding them I wrote the following script: fixcontroller.py

I do not provide more data, like the output of dmesg, because they are the same as the first link I left.

But if necessary I can provide more information or try any solution they propose, in advance I apologize if something is not well understood, since this was translated from Spanish.

zeunus commented 4 years ago

Hablas español?

MirceaKitsune commented 3 years ago

I just got a new gamepad: Trust GXT 540 Yula. It has a button to switch between D-input and X-input modes: dinput works OOTB with no issues, albeit it has support for less features and some games don't accept it. xinput refuses to work, the device is recognized by the OS but no buttons or events are sensed. I asked why that is and someone pointed me to this issue.

I can confirm the problem reported here is the cause: The python script provided as a workaround fixes the problem and gets the device fully working in this input mode. Of course it must be ran each time after the controller is plugged in or the machine is restarted, which is very annoying and problematic to do (especially since it wants root access).

This is a concerning problem: Any information on when it might be resolved? Feel free to ask me for more data if it helps fix this... my OS is Manjaro KDE for the record. In the meantime is there an easier workaround to that python script, such as a bash script that does the same thing which would be easier to automate, or some OS setting we can change to fix the bad detection?

MirceaKitsune commented 3 years ago

Some basic info. First the device is listed as Bus 005 Device 024: ID 045e:028e Microsoft Corp. Xbox360 Controller by the lsusb command; It's not a real Xbox controller and IMO it was a bad design choice to label it as such.

The usb-devices command lists the controller as follows:

T:  Bus=05 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 26 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
P:  Vendor=045e ProdID=028e Rev=01.10
S:  Manufacturer=SHANWAN
S:  Product=Controller
C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=5d Prot=01 Driver=xpad

Lastly for now here's the dmesg log piece after plugging in the device:

1336a1337,1351
> [ 3317.060917] usb 5-2.1: new full-speed USB device number 6 using xhci_hcd
> [ 3317.184666] usb 5-2.1: New USB device found, idVendor=2563, idProduct=0575, bcdDevice= 2.00
> [ 3317.184669] usb 5-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 3317.184671] usb 5-2.1: Product: PS3/PC Gamepad
> [ 3317.184672] usb 5-2.1: Manufacturer: SHANWAN
> [ 3317.286799] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.1/5-2.1:1.0/0003:2563:0575.0004/input/input22
> [ 3317.286852] hid-generic 0003:2563:0575.0004: input,hidraw3: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:0c:00.3-2.1/input0
> [ 3317.861781] usb 5-2.1: USB disconnect, device number 6
> [ 3318.177585] usb 5-2.1: new full-speed USB device number 7 using xhci_hcd
> [ 3318.303668] usb 5-2.1: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
> [ 3318.303672] usb 5-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 3318.303673] usb 5-2.1: Product: Controller
> [ 3318.303674] usb 5-2.1: Manufacturer: SHANWAN
> [ 3318.922012] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.1/5-2.1:1.0/input/input23
> [ 3318.922074] usbcore: registered new interface driver xpad
dnmodder commented 3 years ago

@MirceaKitsune I think it can be automated with a udev rule.

MirceaKitsune commented 3 years ago

@dnmodder Someone on Reddit suggested this. Unfortunately I never had to manually mess with udev before. Could anyone explain what needs to be edited and where and how? I can tell this obviously involves messing with root / system stuff and I'm always weary not to risk breaking something.

If that's easier, a script or command written in bash (no python) would also be helpful until this is resolved. I tried stuff like echo 1 > /dev/bus/usb/005/011 as a test to see what that does, but it just throws an invalid argument error and that's it.

dnmodder commented 3 years ago

@MirceaKitsune Write the following to a text file: ACTION=="add", ATTRS{idProduct}=="028e", ATTRS{idVendor}=="045e", DRIVERS=="usb", RUN+="/path/to/script.py" changing the script path, then save this file as 99-fixcontroller.rules (I chose that name at random) in /etc/udev/rules.d/99-fixcontroller.rules, then run the following command in a terminal: sudo udevadm control --reload That should be enough.

MirceaKitsune commented 3 years ago

Guess that script is the only way then. Mainstreamed it to a more permanent configuration. I don't mind executing it manually when plugging in the controller for now, but will keep that solution in mind too for ease. Thanks for all the help!

Also what happened to PR #120 if I may ask? I took a look and everyone says it's supposed to fix this issue, however it just dropped dead two years ago with no updates since. Was it just forgotten or is there a reason why it's waiting for so long?

dnmodder commented 3 years ago

@MirceaKitsune It is functional, since it does basically the same as the script but directly from the driver, but it is not written in the most adequate way, but it was the best the author of the PR could do, and I do not know how to program in C ++.

MirceaKitsune commented 3 years ago

Hmmm. Does it break anything in its current form? I support clean code, but over letting such an issue persist I'd take even an official workaround that's less ideal. Hope a solution in some form is found and accepted soon.

paroj commented 3 years ago

should be fixed with https://github.com/paroj/xpad/commit/2bfb0e171832b5035a9370300d7fdf4c57eb9497

MirceaKitsune commented 3 years ago

Thank you very much, I appreciate it! Anyone know which kernel version should have the patch? Once it's on my system I'll give it a go and hopefully everything will work great.

paroj commented 3 years ago

Anyone know which kernel version should have the patch?

this is not scheduled for upstream yet. You can use it with your current kernel as described here, though: https://github.com/paroj/xpad#installing

paroj commented 3 years ago

moved the fix to a separate branch: https://github.com/paroj/xpad/tree/fantech

I got reports that the change breaks other controllers in #171. As the controllers identifies as 0x045e:0x028e i.e. "vanilla Xbox360 Controller", there is no way to create a whitelist right now.

amardhruva commented 3 years ago

Perhaps we can whitelist it using iManufacturer SHANWAN. I have attached the lsusb output of my controller. lsusb.txt

mrfixit2001 commented 3 years ago

@paroj Thank you for this fix and your continued awesome efforts! I had just started to reverse engineer the commands that pyusb issued to the kernel to build it and was VERY happy to stumble across your patch where you had done a far better job than I would have anyway!

Since it's been communicated that this new code is controller specific and breaks others, in my own build I've modified your new patch and added a new quirk to your "mapping" property that I then assign to the vendor+product inside the definition of xpad_device. Then instead of checking xpad->xtype to determine if the new function should be called I check xpad->mapping.

This solution is working very well for me in my testing for my gamepad idVendor=2563, idProduct=0575.

- UPDATE - Upon further testing I discovered that while the patch works for enabling the controller, the mappings/quirks are not passed through to the new xbox device - I need the triggers to be mapped as buttons.

The kernel first correctly creates the input for idVendor=2563, idProduct=0575 and after debugging the driver init sequence I can confirm this initial device properly maps the triggers as buttons. However, shortly after this happens the kernel then replaces this input devices with a new one with idVendor=045e, idProduct=028e. All input events are detected for this new device, which doesn't pick up the original mappings for the actual vendor/product, so my triggers are mapped as axis.

lsusb does not show my actual vendor/product anymore, it shows the new device instead. Bus 001 Device 003: ID 045e:028e Microsoft Corp. Xbox360 Controller

Here's my output after adding the product/vendor to the device table with the proper mappings:

[    4.879123] usb 1-1: new full-speed USB device number 2 using dwc2
[    5.154783] usb 1-1: New USB device found, idVendor=2563, idProduct=0575
[    5.155412] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    5.156049] usb 1-1: Product: PS3/PC Gamepad
[    5.156426] usb 1-1: Manufacturer: SHANWAN
[    5.160432] input: Roshambo Gamepad as /devices/platform/ff580000.usb/usb1/1-1/1-1:1.0/input/input3
[    5.305146] usb 1-1: USB disconnect, device number 2
[    6.172070] usb 1-1: new full-speed USB device number 3 using dwc2
[    6.447874] usb 1-1: New USB device found, idVendor=045e, idProduct=028e
[    6.448495] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    6.449132] usb 1-1: Product: Controller
[    6.449479] usb 1-1: Manufacturer: SHANWAN
[    6.452609] input: Microsoft X-Box 360 pad as /devices/platform/ff580000.usb/usb1/1-1/1-1:1.0/input/input5

Any thoughts on why that new device is being picked up with a different vendor/product? When I map it out, It appears to even being given an entirely different guid too confused face

For now, I've added code to the driver that inspects the manufacturer, and if it's a shanwan device it forces the triggers to buttons. Not ideal, but a hacky workaround until this gets figured out.

Another note is that suspend/resume do not work either because the mapping to tell the driver to re-run the init isn't there.

For what it's worth - here's my changes and workarounds. https://github.com/mrfixit2001/rockchip-kernel/commit/4c7d778b184947ad14099592ac859edda8cff0a0

MirceaKitsune commented 3 years ago

I'm sorry this is turning out to be so complicated to resolve. Will the next update still fix affected controllers, including the Trust GXT 540 Yula which is the one I use and have this problem with? If devices need to be manually registered in the module for initialization I'm fine with that, granted it works and someone will always be around to maintain the device list.

mrfixit2001 commented 3 years ago

I'm sorry this is turning out to be so complicated to resolve. Will the next update still fix affected controllers, including the Trust GXT 540 Yula which is the one I use and have this problem with? If devices need to be manually registered in the module for initialization I'm fine with that, granted it works and someone will always be around to maintain the device list.

The dmesg you posted above shows the same product/vendor IDs that I have, and it's also using a shanwan manufacturer. The changes in my kernel repo would work for you.

paroj commented 3 years ago

Perhaps we can whitelist it using iManufacturer SHANWAN. I have attached the lsusb output of my controller.

thats actually a very good idea. I have updated the patch accordingly: https://github.com/paroj/xpad/commit/f44c551c7d4c91810ea0360459a19dbbfc5e81b8

please report back whether it works for you.

I also set MAP_TRIGGERS_TO_BUTTONS based on that - which will work until SHANWAN starts using real triggers..

MirceaKitsune commented 3 years ago

I'll see how it goes once it reaches my kernel. Only problem is knowing when the patch is in: Building my own kernel is a bit advanced even for me and I don't want to mess up my system, thus I'm waiting for the patch to make it in. The controller still isn't initialized in 5.14.0 so I take it this might come in 5.15 at earliest.

paroj commented 3 years ago

you dont need to build your own kernel for this - just follow: https://github.com/paroj/xpad#installing

amardhruva commented 3 years ago

I just tested the new driver out on a stock install of Ubuntu 20.04. Except the triggers everything works. Pressing the triggers seem to do nothing.

amardhruva commented 3 years ago

I unloaded the new xpad driver and loaded the stock 5.8.0-43 kernel driver while the controller was connected and everything started working properly. So it seems that the control sequence is sent to the controller but something else broke the triggers. Maybe MAP_TRIGGERS_TO_BUTTONS is the culprit?

paroj commented 3 years ago

which will work until SHANWAN starts using real triggers.

this happened sooner than anticipated - dropped MAP_TRIGGERS_TO_BUTTONS again in master.

amardhruva commented 3 years ago

Ah that seems to have solved the problem. Everything seems to work now. I will use this driver for a while and update if I find something. Thanks a lot @paroj for the fix. Stuff tested

Jeronimo17 commented 2 years ago

SHANWAN 3 in 1 (X-Box 360, PS3, Android)

[  395.206578] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[  395.316436] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0575, bcdDevice= 2.00
[  395.316443] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  395.316448] usb 2-1.2: Product: PS3/PC Gamepad
[  395.316451] usb 2-1.2: Manufacturer: SHANWAN
[  395.322176] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2563:0575.0004/input/input23
[  395.322417] hid-generic 0003:2563:0575.0004: input,hidraw0: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:1d.0-1.2/input0
[  395.397075] usb 2-1.2: USB disconnect, device number 6
[  396.018481] usb 2-1.2: new full-speed USB device number 7 using ehci-pci
[  396.130484] usb 2-1.2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  396.130492] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  396.130496] usb 2-1.2: Product: Controller
[  396.130499] usb 2-1.2: Manufacturer: SHANWAN
[  396.131406] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/input/input24
[  396.281339] usb 2-1.2: USB disconnect, device number 7
[  396.281466] xpad 2-1.2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  396.914444] usb 2-1.2: new full-speed USB device number 8 using ehci-pci
[  397.025090] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00
[  397.025097] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  397.025101] usb 2-1.2: Product: Android Gamepad
[  397.025105] usb 2-1.2: Manufacturer: SHANWAN
[  397.027848] input: SHANWAN Android Gamepad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2563:0526.0005/input/input25
[  397.028372] hid-generic 0003:2563:0526.0005: input,hidraw0: USB HID v1.10 Gamepad [SHANWAN Android Gamepad] on usb-0000:00:1d.0-1.2/input0
[  397.030753] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0006/input/input26
[  397.090938] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0006/input/input27
[  397.091248] hid-generic 0003:2563:0526.0006: input,hidraw1: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:1d.0-1.2/input1

First it tries with Xbox 360, but as it doesn't send any input it goes to PS3 and then to Android, then by pressing the Home button I force it to the next mode which is again Xbox 360, it stays there but doesn't send any input until I run fixcontroller.py with this content:

    for d in dev:
        if d.idVendor == 0x045e and d.idProduct == 0x028e:
            d.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)

This every time the usb is connected...

I have tried to install the latest version with the indicated command without noticing any changes

sudo git clone https://github.com/paroj/xpad.git /usr/src/xpad-0.4
sudo dkms install -m xpad -v 0.4

PD:

RELEASE=20.3
CODENAME=una
EDITION="Xfce"
DESCRIPTION="Linux Mint 20.3 Una"
DESKTOP=Gnome
TOOLKIT=GTK
NEW_FEATURES_URL=https://www.linuxmint.com/rel_una_xfce_whatsnew.php
RELEASE_NOTES_URL=https://www.linuxmint.com/rel_una_xfce.php
USER_GUIDE_URL=https://www.linuxmint.com/documentation.php
GRUB_TITLE=Linux Mint 20.3 Xfce
paroj commented 2 years ago

I have tried to install the latest version with the indicated command without noticing any changes

you have to use the fantec branch

git clone -b fantech https://github.com/paroj/xpad.git /usr/src/xpad-0.4
Jeronimo17 commented 2 years ago
[lun mar 14 16:17:05 2022] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[lun mar 14 16:17:05 2022] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0575, bcdDevice= 2.00
[lun mar 14 16:17:05 2022] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[lun mar 14 16:17:05 2022] usb 2-1.2: Product: PS3/PC Gamepad
[lun mar 14 16:17:05 2022] usb 2-1.2: Manufacturer: SHANWAN
[lun mar 14 16:17:05 2022] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2563:0575.0003/input/input22
[lun mar 14 16:17:05 2022] hid-generic 0003:2563:0575.0003: input,hidraw0: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:1d.0-1.2/input0
[lun mar 14 16:17:05 2022] usb 2-1.2: USB disconnect, device number 4
[lun mar 14 16:17:06 2022] usb 2-1.2: new full-speed USB device number 5 using ehci-pci
[lun mar 14 16:17:06 2022] usb 2-1.2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[lun mar 14 16:17:06 2022] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[lun mar 14 16:17:06 2022] usb 2-1.2: Product: Controller
[lun mar 14 16:17:06 2022] usb 2-1.2: Manufacturer: SHANWAN
[lun mar 14 16:17:06 2022] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/input/input23
[lun mar 14 16:17:06 2022] usbcore: registered new interface driver xpad
[lun mar 14 16:17:06 2022] usb 2-1.2: USB disconnect, device number 5
[lun mar 14 16:17:06 2022] xpad 2-1.2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[lun mar 14 16:17:07 2022] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[lun mar 14 16:17:07 2022] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00
[lun mar 14 16:17:07 2022] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[lun mar 14 16:17:07 2022] usb 2-1.2: Product: Android Gamepad
[lun mar 14 16:17:07 2022] usb 2-1.2: Manufacturer: SHANWAN
[lun mar 14 16:17:07 2022] hid-generic 0003:2563:0526.0004: unknown main item tag 0x3
[lun mar 14 16:17:07 2022] hid-generic 0003:2563:0526.0004: collection stack underflow
[lun mar 14 16:17:07 2022] hid-generic 0003:2563:0526.0004: item 0 0 0 12 parsing failed
[lun mar 14 16:17:07 2022] hid-generic: probe of 0003:2563:0526.0004 failed with error -22
[lun mar 14 16:17:07 2022] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0005/input/input24
[lun mar 14 16:17:07 2022] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0005/input/input25
[lun mar 14 16:17:07 2022] hid-generic 0003:2563:0526.0005: input,hidraw0: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:1d.0-1.2/input1

Thanks, but it doesn't work either, I see another error in Android mode but it's not the mode I want.

Jeronimo17 commented 2 years ago

I have also tested the xpadone_paddles branch

[ 1253.360222] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[ 1253.470456] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0575, bcdDevice= 2.00
[ 1253.470463] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1253.470468] usb 2-1.2: Product: PS3/PC Gamepad
[ 1253.470471] usb 2-1.2: Manufacturer: SHANWAN
[ 1253.473731] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2563:0575.0003/input/input22
[ 1253.474188] hid-generic 0003:2563:0575.0003: input,hidraw0: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:1d.0-1.2/input0
[ 1253.508110] usb 2-1.2: USB disconnect, device number 4
[ 1254.180186] usb 2-1.2: new full-speed USB device number 5 using ehci-pci
[ 1254.296088] usb 2-1.2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[ 1254.296095] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1254.296098] usb 2-1.2: Product: Controller
[ 1254.296102] usb 2-1.2: Manufacturer: SHANWAN
[ 1254.341624] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/input/input23
[ 1254.341891] usbcore: registered new interface driver xpad
[ 1254.423694] usb 2-1.2: USB disconnect, device number 5
[ 1254.423756] xpad 2-1.2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[ 1255.076152] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[ 1255.186703] usb 2-1.2: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00
[ 1255.186710] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1255.186714] usb 2-1.2: Product: Android Gamepad
[ 1255.186717] usb 2-1.2: Manufacturer: SHANWAN
[ 1255.189545] input: SHANWAN Android Gamepad as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2563:0526.0004/input/input24
[ 1255.190093] hid-generic 0003:2563:0526.0004: input,hidraw0: USB HID v1.10 Gamepad [SHANWAN Android Gamepad] on usb-0000:00:1d.0-1.2/input0
[ 1255.192558] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0005/input/input25
[ 1255.252552] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.1/0003:2563:0526.0005/input/input26
[ 1255.252906] hid-generic 0003:2563:0526.0005: input,hidraw1: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:1d.0-1.2/input1
Jeronimo17 commented 2 years ago

61SXuz2OIYL _AC_SL1500_ https://www.amazon.es/gp/product/B07X5DZ8QS/

filipemelo2002 commented 2 years ago

I am having the same issue here. Any updates?

Jeronimo17 commented 2 years ago

How can I add this in the xpad.c to make it work directly without using fixcontroller.py?

 for d in dev:
        if d.idVendor == 0x045e and d.idProduct == 0x028e:
            d.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)

I have tried to add it here but it says on compile that /var/lib/dkms/xpad/0.4/build/xpad.c:1398:11: error: too many arguments to function ‘usb_control_msg’

status = usb_control_msg(xpad->udev,
        usb_rcvctrlpipe(xpad->udev, 0),
        0x1, 0xc1, 0x01, 0x0100, 0x00, 0x14,
filipemelo2002 commented 2 years ago

For everyone having the same problem, you can follow these instructions. I got mine working! https://www.reddit.com/r/linux_gaming/comments/l1ty23/getting_a_generic_xboxone_gamepad_to_work_on_linux/

Jeronimo17 commented 2 years ago

I have already succeeded :), Switching:

    status = usb_control_msg(xpad->udev,
        usb_rcvctrlpipe(xpad->udev, 0),
        0x1, 0xc1,
        cpu_to_le16(0x100), cpu_to_le16(0x0), data, cpu_to_le16(20),
        TIMEOUT);

For this:

    status = usb_control_msg(xpad->udev,
        usb_rcvctrlpipe(xpad->udev, 0),
        0x1, 0xc1,
        cpu_to_le16(0x100), cpu_to_le16(0x0), data, cpu_to_le16(14),
        TIMEOUT);

In xpad.c

Now it is recognized the first time, and no longer jumps out of mode automatically and you don't have to initialize it with fixcontroller.py. :smile:

I don't know if it is valid only for my controller that I put the picture above, or it is general in the shanwan. I don't know for which controller fixcontroller.py was made.

fcorsino commented 2 years ago

Thanks dnmodder for your investigation and providing the workaround fix in python! This had been haunting me for months now.

For anyone still having problems and wanting an easy solution, this script automates the installation of dnmodder's code plus the udev rule needed.

The install script is for a Gamesir G3w controller (045e:028e Microsoft Corp. Xbox360 Controller). If your controller has a different vendor and device id, you'll have to edit VENDOR_ID and PRODUCT_ID on the script.

bradyhaley commented 2 years ago

I kinda have a similar problem. But instead of the controller switching from PS3->XBox, Fantech GP12 switches from PS3->Android on Linux machine. I use wireshark, on Windows it switch from PS3->Xbox, and the device plugged in sound triggers twice. I wonder if Windows driver have special call so the switch order changes.

From dmesg below, it seems like PS3 controller is initialized properly, but then switches to android immediately. Does PS3 controller have initialization code too? The android mode is working. But the mapping is horrible, right analog doesn't work on wine, analog trigger and trigger button is pressed simultaneously, making analog trigger useless.

dmesg log

[  +1,080919] usb 3-4.1: new full-speed USB device number 37 using xhci_hcd
[  +0,191723] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0575, bcdDevice=52.00
[  +0,000003] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  +0,000001] usb 3-4.1: Product: PS3/PC Gamepad
[  +0,000001] usb 3-4.1: Manufacturer: SHANWAN
[  +0,008941] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000005] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0
[  +0,000035] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0575.00CA/input/input296
[  +0,000174] hid-generic 0003:2563:0575.00CA: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:14.0-4.1/input0
[  +0,189500] usb 3-4.1: USB disconnect, device number 37
[  +0,598251] usb 3-4.1: new full-speed USB device number 38 using xhci_hcd
[  +0,192698] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00
[  +0,000016] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  +0,000006] usb 3-4.1: Product: Android Gamepad
[  +0,000005] usb 3-4.1: Manufacturer: SHANWAN
[  +0,009759] input: SHANWAN Android Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0526.00CB/input/input297
[  +0,000579] hid-generic 0003:2563:0526.00CB: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input0
[  +0,001419] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input298
[  +0,055653] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input299
[  +0,000125] hid-generic 0003:2563:0526.00CC: input,hidraw6: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input1
amardhruva commented 2 years ago

In my controller I hold the home button to switch modes. Optionally hold X button while the controller boots to go to xbox mode.

On Fri, Jul 22, 2022 at 12:12 PM bradyhaley @.***> wrote:

I kinda have a similar problem. But instead of the controller switching from PS3->XBox, Fantech GP12 switches from PS3->Android on Linux machine. I use wireshark, on Windows it switch from PS3->Xbox, and the device plugged in sound triggers twice. I wonder if Windows driver have special call so the switch order changes.

From dmesg below, it seems like PS3 controller is initialized properly, but then switches to android immediately. Does PS3 controller have initialization code too? The android mode is working. But the mapping is horrible, right analog doesn't work on wine, analog trigger and trigger button is pressed simultaneously, making analog trigger useless.

dmesg log

[ +1,080919] usb 3-4.1: new full-speed USB device number 37 using xhci_hcd [ +0,191723] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0575, bcdDevice=52.00 [ +0,000003] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ +0,000001] usb 3-4.1: Product: PS3/PC Gamepad [ +0,000001] usb 3-4.1: Manufacturer: SHANWAN [ +0,008941] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000005] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000035] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0575.00CA/input/input296 [ +0,000174] hid-generic 0003:2563:0575.00CA: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:14.0-4.1/input0 [ +0,189500] usb 3-4.1: USB disconnect, device number 37 [ +0,598251] usb 3-4.1: new full-speed USB device number 38 using xhci_hcd [ +0,192698] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00 [ +0,000016] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ +0,000006] usb 3-4.1: Product: Android Gamepad [ +0,000005] usb 3-4.1: Manufacturer: SHANWAN [ +0,009759] input: SHANWAN Android Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0526.00CB/input/input297 [ +0,000579] hid-generic 0003:2563:0526.00CB: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input0 [ +0,001419] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input298 [ +0,055653] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input299 [ +0,000125] hid-generic 0003:2563:0526.00CC: input,hidraw6: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input1

— Reply to this email directly, view it on GitHub https://github.com/paroj/xpad/issues/119#issuecomment-1192239217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZ3C3754FNIND7LERTO2FDVVI7E7ANCNFSM4GHWG6TA . You are receiving this because you commented.Message ID: @.***>

bradyhaley commented 2 years ago

In my controller I hold the home button to switch modes. Optionally hold X button while the controller boots to go to xbox mode. On Fri, Jul 22, 2022 at 12:12 PM bradyhaley @.> wrote: I kinda have a similar problem. But instead of the controller switching from PS3->XBox, Fantech GP12 switches from PS3->Android on Linux machine. I use wireshark, on Windows it switch from PS3->Xbox, and the device plugged in sound triggers twice. I wonder if Windows driver have special call so the switch order changes. From dmesg below, it seems like PS3 controller is initialized properly, but then switches to android immediately. Does PS3 controller have initialization code too? The android mode is working. But the mapping is horrible, right analog doesn't work on wine, analog trigger and trigger button is pressed simultaneously, making analog trigger useless. dmesg log [ +1,080919] usb 3-4.1: new full-speed USB device number 37 using xhci_hcd [ +0,191723] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0575, bcdDevice=52.00 [ +0,000003] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ +0,000001] usb 3-4.1: Product: PS3/PC Gamepad [ +0,000001] usb 3-4.1: Manufacturer: SHANWAN [ +0,008941] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000005] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000003] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000004] hid-generic 0003:2563:0575.00CA: unknown main item tag 0x0 [ +0,000035] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0575.00CA/input/input296 [ +0,000174] hid-generic 0003:2563:0575.00CA: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:14.0-4.1/input0 [ +0,189500] usb 3-4.1: USB disconnect, device number 37 [ +0,598251] usb 3-4.1: new full-speed USB device number 38 using xhci_hcd [ +0,192698] usb 3-4.1: New USB device found, idVendor=2563, idProduct=0526, bcdDevice= 1.00 [ +0,000016] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ +0,000006] usb 3-4.1: Product: Android Gamepad [ +0,000005] usb 3-4.1: Manufacturer: SHANWAN [ +0,009759] input: SHANWAN Android Gamepad as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.0/0003:2563:0526.00CB/input/input297 [ +0,000579] hid-generic 0003:2563:0526.00CB: input,hidraw5: USB HID v1.10 Gamepad [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input0 [ +0,001419] input: SHANWAN Android Gamepad System Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input298 [ +0,055653] input: SHANWAN Android Gamepad Consumer Control as /devices/pci0000:00/0000:00:14.0/usb3/3-4/3-4.1/3-4.1:1.1/0003:2563:0526.00CC/input/input299 [ +0,000125] hid-generic 0003:2563:0526.00CC: input,hidraw6: USB HID v1.01 Device [SHANWAN Android Gamepad] on usb-0000:00:14.0-4.1/input1 — Reply to this email directly, view it on GitHub <#119 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZ3C3754FNIND7LERTO2FDVVI7E7ANCNFSM4GHWG6TA . You are receiving this because you commented.Message ID: @.>

OMG That works! Thanks!! I should have tried it out... Here's the full boot combination if anyone stumble upon this. A = Android mode X = Xbox mode Y = PS3 mode without LED B = PS3 with LED

MirceaKitsune commented 2 years ago

I tried holding the Home or X buttons even while plugging it in, no result. That python script is the only solution for my model. I'm still waiting for a permanent patch to finally make it into the kernel.

amardhruva commented 2 years ago

Have you guys tried the fantech branch of xpad? https://github.com/paroj/xpad/tree/fantech

mrfixit2001 commented 2 years ago

If anyone still having this problem is interested, feel free to give the modified xpad driver in my kernel a try. I pulled in some other changes and also made some changes of my own. In my tests everything is working for my different shanwan clones.

On Jul 24, 2022, at 3:29 AM, Amardhruva N Prabhu @.***> wrote:

 Have you guys tried the fantech branch of xpad? https://github.com/paroj/xpad/tree/fantech

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

tmarplatt commented 2 years ago

I have a Trust GXT 540 (045e:028e) plugged in and set to Xinput mode. I have installed the xpad dkms module from the fantech branch @ https://github.com/paroj/xpad/commit/f21824c262c3b5e833b095f93fd8281a3f2c8562 but jstest outputs no events for any button press or stick movement.

I'm currently on Linux Mint 20.3 Edge (kernel 5.15.0-48). lsusb and dmesg logs:

➜ sudo lsusb -v -d 045e:028e

Bus 003 Device 005: ID 045e:028e Microsoft Corp. Xbox360 Controller
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x045e Microsoft Corp.
  idProduct          0x028e Xbox360 Controller
  bcdDevice            1.10
  iManufacturer           1 SHANWAN
  iProduct                2 Controller
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0030
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     93 
      bInterfaceProtocol      1 
      iInterface              0 
      ** UNRECOGNIZED:  10 21 10 01 01 24 81 14 03 00 03 13 02 00 03 00
      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               4
      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               8
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0012
  (Bus Powered)
  Remote Wakeup Enabled

➜ dmesg | grep -A 5 "usb 3-2"
[  613.301311] usb 3-2: USB disconnect, device number 3
[  613.301420] xpad 3-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  613.624818] usb 3-2: new full-speed USB device number 4 using xhci_hcd
[  613.789458] usb 3-2: New USB device found, idVendor=145f, idProduct=01c5, bcdDevice= 2.00
[  613.789465] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  613.789467] usb 3-2: Product: Trust Gamepad
[  613.789468] usb 3-2: Manufacturer: SHANWAN
[  613.817635] input: SHANWAN Trust Gamepad as /devices/pci0000:00/0000:00:08.1/0000:0a:00.3/usb3/3-2/3-2:1.0/0003:145F:01C5.0005/input/input20
[  613.817783] hid-generic 0003:145F:01C5.0005: input,hidraw3: USB HID v1.10 Gamepad [SHANWAN Trust Gamepad] on usb-0000:0a:00.3-2/input0
[  616.435028] usb 3-2: USB disconnect, device number 4
[  616.744813] usb 3-2: new full-speed USB device number 5 using xhci_hcd
[  616.915327] usb 3-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  616.915334] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  616.915336] usb 3-2: Product: Controller
[  616.915337] usb 3-2: Manufacturer: SHANWAN
[  616.940421] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:08.1/0000:0a:00.3/usb3/3-2/3-2:1.0/input/input21
tmarplatt commented 2 years ago

Hmm modinfo reports a different .ko module file for xpad. I believe it's loading the kernel's native xpad module instead?

➜ modinfo xpad
filename:       /lib/modules/5.15.0-48-generic/kernel/drivers/input/joystick/xpad.ko
license:        GPL
description:    X-Box pad driver
author:         Marko Friedemann <mfr@bmx-chemnitz.de>
srcversion:     487C2C241DADE10B46F23B8

...whereas dkms installs modified xpad under /lib/modules/5.15.0-48-generic/extra/. Am I missing a piece here? dkms log:

➜ sudo dkms install -m xpad -v 0.4      

Creating symlink /var/lib/dkms/xpad/0.4/source ->
                 /usr/src/xpad-0.4

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j16 KERNELRELEASE=5.15.0-48-generic KVERSION=5.15.0-48-generic...
Signing module:
 - /var/lib/dkms/xpad/0.4/5.15.0-48-generic/x86_64/module/xpad.ko
Secure Boot not enabled on this system.
cleaning build area...

DKMS: build completed.

xpad.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.15.0-48-generic/extra/

depmod...

DKMS: install completed.
tmarplatt commented 2 years ago

So here's the way I solved this: since the kernel was ignoring the driver installed under /extra I edited dkms.conf in the xpad source directory and changed the DEST_MODULE_LOCATION line like so:

DEST_MODULE_LOCATION[0]="/kernel/drivers/input/joystick"

The Trust gamepad is now working fine. 👍 All buttons, sticks and triggers (including sensitivity) events are being picked up by jstest.

As expected dkms kept a back-up of the original kernel module when I installed xpad from source, so it can be restored safely if needed.

It would be nice if the README included a note regarding this issue, so that users make sure where the original xpad install path is, if present, before installing.

mrfixit2001 commented 2 years ago

If anyone still having this problem is interested, feel free to give the modified xpad driver in my kernel a try. I pulled in some other changes and also made some changes of my own. In my tests everything is working for my different shanwan clones.

MirceaKitsune commented 2 years ago

If anyone still having this problem is interested, feel free to give the modified xpad driver in my kernel a try. I pulled in some other changes and also made some changes of my own. In my tests everything is working for my different shanwan clones.

I don't know how and can't risk using custom kernels unfortunately. My OS is Manjaro in case it's relevant or helpful. I'm still hoping the fix makes its way to the vanilla kernel at last eventually.

paroj commented 2 years ago

If anyone still having this problem is interested, feel free to give the modified xpad driver in my kernel a try. I pulled in some other changes and also made some changes of my own. In my tests everything is working for my different shanwan clones.

I would strongly advise against using a custom kernel just to get some fixes for a gamepad driver.

henriqueffc commented 2 years ago

I'm using the xpad update in kernel 6.0.arch1-1 (Repo - Testing) on Arch Linux and it's working perfectly. I use GNOME and have tested it on Steam, Lutris and the Heroic Game Launcher. My control is a generic SHANWAN. Thanks to @paroj and the other developers for their excellent work.

dkms status                                                                   
xpad/0.4, 6.0.0-arch1-1, x86_64: installed (original_module exists)
lsusb                                                                   
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04f2:b624 Chicony Electronics Co., Ltd Integrated Camera
Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 004: ID 046d:c077 Logitech, Inc. Mouse
Bus 001 Device 002: ID 214b:7250 Huasheng Electronics USB2.0 HUB
Bus 001 Device 005: ID 8087:0a2a Intel Corp. Bluetooth wireless interface
Bus 001 Device 008: ID 045e:028e Microsoft Corp. Xbox360 Controller
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
sudo lsusb -v -d 045e:028e
Bus 001 Device 008: ID 045e:028e Microsoft Corp. Xbox360 Controller
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x045e Microsoft Corp.
  idProduct          0x028e Xbox360 Controller
  bcdDevice            1.10
  iManufacturer           1 SHANWAN
  iProduct                2 Controller
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0030
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     93 
      bInterfaceProtocol      1 
      iInterface              0 
      ** UNRECOGNIZED:  10 21 10 01 01 24 81 14 03 00 03 13 02 00 03 00
      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               4
      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               8
Device Status:     0x0012
  (Bus Powered)
  Remote Wakeup Enabled
modinfo xpad                                                                  
filename:       /lib/modules/6.0.0-arch1-1/updates/dkms/xpad.ko.zst
license:        GPL
description:    X-Box pad driver
author:         Marko Friedemann <mfr@bmx-chemnitz.de>
srcversion:     C6CFE54E056FFB89D5783F2
alias:          usb:v3285p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v3285p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v31E3p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v31E3p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v2F24p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v2F24p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v2E24p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v2DC8p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v260Dp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v260Dp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v2563p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v2563p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v20D6p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v20D6p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v20D6p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1BADp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1BADp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1949p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1949p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1689p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1689p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v162Ep*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v162Ep*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v15E4p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v15E4p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1532p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v1532p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1532p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v146Bp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v146Bp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1430p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1430p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v12ABp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v12ABp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1209p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1209p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v11C9p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v11C9p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v1038p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v1038p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v0F0Dp*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v0F0Dp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v0F0Dp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v0E6Fp*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v0E6Fp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v0E6Fp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v0C12p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v0C12p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v07FFp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v07FFp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v0738p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v0738p4540d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0738p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v0738p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v06A3p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v06A3p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v056Ep*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v056Ep*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v046Dp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v046Dp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v045Ep*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v045Ep*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v045Ep*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v044Fp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v044Fp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v03EBp*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v03EBp*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v0079p*d*dc*dsc*dp*icFFisc5Dip81in*
alias:          usb:v0079p*d*dc*dsc*dp*icFFisc5Dip01in*
alias:          usb:v*p*d*dc*dsc*dp*ic58isc42ip00in*
depends:        ff-memless
retpoline:      Y
name:           xpad
vermagic:       6.0.0-arch1-1 SMP preempt mod_unload 
sig_id:         PKCS#7
signer:         DKMS module signing key
sig_key:        0A:EA:88:12:A4:A9:22:A3:D1:C4:89:6A:8C:49:B3:3F:D7:75:56:50
sig_hashalgo:   sha512
signature:      2B:C7:15:CB:72:08:66:C7:BB:EF:94:D5:AE:25:C3:99:B5:AF:E3:FC:
        BD:53:E1:4A:09:E7:4E:3B:E6:E4:A9:D2:B2:78:AC:DC:F3:0E:F6:C6:
        94:89:E0:4F:45:19:F6:2B:A5:65:DA:C4:06:FF:FD:34:44:6F:44:EA:
        E1:A5:08:57:A2:39:F9:F1:9D:F7:2F:93:B8:E4:BA:82:D8:A6:31:F9:
        C6:D3:6F:15:0A:68:15:DF:1C:49:66:50:40:34:A8:EB:A5:E2:8E:75:
        15:4A:C5:4A:A4:AD:C5:00:25:FA:51:B1:27:00:76:19:0D:77:7B:DE:
        47:EC:DF:2C:35:10:BD:D5:79:57:6D:70:12:ED:29:F1:8C:09:39:2B:
        D5:B1:98:D5:2C:84:37:66:F3:44:98:13:4D:EC:5B:B0:1B:19:2C:9E:
        52:AB:34:C9:16:E7:41:B5:61:91:10:38:2F:3D:B9:AA:D8:F6:26:DD:
        2F:F4:49:1B:C0:B2:B9:17:76:B2:31:38:17:49:DC:44:3A:6F:29:7C:
        2B:78:60:8A:C4:82:68:DD:C0:8C:82:A1:F5:4B:02:07:3D:FB:40:35:
        EF:0B:EC:AD:27:C8:A3:45:A8:8C:BF:0C:9A:CE:48:FF:48:86:5E:55:
        A1:6F:5F:B4:75:CF:0E:F5:5B:A7:8B:5A:6B:99:88:B9
parm:           dpad_to_buttons:Map D-PAD to buttons rather than axes for unknown pads (bool)
parm:           triggers_to_buttons:Map triggers to buttons rather than axes for unknown pads (bool)
parm:           sticks_to_null:Do not map sticks at all for unknown pads (bool)
parm:           auto_poweroff:Power off wireless controllers on suspend (bool)
sudo dmesg | grep -A 5 "usb 1-1"                                            
[    4.478604] usb 1-10: new full-speed USB device number 5 using xhci_hcd
[    4.626433] usb 1-10: New USB device found, idVendor=8087, idProduct=0a2a, bcdDevice= 0.01
[    4.626440] usb 1-10: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    4.699837] usb 1-4.2: new low-speed USB device number 6 using xhci_hcd
[    4.699844] zram0: detected capacity change from 0 to 8388608
[    4.723998] i801_smbus 0000:00:1f.4: SPD Write Disable is set
[    4.724821] i801_smbus 0000:00:1f.4: SMBus using PCI interrupt
[    4.739222] wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
--
[   19.952119] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[   20.092999] usb 1-1: New USB device found, idVendor=2563, idProduct=0575, bcdDevice= 2.00
[   20.093009] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   20.093013] usb 1-1: Product: PS3/PC Gamepad
[   20.093017] usb 1-1: Manufacturer: SHANWAN
[   20.095362] input: SHANWAN PS3/PC Gamepad as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:2563:0575.0004/input/input19
[   20.095744] hid-generic 0003:2563:0575.0004: input,hidraw3: USB HID v1.10 Gamepad [SHANWAN PS3/PC Gamepad] on usb-0000:00:14.0-1/input0
[   20.119706] usb 1-1: USB disconnect, device number 7
[   20.745317] usb 1-1: new full-speed USB device number 8 using xhci_hcd
[   20.887011] usb 1-1: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[   20.887018] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   20.887021] usb 1-1: Product: Controller
[   20.887023] usb 1-1: Manufacturer: SHANWAN
[   20.903655] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/input/input20
[   20.903932] usbcore: registered new interface driver xpad
[   22.415099] rfkill: input handler disabled
MirceaKitsune commented 2 years ago

I'm using the xpad update in kernel 6.0.arch1-1 (Repo - Testing) on Arch Linux and it's working perfectly. I use GNOME and have tested it on Steam, Lutris and the Heroic Game Launcher. My control is a generic SHANWAN. Thanks to @paroj and the other developers for their excellent work.

That is wonderful news! Please put it into the standard kernel in this case: The rest of us experiencing the issue may get to benefit from it in the next 6.x update then.

Oblomov commented 1 year ago

So, the current master on kernel 6.0 on Debian fails to properly initialize the Xiaoji Gamesir-G3w. The reason for this seems to be that the hid-generic driver “catches” it before it gets to xpad, after which the device resets and switches to mimic the 360 controller,

[  +4.192463] usb 1-2: new full-speed USB device number 44 using xhci_hcd
[  +0.151258] usb 1-2: New USB device found, idVendor=05ac, idProduct=055b, bcdDevice= 2.00
[  +0.000017] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  +0.000009] usb 1-2: Product: Gamesir-G3w
[  +0.000005] usb 1-2: Manufacturer: Xiaoji
[  +0.004931] input: Xiaoji Gamesir-G3w as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:05AC:055B.0014/input/input77
[  +0.060209] hid-generic 0003:05AC:055B.0014: input,hidraw2: USB HID v1.10 Gamepad [Xiaoji Gamesir-G3w] on usb-0000:00:14.0-2/input0
[  +0.000325] usb 1-2: USB disconnect, device number 44
[  +0.575255] usb 1-2: new full-speed USB device number 45 using xhci_hcd
[  +0.151027] usb 1-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  +0.000020] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  +0.000009] usb 1-2: Product: XBOX 360 For Windows
[  +0.000006] usb 1-2: Manufacturer: Xiaoji
[  +0.003074] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/input/input78

but apparently the hid-generic device doesn't send the initialization packets correctly, not does xpad anymore, which manifests with the controller showing the correct number of axes and buttons but failing to send any packet (button presses and stick movements are not transmitted).

If I add a comparison for xiaoji as an exception like the shanwan one, the initialization seems to complete correctly. However, the axis order is wrong: there is a “cycle” between the right joystick and the left trigger. The axis order set by the driver seems to be X, Y, Z, RX, RY, RZ, while the device seems to send X, Y, RX, RY, Z, RZ. Moreover, the LEDs are not set to the joystick number, whereas I'm pretty sure the last time I checked this they were being set correctly.

Oblomov commented 1 year ago

After adding option quirks=0x05ac:0x055b:0x80000 to usbhid (thereby preventing it from trying to bind with the device), thus leaving the init entirely up to xpad, the device still has the wrong axes, so I suspect something else might be at play. I do not have any joystick calibration / mapping data preset.