Fix This! – Xbox Contoller Driver In Userspace, An End To “Blinky Lights”

How bout a quick fix to  a sometimes very annoying issue I come across in gaming on Linux?  Sure!?  That’s the spirit.  It is no secret that the Xbox 360 controller works dandy in Linux, it really does.  The crux of the matter is in how it sometimes “malfunctions” when connecting to the system via USB.  The driver you likely are using is the kernel-space “xpad-kernel” module, which at times, is not very nice to you.  If I don’t have my controller plugged in before starting my system, often I will get the “4 blinky-lights-I-can’t-connect-to-the-system-derrrrrpppp” LED status on the controller.  How do I fix that without rebooting?  Read on…

Kernel-space vs. User-space

The quick answer to this is the obvious:  things that run from the kernel are “kernel space,” and those that are initiated from the user reside in “user space.”  In a simplistic view, kernel space and user space are “sandboxed” from one another, restricting access unless you go all Rambo with a superuser account of course.  The kernel interfaces with all of your system’s hardware, including the CPU, memory, devices, and so on.  Most hardware works just fine loading modules from the kernel, but there are times when “services” are needed.

On systemd (the most popular full-features init system over the old SysV), services can easily be enabled in user space to load software and drivers.  Plex Media Server is one example of this.  To always have Plex running in the background, the following is required after post installation:

sudo systemctl start plexmediaserver
sudo systemctl enable plexmediaserver

The former starts the service, and if satisfied, the latter will enable the service going forward.  A service is highly beneficial in user space, being independent of the kernel, and thus being more safe in it’s execution.  Of course you don’t want to go willy nilly and enable any old service of course.  Let’s get on to the meat of this, enabled the xboxdrv service…

Xbox Controller driver in user land

To solve this, I scoured around and found “xboxdrv,” a user land Xbox Controller service that runs great on Linux.  The source code can be found here.  For those who do not know, building from source code generally goes like this:

./configure
make
make install

To avoid a lengthy discussion on other aspect of building from source, please see this forum post if you still have questions.  Alternatively, you can use the github source site here.  For this example, I will be using the Arch User Repository “xboxdrv-stable-git 20130227-1” located on the AUR.  You can use your favourite AUR helper if you wish, but I generally suggest doing it the “manly way” or using a very minimal AUR helper that still requires intervention, such as “cower.”  the ‘makpkg -csi’ option set will build the PKGBUILD and install it, install any possible dependencies if it can, and afterwards clean up said files. Then we will need to copy the service file into the area systemd uses, start it, then enable it if you are satisfied. That said, let’s install the package (where $USER is your user name):

cd /home/$USER/
mkdir -p software/xboxdrv-git
wget https://aur.archlinux.org/packages/xb/xboxdrv-stable-git/xboxdrv-stable-git.tar.gz
tar -xvf xboxdrv-stable-git/xboxdrv-stable-git.tar.gz
cd xboxdrv-stable-git
makepkg -csi
sudo cp xboxdrv.service /etc/systemd/system/
sudo systemctl start xboxdrv
sudo systemctl enable xboxdrv

Now, plug in your controller, and you should be ready to go in the future.  Hopefully this helped a few people, and if you have any questions, be sure to leave a comment below.

Source:
http://pingus.seul.org/~grumbel/xboxdrv/
http://github.com/Grumbel/xboxdrv/
https://aur.archlinux.org/packages/cower/
https://aur.archlinux.org/packages/xboxdrv-stable-git/

Advertisements

About professorkaos64

www.libregeek.org

Posted on 20130929, in Fix This!, How-To and tagged , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s