Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dnmodder opened this issue Dec 2, 2018 · 61 comments

Comments

@dnmodder
Copy link

dnmodder commented Dec 2, 2018

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

This comment has been minimized.

@MirceaKitsune
Copy link

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
Copy link

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
Copy link
Author

dnmodder commented Aug 8, 2021

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

@MirceaKitsune
Copy link

@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
Copy link
Author

dnmodder commented Aug 8, 2021

@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
Copy link

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
Copy link
Author

dnmodder commented Aug 9, 2021

@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
Copy link

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
Copy link
Owner

paroj commented Aug 14, 2021

should be fixed with 2bfb0e1

@paroj paroj closed this as completed Aug 14, 2021
@MirceaKitsune
Copy link

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
Copy link
Owner

paroj commented Aug 15, 2021

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 paroj reopened this Aug 22, 2021
paroj pushed a commit that referenced this issue Aug 22, 2021
Many knockoff brands emulating the XBOX 360 controller do not properly
send data unless configured correctly. Examples include the Gamesir G3w
and the Fantech GP11 Shooter.

Protocol inspection of communication with other operating systems
reveals a sequence of control messages that can be used to initialize
the controllers sufficiently to send proper data.

- fixes #119
- breaks #171

Proposed-by: Darvin Delgado <dnmodder@gmail.com>
@paroj
Copy link
Owner

paroj commented Aug 22, 2021

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
Copy link

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

@mrfixit2001
Copy link

mrfixit2001 commented Sep 1, 2021

@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.
mrfixit2001/rockchip-kernel@4c7d778

@MirceaKitsune
Copy link

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
Copy link

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
Copy link
Owner

paroj commented Sep 7, 2021

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:
f44c551

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
Copy link

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.

@bradyhaley
Copy link

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
Copy link

amardhruva commented Jul 22, 2022 via email

@bradyhaley
Copy link

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
Copy link

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
Copy link

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

@mrfixit2001

This comment was marked as off-topic.

paroj pushed a commit that referenced this issue Sep 8, 2022
Many knockoff brands emulating the XBOX 360 controller do not properly
send data unless configured correctly. Examples include the Gamesir G3w
and the Fantech GP11 Shooter.

Protocol inspection of communication with other operating systems
reveals a sequence of control messages that can be used to initialize
the controllers sufficiently to send proper data.

- fixes #119
- breaks #171

Proposed-by: Darvin Delgado <dnmodder@gmail.com>
paroj pushed a commit that referenced this issue Sep 8, 2022
Many knockoff brands emulating the XBOX 360 controller do not properly
send data unless configured correctly. Examples include the Gamesir G3w
and the Fantech GP11 Shooter.

Protocol inspection of communication with other operating systems
reveals a sequence of control messages that can be used to initialize
the controllers sufficiently to send proper data.

- fixes #119
- breaks #171

Proposed-by: Darvin Delgado <dnmodder@gmail.com>
@tmarplatt
Copy link

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 @ f21824c 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 Enableddmesg | 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
Copy link

tmarplatt commented Oct 4, 2022

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
Copy link

tmarplatt commented Oct 5, 2022

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
Copy link

mrfixit2001 commented Oct 11, 2022 via email

@MirceaKitsune
Copy link

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
Copy link
Owner

paroj commented Oct 11, 2022

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
Copy link

henriqueffc commented Oct 11, 2022

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
Copy link

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
Copy link
Contributor

Oblomov commented Dec 23, 2022

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
Copy link
Contributor

Oblomov commented Dec 23, 2022

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.

@Oblomov
Copy link
Contributor

Oblomov commented Dec 23, 2022

Sorry, the axis information may have been a glitch in jstest-gtk. However, the leds are still not working as expected.

@rufreakde
Copy link

rufreakde commented May 7, 2023

So I recently bought an X-input controller from 8BitDo facing a similar issue.

Device is being recognized in USB but not working in xpad... it is not even creating an /dev/input file? (not listed in cat /proc/bus/input/devices)

Any idea how to troubleshoot this?

