Advertisement
metalx1000

Fix Gamepad/Joystick on Linux ifyoo

Jan 5th, 2020
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. #fix gamepad/joystick
  2. #ifyoo - /dev/input/by-id/usb-SHANWAN_Controller-event-joystick
  3.  
  4. #install needed python libs
  5. sudo apt install python3-usb
  6.  
  7. #get fix script
  8. #https://gist.github.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3
  9. wget "https://gist.githubusercontent.com/dnmodder/de2df973323b7c6acf45f40dc66e8db3/raw/693b848098dfc5f0fd03bdcdd9162fde3f2fb482/fixcontroller.py"
  10.  
  11. chmod +x fixcontroller.py
  12.  
  13. #you will need to run this every time you plug the controller in
  14. sudo ./fixcontroller.py
  15.  
  16. #test the controller
  17. sudo cat /dev/input/js0
  18.  
  19.  
  20.  
  21.  
  22.  
  23. ###############################3
  24.  
  25. #!/usr/bin/env python3
  26.  
  27. import usb.core
  28.  
  29. dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
  30.  
  31. if dev is None:
  32.     raise ValueError('Device not found')
  33. else:
  34.     dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
  35.  
  36. ##############################3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement