[HOW TO] Use Xbox 360 controller as mouse in Xubuntu
With the help of xboxdrv
, the Userspace Xbox USB Gamepad Driver for Linux, the Xbox 360 controller can be used in Xubuntu as a mouse.
Install
Open a terminal window and run:
sudo apt-get install xboxdrv -y
Usage
Open a terminal window and run:
sudo rmmod xpad
sudo xboxdrv --mouse
Running the last command will make the Xbox 360 Controller produce the following key events:
- LS (move): move mouse cursor
- LS (click): backspace
- LS (move): mouse scroll
- RS (click): space
- D-Pad: up/down/left/right
- Reset: Alt+Left
- Start: Alt+Right
- LB: PageUp
- LT: VolumeDown
- RB: PageDown
- RT: VolumeUp
- Y: enter
- A: mouse left-click
- B: mouse right-click
- X: mouse middle-click
Note: This also works for the original Xbox controller, however I didn't have the chance to test and register the event mapping.
I am getting an error saying that the xpad module does not exist and cannot figure out how to fix it. Any ideas?
ReplyDeleteIf the error happens when running the first command (rmmod) don't worry. I just added this command because xboxdrv would complain if the xpad module was loaded.
DeleteJust run the second command (xbox-controller) and it should work :)
ive tried to run command and it asks for my password but it wont let me type ive tried copy and pasting but couldnt either would appreciate any help thanx
ReplyDeleteYou could try becoming root, prior to running the commands, using: sudo -s
DeleteLinux console hides the password, you are typing but it does not show anything. <-- for future users with similar issue
DeleteI tried and it says "command not found" (xbox controller)
ReplyDeleteI'm so sorry. Actually there was a mistake: it's xboxdrv and not xbox-controller.
Deletexbox-controller is a shell script that I wrote to include the two commands (rmmod and xboxdrv) and not having to type them everytime.
Again, I apologize for the mistake.
Ok thankyou:)
Deleteok i recieved the following error
Delete-- [ ERROR ] ------------------------------------------------------
Error couldn't claim the USB interface: LIBUSB_ERROR_BUSY
Try to run 'rmmod xpad' and then xboxdrv again or start xboxdrv with the option --detach-kernel-driver.
Just to be sure, confirm that you have run the command "sudo rmmod xpad" prior to running "sudo xboxdrv --mouse"
DeleteOk i got it figured out, but is there a way i can remap?
ReplyDeleteI don't how to remap the buttons globally, but I'll investigate on that. I did the remapping in the application where I used the controller.
DeleteOk thanks i wold be extremely greatful:D
DeleteHere's how to remap: http://goo.gl/7rFsb
DeleteIt was working but i closed the terminal and tried it again and it gave me this... "Module xpad does not exist in /proc/modules"
ReplyDeleteDont know how to fix this...
You only need to run rmmod once per session. When you reboot you must run it again before xboxdrv. Then you can run xboxdrv as mamy times as you want.
DeleteAlso, if you close the terminal where xboxdrv is running, the controller will stop working as a mouse.
This comment has been removed by the author.
ReplyDeleteHow to write the script to automatically start controller with system to use it as a --mouse ?
ReplyDeleteTo answer this i'll point you to this guide available at nixCraft. Please let me know if you need further assistance.
DeleteHere's the guide: http://www.cyberciti.biz/tips/linux-how-to-run-a-command-when-boots-up.html
DeleteThanks i hope this will solve my problem while i wait for a new mouse
ReplyDeletehi, sorry for bothering, please help
ReplyDeletewhen i write sudo rmmod xpad i ged
root@eduardo-HP-Mini-110-1100:~# sudo rmmod xpad
rmmod: ERROR: Module xpad is not currently loaded
then, when I write sudo xboxdrv --mouse i get
root@eduardo-HP-Mini-110-1100:~# sudo xboxdrv --mouse
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke
Licensed under GNU GPL version 3 or later
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions; see the file COPYING for details.
Controller: Microsoft Xbox 360 Play&Charge Kit
Vendor/Product: 045e:028f
USB Path: 005:008
Controller Type: Xbox360 Play&Charge
-- [ ERROR ] ------------------------------------------------------
The Xbox360 Play&Charge cable is for recharging only, it does not transmit data, thus xboxdrv can't support it. You have to get a wireless receiver:
* http://www.xbox.com/en-ca/hardware/x/xbox360wirelessgamingreceiver/
-------
help please, and thank you!!
It's OK for the rmmod command to fail.
DeleteHowever, it seems that the controller you're using is a wireless controller, not an usb controller, so it won't work.
helo Wilson,
ReplyDeleteit worked well here, thank you! However, when I close the terminal, the controller stops. Is this normal?
Yes it is. It stops because the xboxdrv is killed when the terminal is closed.
DeleteIf you want to keep xboxdrv running and close the terminal first run: sudo -s
Now run: nohup xboxdrv --mouse &
Close the terminal