bookmark_borderUse a XBox 360 Wireless Controller under Linux

NOTE: This article is now outdated. Normally you don’t need to install the xboxdrv anymore. A recent Linux kernel comes with a driver already included. So it’s simple Plug ’n Play. You can now also pair more than one wireless controller to one receiver.
A lot of games today need a controller … yes, even on PC you can’t ignore that fact. One of the best controllers out there is (IMHO) the XBox 360 Wireless Controller from Microsoft. The Wired version of this controller can be easily connected through Plug & Play under Linux. The standard loaded driver xpad then can handle it. But what do you have to do if the controller is the wireless Version?

First things first

You need of course a receiver which gets all the signals that are sent from your controller. This receiver is (normally) not included when you’re buying the controller. The receiver also comes from Microsoft and costs round about 20 $. I have also seen some third party products here which are way more cheaper, but actually I really can’t say if they are working that well.
After you plugged in the receiver, the kernel will recognize it but yet it is actually unable to do anything.

Install the driver

As I mentioned before, if you’re useing the wired controller, then you have to nothing to be worried about. Everything will work out of the box.
Anyways, for the wireless XBox 360 Controller you need a driver which is called ‚xboxdrv‘.
Under Ubuntu and Debian this driver can be easily installed with apt. This means the driver is already available in the repositorys:

sudo apt-get install xboxdrv

In openSUSE the driver is also in the official repositorys as long as you are on openSUSE Tumbleweed or Leap (>= 42.1):

sudo zypper install xboxdrv

For Fedora, Arch and any other distribution you have to check for your owner whether you need a extra repository for the driver or not.

Start the driver

Starting the driver with default settings is rather simple. The following command starts the driver with default settings:

sudo xboxdrv

If you didn’t unloaded the xpad driver before you will run into an error message that the driver couldn’t be loaded because the xpad driver is already loaded.
To unload the xpad module you can use ‚rmmod xpad‘ or let the xboxdrv do that for you:

sudo xboxdrv --detach-kernel-driver

Now you should see something like the following output on your terminal window:
Controller: Xbox 360 Wireless Receiver
Vendor/Product: 045e:0719
USB Path: 005:004
Wireless Port: 0
Controller Type: Xbox360 (wireless)

Your Xbox/Xbox360 controller should now be available as:
Press Ctrl-C to quit, use ‚–silent‘ to suppress the event output
So this means, you’re ready to go. Useing buttons and pads on the controller should create tons of output which you can ignore. Do disable this output add the ‚–silent‘ option to the xboxdrv command:
sudo xboxdrv --detach-kernel-driver --silent
Now you should be able to use your XBox 360 Wireless controller with almost every native Linux game which is available.

Using xboxdrv with WINE

For using xboxdrv with WINE there are a lot of tutorials out there. Some of them recommend to install a mapper which will map controller keys to keyboard keys and many other solutions. For me the simpelst way was to simply add the following parameter to the xboxdrv command line:

sudo xboxdrv --detach-kernel-driver --silent --mimic-xpad

The „–mimic-xpad“ option says the xboxdrv driver that he should act and perform like a controller that is connected to your Linux box as an xpad Controller. Now you should be also able to use your controller under WINE games.
NOTE: I recently bought Dark Souls: Prepare to die edition from the Humble Bundle Sping Sale. This game does not come native to Linux but works well here with WINE. To get the correct mapping of your XBox 360 Wireless controller here you have to start xboxdrv like this:

sudo xboxdrv --detach-kernel-driver --silent --mimic-xpad --buttonmap 1=3,3=1,2=4,4=2,rt=start,lt=back,start=rt,back=lt --ui-buttonmap guide=KEY_LEFTSHIFT+KEY_TAB,rt=KEY_END,lt=KEY_G

If you want to play Dark Souls I with a controller on your Linux box with WINE, you have to add the „buttonmap“ section to your xboxdrv command. Otherwise the B-Button in game will be the X-Button on your wireless controller for e.g.
Of course, this „buttonmap“ section only works with Dark Souls I for now. Other games, other button mapping. You should consult the AppDB from WINE to find the right button mapping for your game.

bookmark_borderUnity, KDE, GNOME-Shell and the other DEs

