I am using a wireless Xbox 360 controller with openSUSE 11.1. I use it for some emulators and all buttons work fine. There is however an annoying problem, the Xbox controller left joystick controls the cursor and digital pad acts as mouse buttons. So while I play, the cursor moves all around the screen and bad things could happen. Why this behavior? In xorg.conf there seems to be only just 1 mouse. And if I go in Joystick via YaST, there is only a menu to select which joystick I have. But my wireless controller has been automatically detected, I didn’t setup anything. Is there a config file that I can modify to stop controlling the mouse with my gamepad?
I found a nice workaround, but it only works with Xbox 360 controllers (wired or wireless). The solution is to use another driver for the controller, instead of the kernel xpad module. The driver is xboxdrv. With this, there is no problem with the gamepad acting as a mouse.
It’s simple to make it working. It runs in userspace so you don’t need to recompile the kernel. Simply follow instructions in the included README. Don’t forget to blacklist xpad before making anything. The only problem however is that I don’t know how to run it as a daemon. I would need to make a startup script but I don’t know how to do it. And there is no rc.local in openSUSE, only boot.local, which doesn’t work because it runs before any run-levels. For now, I run it with sudo in a terminal before playing a game.
Hi
There is a template to use in /etc/init.d called skeleton, you just
need to adapt that for your requirements.
–
Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.21-0.1-default
up 1 day 12:29, 3 users, load average: 0.24, 0.36, 0.25
GPU GeForce 8600 GTS Silent - Driver Version: 180.51
Yeah, I just realized there was a template for scripts. I made one and the xboxdrv daemon runs perfectly, without any troubles!
Hi
Kewl So how do you interface the controller? I’m intrigued as I have
an xbox360/wireless controllers. Maybe a howto submission from you
(and the script)?
–
Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.21-0.1-default
up 10:59, 1 user, load average: 0.02, 0.04, 0.17
GPU GeForce 8600 GTS Silent - Driver Version: 180.51
– HOW TO use xboxdrv with openSUSE 11.1 –
First, download the source code of the driver from here and extract it: Userspace Xbox/Xbox360 USB Gamepad Driver for Linux Make sure too your gamepad or wireless receiver is plugged in.
Before compiling, you’ll have to make sure you have all required packages. These are required to be installed:
- libusb-1_0-devel
- libboost*
- boost-devel
- scons
- xorg-x11-libX11-devel
- dbus-1-python
- dbus-1-python-devel
Now, we have to make sure the current xpad kernel module won’t load anymore, by blacklisting xpad. Add this line to /etc/modprobe.d/blacklist and reboot:
blacklist xpad
Open a terminal and go to the directory you extracted earlier. Type:
% scons
It should successfully compile and after that you’ll have a new binary file named xboxdrv. That’s the driver. Copy this file and tools/xboxdrv-daemon.py where you want to keep them. I chose /usr/local/bin/xboxdrv.
Before making an init script, you’ll want to test it. We have to load first the kernel modules uinput and joydev. As root, type this:
% modprobe uinput
% modprobe joydev
Next, still as root, execute the driver:
% /usr/local/bin/xboxdrv/xboxdrv
and press the Xbox button on the controller. Only the LED 1 should stay lit. If you move the joysticks or press buttons, you should see a lot numbers appearing in the terminal. That means it works and the joystick is now a device as /dev/input/js0. Try a game and see if everything works as you want. Run /usr/local/bin/xboxdrv/xboxdrv --silent to avoid unnecessary CPU time spent on logging the buttons.
Now that you know it works, we’ll make it run as a daemon. The Python script xboxdrv-daemon.py is for that. Simply run as root:
% /usr/local/bin/xboxdrv/xboxdrv-daemon.py --xboxdrv /usr/local/bin/xboxdrv/xboxdrv &
You could do that everytime before launching a game but an init script will set it and forget it. I made a really simple init script that for now only starts the daemon. At shutdown, it kills itself automatically without problems, but the LED on the gamepad stay lit. There should be commands in stop section to make it properly shutdown.
#!/bin/sh
### BEGIN INIT INFO
# Provides: xboxdrv
# Required-Start: joystick
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop:
# Short-Description: xboxdrv daemon
# Description: Launch the xboxdrv daemon
### END INIT INFO
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting xboxdrv daemon "
/sbin/modprobe uinput
/sbin/modprobe joydev
/usr/local/bin/xboxdrv/xboxdrv-daemon.py --xboxdrv /usr/local/bin/xboxdrv/xboxdrv &
rc_status -v
;;
stop)
rc_status -v
;;
try-restart|condrestart)
rc_status
;;
restart)
rc_status
;;
force-reload)
rc_status -v
;;
reload)
rc_status -v
;;
status)
rc_status -v
;;
probe)
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit
Put this script in /etc/init.d/ and execute:
% /sbin/insserv /etc/init.d/<scriptname>
For more info on how to create an init script, use and read the template file /etc/init.d/skeleton
And for more information too on the driver, read the README provided with it. It is really well structured and explained.
P.S.: I’m French speaking, sorry for my bad English.
Thanks very much, this is a good news for me!