lsusb
...
Bus 001 Device 002: ID 2dc8:3106 8BitDo Ultimate Wireless Controller
sudo lsusb -v -d 2dc8:3106
Bus 001 Device 002: ID 2dc8:3106 8BitDo Ultimate Wireless 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           0x2dc8 8BitDo
  idProduct          0x3106 
  bcdDevice            1.14
  iManufacturer           1 8BitDo
  iProduct                2 Ultimate Wireless Controller
  iSerial                 3 5b1212d817e4
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0030
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    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:     0x0000
  (Bus Powered)

The information I get on connect:

journalctl -f
Mai 07 14:24:57 mini-pc kernel: usb 1-3: New USB device found, idVendor=2dc8, idProduct=3109, bcdDevice= 2.00
Mai 07 14:24:57 mini-pc kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mai 07 14:24:57 mini-pc kernel: usb 1-3: Product: Ultimate Wireless Controller
Mai 07 14:24:57 mini-pc kernel: usb 1-3: Manufacturer: 8BitDo
Mai 07 14:24:57 mini-pc kernel: usb 1-3: SerialNumber: 5b1212d817e4
Mai 07 14:24:57 mini-pc kernel: hid-generic 0003:2DC8:3109.0004: hiddev96,hidraw3: USB HID v1.11 Device [8BitDo Ultimate Wireless Controller] on usb-0000:02:00.0-3/input0
Mai 07 14:24:57 mini-pc mtp-probe[3735]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3"
Mai 07 14:24:57 mini-pc mtp-probe[3735]: bus: 1, device: 6 was not an MTP device
Mai 07 14:24:57 mini-pc mtp-probe[3752]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3"
Mai 07 14:24:57 mini-pc mtp-probe[3752]: bus: 1, device: 6 was not an MTP device
Mai 07 14:26:39 mini-pc kernel: usb 1-3: USB disconnect, device number 6
Mai 07 14:26:40 mini-pc kernel: usb 1-3: new full-speed USB device number 7 using xhci_hcd
Mai 07 14:26:40 mini-pc kernel: usb 1-3: New USB device found, idVendor=2dc8, idProduct=3106, bcdDevice= 1.14
Mai 07 14:26:40 mini-pc kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mai 07 14:26:40 mini-pc kernel: usb 1-3: Product: Ultimate Wireless Controller
Mai 07 14:26:40 mini-pc kernel: usb 1-3: Manufacturer: 8BitDo
Mai 07 14:26:40 mini-pc kernel: usb 1-3: SerialNumber: 5b1212d817e4
Mai 07 14:26:40 mini-pc mtp-probe[3797]: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3"
Mai 07 14:26:40 mini-pc mtp-probe[3797]: bus: 1, device: 7 was not an MTP device
Mai 07 14:26:40 mini-pc mtp-probe[3798]: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-3"
Mai 07 14:26:40 mini-pc mtp-probe[3798]: bus: 1, device: 7 was not an MTP device

I used this script provided here in the thread in hopes to have it working correctly but it did not work. (script succeeded without issues though / also generated a rule )

cat /etc/udev/rules.d/99-gamesir-g3w-fix.rules
ACTION=="add", ATTRS{idProduct}=="3109", ATTRS{idVendor}=="2dc8", DRIVERS=="usb", RUN+="/usr/local/bin/gamesir-g3w-fix.py"

adding also some additional info:

