Overview
Making a X360/Shanwan (058e:028e) controller work in Linux
Introduction
Hello there! I have a Defender Scorpoin L3 gamepad.
It can work in two modes: as an Xbox 360 gamepad (058e:028e) and as a Shanwan PS3 gamepad (2563:0575). Here is a screenshot of lsusb in both modes.
As you see, Linux recognizes it in both modes. It works fine in Shanwan mode, but in Xbox mode keys are not working!
How to make it work
I’m using Raspbian, but it should work in any GNU/Linux distro.
So, how to make it work? Huh, it’s easy.
1. Open terminal and enter root console with sudo -s or su
2. Now install pyusb library with pip3 install pyusb
Now you can close the console.
3. Download fixcontroller.py (HUUUGE thanks to dnmodder for making this script) [link] or direct link [link] and put it in home directory (~/)
4. Allow execution of fixcontroller.py. There are 2 main ways: right click and going to properties or just write in console sudo chmod +x fixcontroller.py
5. To make it work you can just execute the script with root privelegies! (sudo ./fixcontroller.py or sudo python ~/fixcontroller.py)
Or…
Add it to autostart
In Raspbian (or another LXDE distro) you need to create fixcontroller.desktop file (actually, you can name it whatever you like) in ~/.config/autostart/
and put this code
Postscriptum
Putting this script in autostart is not the best way, because your controller needs to be plugged in during the script execution. If you insert your controller after, it won’t work! You need to reboot or manually run the script. Would be better to execute the script when device is connected, but I don’t know how to do this.