Steam for Linux

Steam for Linux

Not enough ratings
Making a X360/Shanwan controller work in Linux
By littledpurple
Making a X360/Shanwan (058e:028e) controller work in Linux
   
Award
Favorite
Favorited
Unfavorite
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) https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3 or direct link https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3/raw/693b848098dfc5f0fd03bdcdd9162fde3f2fb482/fixcontroller.py 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
[Desktop Entry] Version=1.0 Name=Fixcontroller Comment=Fixing controller Exec=sudo ./fixcontroller.py Terminal=false Type=Application OnlyShowIn=Gnome;Unity;LXDE; X-GNOME-Autostart-Phase=Initialization
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.
1 Comments
Mead Champion Apr 19 @ 1:21pm 
It helped, thanks. On Debian a simple sudo apt install python3-usb worked for me instead of pip3 install pyusb . After that the script can be run.