sudo dmesg | grep -A 5 "usb 1-3"
[    1.088920] usb 1-3: new full-speed USB device number 2 using xhci_hcd
[    1.348623] ata2: SATA link down (SStatus 0 SControl 330)
[    1.398401] tsc: Refined TSC clocksource calibration: 3599.998 MHz
[    1.398414] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x33e451ab1a6, max_idle_ns: 440795278720 ns
[    1.398454] clocksource: Switched to clocksource tsc
[    1.457417] usb 1-3: New USB device found, idVendor=2dc8, idProduct=3106, bcdDevice= 1.14
[    1.457422] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    1.457424] usb 1-3: Product: Ultimate Wireless Controller
[    1.457425] usb 1-3: Manufacturer: 8BitDo
[    1.457426] usb 1-3: SerialNumber: 5b1212d817e4
[    1.642400] usb 1-4: new full-speed USB device number 3 using xhci_hcd
[    1.659808] ata5: SATA link down (SStatus 0 SControl 330)
[    1.972093] ata6: SATA link down (SStatus 0 SControl 330)
[    1.973479] Freeing unused decrypted memory: 2036K
[    1.973904] Freeing unused kernel image (initmem) memory: 4360K
--
[  516.782343] usb 1-3: USB disconnect, device number 2
[  517.565300] usb 1-3: new full-speed USB device number 6 using xhci_hcd
[  517.855313] usb 1-3: New USB device found, idVendor=2dc8, idProduct=3109, bcdDevice= 2.00
[  517.855321] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  517.855324] usb 1-3: Product: Ultimate Wireless Controller
[  517.855327] usb 1-3: Manufacturer: 8BitDo
[  517.855329] usb 1-3: SerialNumber: 5b1212d817e4
[  517.875203] hid-generic 0003:2DC8:3109.0004: hiddev96,hidraw3: USB HID v1.11 Device [8BitDo Ultimate Wireless Controller] on usb-0000:02:00.0-3/input0
[  619.837990] usb 1-3: USB disconnect, device number 6
[  620.620652] usb 1-3: new full-speed USB device number 7 using xhci_hcd
[  620.991131] usb 1-3: New USB device found, idVendor=2dc8, idProduct=3106, bcdDevice= 1.14
[  620.991137] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  620.991140] usb 1-3: Product: Ultimate Wireless Controller
[  620.991143] usb 1-3: Manufacturer: 8BitDo
[  620.991145] usb 1-3: SerialNumber: 5b1212d817e4
modinfo xpad
filename:       /lib/modules/6.2.12-200.fsync.fc37.x86_64/kernel/drivers/input/joystick/xpad.ko.xz
license:        GPL
description:    X-Box pad driver
author:         Marko Friedemann <mfr@bmx-chemnitz.de>
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
intree:         Y
name:           xpad
vermagic:       6.2.12-200.fsync.fc37.x86_64 SMP preempt mod_unload 
sig_id:         PKCS#7
signer:         Fedora kernel signing key
sig_key:        3B:72:B8:C1:F7:A2:06:4F:BD:05:AC:75:3A:D6:34:29:66:5D:4E:40
sig_hashalgo:   sha256
signature:      AC:16:42:35:92:22:D5:07:8B:25:D5:3C:58:0A:B6:F8:87:C3:5A:27:
                AF:62:6C:1A:A0:8A:57:A1:C2:F5:23:FA:3F:75:B8:73:8B:AA:AB:FF:
                54:BF:DF:32:84:E4:25:D0:0B:14:66:42:7C:5B:B1:DF:E6:66:D7:63:
                04:AA:53:BA:F2:8D:4E:DD:44:61:8A:52:BE:48:41:14:43:F4:AF:9D:
                D4:F8:22:BE:57:E0:12:A3:E0:5B:D2:5B:3B:B0:91:45:A3:97:23:61:
                99:5D:65:2D:4F:B4:F3:12:DF:3E:A9:83:7D:42:CF:DB:48:24:A1:DD:
                E4:BB:51:87:A4:6A:6D:0D:B4:5F:4A:58:6A:03:95:2F:6E:39:E0:06:
                40:2D:BB:B7:E7:A2:76:3D:DB:8D:37:3E:C5:EA:AD:50:08:0E:07:19:
                F2:4B:54:A8:7F:0C:03:2F:A5:B0:95:C6:F1:3B:03:BA:EB:6B:76:20:
                DB:B4:25:7B:D5:88:D6:9E:B7:E9:A5:7B:BE:CF:FF:37:FE:14:DB:18:
                38:88:D7:77:0B:B7:60:42:BD:25:56:54:D0:57:13:D9:77:EE:A7:F3:
                4A:2B:5B:C7:98:36:43:73:45:6D:8E:33:B7:7B:CF:1F:B2:B4:F9:83:
                EC:FA:FD:BA:12:DF:EA:90:07:30:34:99:C0:74:08:1F:D3:3D:FC:6E:
                36:0A:BA:8B:F4:EA:10:98:C2:C8:CB:1E:DB:C3:55:47:5B:AC:AD:E8:
                DA:ED:54:15:73:B6:E3:2F:6D:81:AD:9C:3F:88:9A:D2:A4:9F:ED:B4:
                4A:4E:60:BB:CF:51:42:34:6E:0D:8A:DD:B2:62:19:3B:15:20:23:E1:
                DC:3B:9A:F8:F7:FD:78:7C:AE:8C:04:A9:16:DA:FD:EA:3A:F3:6B:F6:
                95:81:82:E0:50:1E:D5:F1:8C:5B:EE:2F:B6:F0:37:A3:F3:87:E3:FA:
                B3:9A:AE:6B:62:95:B3:C2:F8:BA:1D:DD:81:EB:86:1A:8C:29:2C:2B:
                99:8C:09:03:18:6D:38:8C:9C:97:E2:03:04:AC:23:CE:DF:B0:7A:08:
                3C:B7:42:BA:B9:42:F9:5E:B6:A8:7F:D2:9E:34:27:8A:47:51:FB:71:
                72:AD:BB:00:14:03:15:5C:99:EE:8C:FF:6A:6F:23:AC:C0:68:CA:43:
                EB:65:92:47:B1:9A:90:55:63:97:D8:57:30:37:97:73:1A:A7:6C:E4:
                E3:78:29:35:C2:F2:7F:17:D7:2D:F2:79:74:2E:BE:60:3B:B0:A8:16:
                F8:82:52:34:03:E7:76:56:53:7D:5D:8B:C3:94:C6:A8:63:5E:5E:9E:
                85:CC:2C:C1:52:44:01:BF:33:6C:E1:35
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)

