Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I use a bluetooth gaming controller to play games in kubuntu 12.04?

Specifically, I want to play with a wii controller, but also have access to ps3 and xb360 conrollers. I installed wmgui, lswm, and wminput. They each seem to do what they are supposed to, but I just want to be able to play mednafen and kobo. Kubuntu won't let me use it as a joystick and says something like the nintendo controller not being in /dev/ or something like that.

I am fairly new to linux and don't feel very comfortable changing system settings from the command line. Yeah i can do it, but if things don't work out I have to remember what to change back, how to change it back and what to change it back to. I have had to reinstall my linux before because of botched settings messing up system stability and I don't want to keep making that mistake.

Is there a utility that would let me connect, configure and use bluetooth controller(s)? I know that most people think that gaming on linux is stupid, but I feel stupid trying to play mednafen with my keyboard. An all in one program to use the three main types of conrollers on the market now (wii, ps3, xb360) would be very helpful for gamers using linux and would certainly help more people see linux gaming as a good idea. Does such a program exist yet?

Edit below added 1/25/2013

@Grumbel - Thank you for your quick reply. Your advice was very helpful.

This is what I did to get the wii controller working:

1- Connect bluetooth radio to computer.
2- Use the package manager to find and install "wminput" and "wmgui"
3- Restart for good measure (not sure if it is necessary or not)
4- Confirm that Wii remote works properly by using wmgui.
5- Copy "/etc/cwiid/wminput/buttons" to "/home/[username]/Documents"
6- Changed the copied buttons file to suit my needs (detailed below)
7- Open a terminal
8- run "sudo wminput -c /home/[username]/Documents/buttons"
9- Play Kobo for a while (tweak settings in buttons file)
10- Start Mednafen
11- Configure button mappings in Mednafen with ALT+SHIFT+[number]
12- Play Mednafen, have fun

To stop wminput, hold the power button on the wii remote. Then you can mess around with the different button settings in the config file. Save the configuration and restart wminput with the same command as before.

Here is what is in my buttons file:

=======================================================
#custom buttons

Plugin.led.Led1 = 1
Plugin.led.Led4 = 1

Wiimote.A = BTN_LEFT
Wiimote.B = BTN_RIGHT
Wiimote.Up = KEY_LEFT
Wiimote.Down = KEY_RIGHT
Wiimote.Left = KEY_DOWN
Wiimote.Right = KEY_UP
Wiimote.Minus = KEY_BACKSPACE
Wiimote.Plus = KEY_ENTER
Wiimote.Home = KEY_TAB
Wiimote.1 = KEY_RIGHTSHIFT
Wiimote.2 = KEY_RIGHTCTRL

Nunchuk.C = KEY_LEFTSHIFT
Nunchuk.Z = KEY_LEFTCTRL

Classic.Up = KEY_UP
Classic.Down = KEY_DOWN
Classic.Left = KEY_LEFT
Classic.Right = KEY_RIGHT
Classic.Minus = KEY_BACKSPACE
Classic.Plus = KEY_ENTER
Classic.Home = KEY_TAB
Classic.A = BTN_LEFT
Classic.B = BTN_RIGHT
Classic.X = KEY_X
Classic.Y = KEY_Y
Classic.ZL = BTN_LEFT
Classic.ZR = BTN_RIGHT
Classic.L = KEY_L
Classic.R = KEY_R

=======================================================

I have the remote turn on led numbers one and four so I know the remote is on and connected to my computer, as opposed to connected to the wii. I am sure there are better ways to configure it, but so far this one works for me. I have not tested the nunchuck or classic controller, but I do suspect that they will work as they should.

I was also thinking of using wminput like this:

"sudo wminput -d -c /home/[username]/Documents/buttons"

so that it will automatically connect whenever the 1 and 2 buttons are pressed on the wii remote. Is there a way to issue this command automatically at startup?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

For Wiimote wmgui, wminput and friends are the right way to go. First thing to do would be to use wmgui and try to connect the controller, if it works and all buttons respond, then you can move on to wminput and try to map them to a joystick. wminput already comes with a bunch of example configs, they can be used like:

$ wminput -c /etc/cwiid/wminput/gamepad

or

$ wminput -c gamepad

When you don't give the full patch, wminput will look for configs in ~/.cwiid/wminput/gamepad, so that's where you should store your custom configs.

The manpage of wminput:

$ man wminput

Contains further information.

For the PS3 controller you will need:

The Xbox360 controller are not Blutooth, but Microsofts own protocol, so you will need the Microsoft Wireless Receiver USB dongle first. After that they work out of the box with a standard kernel. You can however get some more configuration with:

And generally speaking, if you want to make sure that your joystick is setup correctly in Linux you want to play around with evtest and jstest (they are in the evtest and joystick package). They can be used like:

$ evtest /dev/input/event0

and

$ jstest /dev/input/js0

Use different numbers for different devices. The js stuff is only joysticks, so there normally should only be js0, but the event interface contains everything on your computer that will send input events, keyboards, mouse, etc. so there are lots of different event devices and you have to just try them all to find your joystick, it will generally be the last one if plugged in last.

share|improve this answer
    
Thank you for the quick reply. Your advice was very helpful. –  starrysky Jan 26 '13 at 1:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.