Greetings readers,
I’m actually torn between the Desktop Enviroments at my Ubuntu 12.04 installation. I’ve tried KDE, Unity, GNOME Shell, GNOME Panel and at least Xfce.
At my first steps with Linux I was very familiar with KDE. The easy reason: it’s more Windows like. So I started at this time with SUSE 9.x and KDE 3.x, and it was just awesome!
Well, KDE 4 at the beginning was … let us say „a giant grizzling kid“. But since the latest versions it actually has grown up and I’ve tested it so many times so that I can say „Yes, it’s useable again!“. Anyway, I don’t want to roll back to KDE. Don’t get my wrong, I love Qt and C++ (for the development), but I actually don’t want to tune my desktop as much as I can, just to get a useable and good looking DE for me. People who just came from Windows and want to work on nearly the same way as they did under this OS, they can just go with KDE and I’m sure they will be happy. Also, people who want to configure every howsoever small thing at their DE are doing nothing wrong with useing KDE.
For myself, I have actually clear things, which I wanna do with my desktop. Compiling with GCC, bash access, the possibility to get onto my servers via SSH, surfing and checking my mails and at least, playing some games, but anyway the last point I have to do under Windows or my PS3 …
Over time of useing Linux and their DEs I found out, that I don’t need a high customizable desktop, I just need one who helps me to get my things done. Unity and even GNOME Shell are both desktops who gave me this possibility. And both aren’t that bad looking, which is a very nice side effect. Sure, you have to learn how to deal with some new features and ways to work but if you one time know, who to deal with this both new DEs, you will profit from it.
For example, even at the time I was useing KDE, I started to get programs running with the help of „ALT+F2“ (KRunner). So, the SUPER key useage at Unity and GNOME Shell is the best way for me to start my programs.
Yes, I have to say, I like both desktops GNOME Shell and Unity. But if I would get forced to just pick one of those, I would go with GNOME Shell. But you know what, I’m useing Linux, so I didn’t get forced to anything 😉
I also looking sometimes to the GNOME Panel, better known as „GNOME Fallback“. For me it is also useable. It brings me the GNOME 2 feeling back and with the combination of ALT+Right click I’m also able to add new stuff to my panels. Well, I read always that there isn’t the whole stuff available for the GNOME 3 Panel, which was available for GNOME 2, but I personally just used the „Process Monitor“ applet as additional stuff on GNOME 2, which is also available under GNOME 3 Panel.
That said, I’m actually useing some „hybrid modes“ for myself. At work, I have an instance of Ubuntu 12.04 with GNOME Panel and an instance of openSUSE Tumbleweed with GNOME Shell running. I’m also thinking about to install GNOME Shell under Ubuntu, too.
At home my notebook is running Ubuntu with Unity and GNOME Panel. I like to use Unity when it comes to mobility and I like to use the classic GNOME Panel when it comes to „workstation replacement“ (this means the notebook connected to a monitor for me).
Anyway, use what you want or better, use what’s fits best for you. You want have new (eventually smarter) ways to work and you don’t need a high customizable DE? Try GNOME Shell or Unity. You want the possibility to configure everything at your DE? Try KDE! You want a high customizable DE with lower consumption of RAM? Try Xfce.
Have a nice day 🙂

bookmark_borderThe pain of an Realtek (RTL8111/RTL8168) ethernet card

WARNING: This post is really old and it happens that it doesn’t work with newer Kernels ( >= 4.0). You should check out my new article if you want to install the driver for your RTL8111/RTL8168. You can check out the new article here: Click me (updated guide).
The most of the Realtek ethernet cards are working out of the box on a Linux machine. But some of them, for e. g. the RTL8111/RTL8168, making some troubles.
In the last three Ubuntu Versions (11.10, 11.04 and 10.10) and the latest Debian testing, you will have the problem, that the noticed ethernet card above will only work with round about 200kb/s and after a while the whole network connection will break down for more than a minute and than you will be back with your 200kb/s again.
So, this is really annoying and it’s nearly impossible to work with your machine. To solve this problem you have to use the official Realtek (r8168) driver instead of the r8169 driver, which is included in the Linux Kernel.
This tutorial will show you in a few steps, how you can build the official Realtek driver for the RTL8111/RTL8168 ethernet card for Ubuntu or Debian:
1. Get root privileges
Get root privileges, while typing „su“ or (when you use Ubuntu) „sudo -s“ in a terminal.
2. Get the requirements
To build and install the driver, we need the kernel headers and the build tools like gcc. To get them, just easily type in a terminal:

apt-get install build-essential

3. Get the driver
Now, go to the official download page from Realtek for the Linux/UNIX Driver for the RTL8111/RTL8168 ethernet card and download the latest driver version.
Link: Realtek Download Page
4. Untar the archive
The driver is compressed to an archive. So uncompress it with the following command:

tar xfvj r8168-8.025.00.tar.bz2

NOTE: Please do not forget to replace the „r8168-8.025.00.tar.bz2“ with the driver version which you have downloaded!
5. Blacklist old driver
We have to blacklist the old driver (r8169) to prevent the system to load it. To do this, easily set a new entry in „/etc/modprobe.d/blacklist.conf“ which is called:

blacklist r8169

or just enter in the terminal again

echo „blacklist r8169“ >> /etc/modprobe.d/blacklist.conf

to do this in only one command.
6. Build and install the new driver
Now, the whole requirements to install the new driver are done. Let us now change in the driver directory, which we have uncompressed in a few steps before:

cd r8168-8.025.00

NOTE: Again, please do not forget, to change „r8168-8.025.00“ to the version which you have downloaded.
The only think we have to do now is, to build the driver and install it. To build it, just type:

make clean modules

after a few secondes (depending on your CPU), the driver is build and you can install it with:

make install

7. Welcome r8168
One of our last steps is, to let the system know about the r8168 driver. With the command

depmod -a

you rebuild the kernel module dependencies and with an

insmod ./src/r8168.ko

you insert the new kernel module (the driver) into the kernel.
8. Make it available for boot
To always use the new module, you have to make a new initrd boot file. Just do

mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`

in a terminal. Here we make the initrd file with the help of the „uname -r“ command, which allows us to get the version of the actually running kernel.
At least, you have to add in the „/etc/modules“ file a new entry, which is called „r8168“, to get the driver automatically loaded after boot. As an alternative you can do the last step again with only one command:

echo „r8168“ >> /etc/modules

That’s it! After a reboot you should have the best possible performance with the RTL8111/RTL8168 and additionally no other network problems should be available anymore (no break down).
After the reboot you can check if the right driver is loaded with this command:

lspci -v

with this command you should find your RTL8111/RTL8168 network card in a list and the additional command „Kernel driver in use: r8168“.