What should I try next any ideas? In steam and in system settings no gamepad is found. (I guess because its not in /dev/inputs)

@dnmodder dnmodder changed the title Some controllers that mimic that of xbox 360 are not initialized correctly Some controllers that mimic the Xbox 360 Controller are not initialized correctly Jul 20, 2023
@AndrewPrzelucki
Copy link

Hi, is there any chance for a driver for a wireless PC/PS3 gamepad that is identified under Linux as 2563:0526 (vendor:product)? The pad is named "SHANWAN Android Gamepad" and from what I found out it's made by ShenZhen ShanWan Technology. The Windows driver is [here (link)] (https://esperanza.pl/esperanza-gamepad-bezprzewodowy-2-4ghz-ps3-pc-usb-gladiator-czarny,176,1697.html). The gamepad offers rumble but it's not working under Linux, and also the analog/digital switch isn't working under Linux. I found a driver on GitHub (link) but it's for a different product ID, namely 2563:0575. The ShenZhen ShanWan Technology Co., Ltd webpage lists a few they make and I found a similar one here (link), but I don't have any information about the product number other than that mine is 2563:0526 but the webpage calls it BM-977. Any information is welcomed, maybe someone knows about a Linux driver somewhere. I found a python script (link) for another model, but it doesn't work for my product ID. Thanks!

@SteavenGamerYT
Copy link

any workaround?
i have Bus 007 Device 002: ID 2563:0526 ShenZhen ShanWan Technology Co., Ltd. Android Gamepad

@MirceaKitsune
Copy link

The issue has been fixed for me! Manjaro is now on Kernel 6.7.7: My controller is recognized on the X-box setting automatically, no need to use the workaround Python script to reset it. Has the problem been solved for everyone? If others are still experiencing it, that must mean I'm among the lucky ones to get an exception for my model, an ideal solution should be universal and recognize all such devices.

@SteavenGamerYT
Copy link

give me the python script pls

@MirceaKitsune
Copy link

give me the python script pls

#!/usr/bin/env python3

# 1: etc/udev/rules.d/99-fixcontroller.rules
# 2: ACTION=="add", ATTRS{idProduct}=="028e", ATTRS{idVendor}=="045e", DRIVERS=="usb", RUN+="/path/to/script.py"
# 3: sudo udevadm control --reload

import os
import sys

try:
	import usb.core
	import usb.util
except ImportError:
	print("First, install the pyusb module with PIP or your package manager.")
else:
	if os.geteuid() != 0:
		print("You need to run this script with sudo")
		sys.exit()

	dev = usb.core.find(find_all = True)

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

@SteavenGamerYT
Copy link

Bus 005 Device 006: ID 2563:0526 ShenZhen ShanWan Technology Co., Ltd. Android Gamepad

@SteavenGamerYT
Copy link

defernt ids in the script tho

@SteavenGamerYT
Copy link

sometimes it appears as Bus 005 Device 002: ID 057e:2009 Nintendo Co., Ltd Switch Pro Controller

@amardhruva
Copy link

amardhruva commented Apr 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests