Steam for Linux

Steam for Linux

Boo Seta 20 fev. 2014 às 15:36
Play with any USB controller on Linux using xboxdrv to emulate a XBOX controller
EDIT: This tutorial works for games you play from Steam Client and for games you play outside of the Steam Client. If you're willing to play only Steam Games, try this Steam Big Picture tutorial first. If it doesn't work, then xboxdrv is guaranteed to put your controller to work.

---------------------------------------

Some games are meant to be played using a XBOX controller by default. If you have one, excelent, but if you don't, some controllers won't work 100% out of the box. For example, there are games where a PS2 controller + USB adapter will missplace some buttons: A is where Y should be, X is where A should be etc. You can correct this by remapping all your buttons/axis to the right place. On Windows you would use a program called x360ce and on Linux you'll use xboxdrv. I'll explaing how to set xboxdrv for your USB controller on Linux.


1. Installing xboxdrv

If your distro already has xboxdrv packed, install it from the repositories. If it doesn't, download the source code from their website (http://pingus.seul.org/~grumbel/xboxdrv/) and compile it. Since this step is distro specific, I won't cover it. If you're not sure how to do it, ask for help in your distro's forum.


2. Avoiding xpad conflict

Check if your distro loads xpad module to handle XBOX controller events:

# lsmod | grep xpad

If it returns a blank line, you're fine, go straight to the next section. If it returns something else, you must unload xpad module before loading xboxdrv by executing this command:

# rmmod xpad


3. Finding the proper input event

List all your available input events:

# ls /dev/input/ | grep event*

It will probably range from event0 to event20. You'll have to test each one of them until you find out which one is the event associated with your USB controller. To do so, enter the following command and press your controller buttons (press CTRL+C to exit after checking):

# evtest /dev/input/event11

If you got the wrong event, nothing will happen when you press buttons. When you get the right event, you'll notice because as soon as you press a button there will be a corresponding terminal output. Keep testing your available events until you find out which one is correct. In my case, /dev/input/event11 is associated with my PS2 controller.


4. Mapping your USB controller

If you have a PS3 controller, you can skip this section and go stragth to section 5. If you have any other controller, you must map it. To do so, while using evtest with the event associated to your controller (for example, # evtest /dev/input/event11), each time you press a button you'll receive a terminal output like this:

Event: time 1380985017.964843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1380985017.964843, type 1 (EV_KEY), code 290 (BTN_THUMB2), value 1


In this case, I pressed the button corresponding to where the A button is on the XBOX controller, and this button is mapped as BTN_THUMB2. Then I pressed the button corresponding to where the B button is on the XBOX controller, and the output was this:

Event: time 1380985018.460841, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1380985018.460841, type 1 (EV_KEY), code 289 (BTN_THUMB), value 1


This output tells me that this button is mapped with the name BTN_THUMB. Take note of all these names. Do this for all your buttons and all your axis. You must take note of their names to be able to map them properly later. In the end, you'll have a list with all names and the corresponding XBOX buttons. You must map these buttons to valid XBOX buttons symbols:

Buttons: A, B, X, Y, RB (frontal upper right), RT (posterior upper right), LB (frontal upper left), LT (posterior upper left), START, BACK

Directionals: DPAD_X (horizontal D-pad), DPAD_Y (vertical D-pad), X1 (left analog horizontal), Y1 (left analog vertical), X2 (right analog horizontal), Y2 (right analog vertical)

Analog clicks: TL (left analog click), TR (right analog click)

I made an image to illustrate these valid XBOX buttons symbols[lh4.googleusercontent.com] you'll use to map your controller events. For a PS2 + USB adapter, this is how the final mapping list will look:

BTN_THUMB2=a
BTN_THUMB=b
BTN_BASE3=back
BTN_BASE4=start
BTN_BASE=lb
BTN_BASE2=rb
BTN_TOP2=lt
BTN_PINKIE=rt
BTN_BASE5=tl
BTN_BASE6=tr
ABS_X=x1
BTN_TOP=x
BTN_TRIGGER=y
ABS_Y=y1
ABS_RZ=x2
ABS_Z=y2
ABS_HAT0X=dpad_x
ABS_HAT0Y=dpad_y
-Y1=Y1
-Y2=Y2

Note that if you have a PS2 controller too, you won't have to map all your buttons again, since I already did this (just copy this list for further use). To see what each XBOX button is named after, you can use the built in xboxsrv help to see the valid names:

$ xboxsrv --help-button
$ xboxsrv --help-axis
$ xboxsrv --help-abs



5. Initializing xboxdrv

If you have a PS3 controller, you don't have to map your controller nor nothing. Just initialize xboxdrv like this and everything will be working:

# xboxdrv --silent --detach-kernel-driver

If you have any other controller, now that you have all your buttons and axis mapped, you must initialize xboxdrv properly. To do so, you'll have to initialize it like this:

# xboxdrv --evdev [EVENT] --evdev-absmap [ABS MAP] --axismap [AXIS MAP] --evdev-keymap [BUTTONS MAP] --mimic-xpad --silent &

[EVENT] is the event associated with your controller (section 3 of this post) and [ABS MAP], [AXIS MAP] and [BUTTONS MAP] are your controller mapping (section 4 of this post). In my case, my PS2 controller + USB adapter is associated with /dev/input/event11 and has the above mapping, so I initialize xboxdrv like this:

# xboxdrv --evdev /dev/input/event11 --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --axismap -Y1=Y1,-Y2=Y2 --evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lb,BTN_BASE2=rb,BTN_TOP2=lt,BTN_PINKIE=rt,BTN_BASE5=tl,BTN_BASE6=tr --mimic-xpad --silent &

Note that if you have a PS2 controller too, you will initialize xboxdrv exactly the same way I do, except for the event, which might be another one.


6. Initializing xboxdrv during system startup

Everytime you restart your computer, you must unload xpad module (section 2) if it's loaded in your distro and properly initialize xboxdrv (section 5). To do these things automatically, you can put them on /etc/rc.local or whatever your distro calls it. It's distro specific, so go to your distro's forum and ask them where is your /etc/rc.local if you can't find it. In my case, I use OpenSUSE 13.1 and this file is located at /etc/rc.d/boot.local


7. Final words

I hope this helps you. With these steps I was able to set my USB controller to be remaped and emulated as a XBOX controller. I would appreciate if some moderator fixed this topic, so other users could easily find it.
Última alteração por Boo Seta; 28 abr. 2014 às 8:10
< >
A mostrar 76-90 de 90 comentários
synrgy87 22 mai. 2019 às 7:02 
Originalmente postado por jayagore:
I'm using a Sony brand PS3 controller so I skipped remapping and I am running linux mint. everything is working except for the dpad and L2/R2. L3/R3 seem to be flipped but that is no big deal to me. When I did event testing event18 seemed to be the one that was working but I couldn't tell what was changing when I was hitting buttons because I was getting a continuous line of code to fast to read like the controller was communicating even when nothing was pressed. Anyone have any experience to share regarding getting those triggers up and running? Thanks.

The Arch linux wiki has some good information on getting PS3 pads to work (and PS4 and many others) a lot of the information should also work on other Linux Distros. If you have a look at

https://wiki.archlinux.org/index.php/Gamepad#PlayStation_3/4_controller

and also scroll down it covers using xboxdrv via bluetooth / usb wired.

Hope that helps.

I'd recommend an xbox controller either xbox one or 360 just for ease and working out of the box.


jayagore 23 mai. 2019 às 5:35 
Originalmente postado por synrgy87:
Originalmente postado por jayagore:
I'm using a Sony brand PS3 controller so I skipped remapping and I am running linux mint. everything is working except for the dpad and L2/R2. L3/R3 seem to be flipped but that is no big deal to me. When I did event testing event18 seemed to be the one that was working but I couldn't tell what was changing when I was hitting buttons because I was getting a continuous line of code to fast to read like the controller was communicating even when nothing was pressed. Anyone have any experience to share regarding getting those triggers up and running? Thanks.

The Arch linux wiki has some good information on getting PS3 pads to work (and PS4 and many others) a lot of the information should also work on other Linux Distros. If you have a look at

https://wiki.archlinux.org/index.php/Gamepad#PlayStation_3/4_controller

and also scroll down it covers using xboxdrv via bluetooth / usb wired.

Hope that helps.

I'd recommend an xbox controller either xbox one or 360 just for ease and working out of the box.
Thanks for the tip. I think I actually have a 360 controller somewhere, I'll dig it out and give that a shot. IDK why I didn't think of that.
jayagore 23 mai. 2019 às 5:48 
Originalmente postado por synrgy87:
Originalmente postado por jayagore:
I'm using a Sony brand PS3 controller so I skipped remapping and I am running linux mint. everything is working except for the dpad and L2/R2. L3/R3 seem to be flipped but that is no big deal to me. When I did event testing event18 seemed to be the one that was working but I couldn't tell what was changing when I was hitting buttons because I was getting a continuous line of code to fast to read like the controller was communicating even when nothing was pressed. Anyone have any experience to share regarding getting those triggers up and running? Thanks.

The Arch linux wiki has some good information on getting PS3 pads to work (and PS4 and many others) a lot of the information should also work on other Linux Distros. If you have a look at

https://wiki.archlinux.org/index.php/Gamepad#PlayStation_3/4_controller

and also scroll down it covers using xboxdrv via bluetooth / usb wired.

Hope that helps.

I'd recommend an xbox controller either xbox one or 360 just for ease and working out of the box.
ok so now i've got a generic 360 controller out. it also seems to work with event18 in testing.
however, "sudo xboxdrv --silent --detach-kernel-driver" returns:
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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.


-- [ ERROR ] ------------------------------------------------------
No Xbox or Xbox360 controller found

so I tried command: "sudo xboxdrv --evdev event18 --mimic-xpad --silent --detach-kernel-driver"
which returns:
-- [ ERROR ] ------------------------------------------------------
event18: No such file or directory

maybe I have some syntax wrong?
synrgy87 23 mai. 2019 às 7:33 
Originalmente postado por jayagore:
-- [ ERROR ] ------------------------------------------------------
No Xbox or Xbox360 controller found

so I tried command: "sudo xboxdrv --evdev event18 --mimic-xpad --silent --detach-kernel-driver"
which returns:
-- [ ERROR ] ------------------------------------------------------
event18: No such file or directory

maybe I have some syntax wrong?


should be:
sudo xboxdrv --evdev /dev/input/event18 --mimic-xpad --silent --detach-kernel-driver

With a generic controller you might have to map the buttons and sticks individually wither by adding them to the command line or putting it in a config file.
Omega 23 mai. 2019 às 11:13 
This thread is 5 years old now guys.

With kernel 4.15+ (or 4.12+ I forgot) most common controllers now work out-of-the-box. You can connect a PS3/PS4 controller to your PC via cable and it will just work. To connect it via buetooth open your Bluetooth manager and connect the controller, it will prompt you asking if you want to pair the device.

Arch users, make sure you have bluez-plugins installed. Or the controller will not pair.
Última alteração por Omega; 23 mai. 2019 às 11:27
synrgy87 23 mai. 2019 às 14:32 
Originalmente postado por Omega:
This thread is 5 years old now guys.

With kernel 4.15+ (or 4.12+ I forgot) most common controllers now work out-of-the-box. You can connect a PS3/PS4 controller to your PC via cable and it will just work. To connect it via buetooth open your Bluetooth manager and connect the controller, it will prompt you asking if you want to pair the device.

Arch users, make sure you have bluez-plugins installed. Or the controller will not pair.

Not all systems and controller combinations are equal and not all bluetooth is great. especially the combined wifi/bluetooth intel onboard stuff. as per the guy above having trouble with xboxdrv, or on my own main rig PS3 controllers just wont work via bluetooth, generica pads still needing custom configs for proper mapping, It's far from a closed issue regardless of thread age.
24 mai. 2019 às 7:20 
I find this thread important for troubleshooting controllers on linux systems, I hope it doesn't get closed.
jayagore 24 mai. 2019 às 19:17 
Update on my situation. Turns out to use either of my controllers (ps3 and generic 360) with steam I didn't need xboxdrv. I run Linux Mint and all I had to do was plug in the controller, launch steam, push the middle button on the controller and steam boots "big picture mode" go into the settings and select the controller you are using. when you start a game hit the middle button and go into the controller config settings for that particular game and work out sensitivity kinks and button layouts. BAM! it just works. I don't get it and I don't care lol Have fun guys
Boo Seta 25 mai. 2019 às 9:09 
Originalmente postado por jayagore:
Update on my situation. Turns out to use either of my controllers (ps3 and generic 360) with steam I didn't need xboxdrv. I run Linux Mint and all I had to do was plug in the controller, launch steam, push the middle button on the controller and steam boots "big picture mode" go into the settings and select the controller you are using. when you start a game hit the middle button and go into the controller config settings for that particular game and work out sensitivity kinks and button layouts. BAM! it just works. I don't get it and I don't care lol Have fun guys

Yes, there is this other method you mentioned. I wrote a tutorial on it too, as I pointed out as an edit to this topic.
Boo Seta 25 mai. 2019 às 9:10 
Originalmente postado por wiregrind:
I find this thread important for troubleshooting controllers on linux systems, I hope it doesn't get closed.

Thank you. I think it would help if this topic got fixed, so people could find it easier.
engie 1 set. 2019 às 13:55 
Is there a GUI wrapper for xboxdrv? Because doing it all manually in a terminal is a huge chore.
I will need to setup 4 non x-box controller for a local multiplayer game, so don't blame me for being lazy.
engie 1 set. 2019 às 15:19 
BTW you have a typo in

xboxsrv help to see the valid names:

$ xboxsrv --help-button
$ xboxsrv --help-axis
$ xboxsrv --help-abs

it's all "xboxdrv"

Also I'm struggling how to pass more than 1 gamepad as an argument.

I have event 18 and 19 gamapads. For 18 your configuration is working:

# xboxdrv --evdev /dev/input/event11 --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --axismap -Y1=Y1,-Y2=Y2 --evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lb,BTN_BASE2=rb,BTN_TOP2=lt,BTN_PINKIE=rt,BTN_BASE5=tl,BTN_BASE6=tr --mimic-xpad --silent &

but how to execute for event18 and 19 at the same time? Because, again, I have multiple gamepads.
engie 2 set. 2019 às 14:00 
Originalmente postado por Rogue:
@engie This thread is from 2014, so the info may be outdated. Xboxdrv may not be the best choice for your device. If your distro has a Wiki, check that, if not then the Arch Wiki is always a good reference.

https://wiki.archlinux.org/index.php/Gamepad

A reference that doesnt work 100% for me. I have ubuntu mate and for example in
"Multiple controllers" section it says "xboxdrv supports a multitude of controllers, but they need to be set up in /etc/default/xboxdrv". But I dont have xboxdrv file there. And even if I create one it doesnt seem to have any effect. Looks like I have to do more at this point to follow step-by-step by manual, maybe define a service or something because I dont have "xboxdrv.service", but I just gave up and launched multiple terminals - each for 1 gamepad.. and it worked!!!!

This thread maybe from 2014, but IMO for some people it will be more useful than that wiki in some ways.
Última alteração por engie; 2 set. 2019 às 14:01
Boo Seta 6 set. 2019 às 6:40 
Originalmente postado por engie:
BTW you have a typo in

xboxsrv help to see the valid names:

$ xboxsrv --help-button
$ xboxsrv --help-axis
$ xboxsrv --help-abs

it's all "xboxdrv"

Also I'm struggling how to pass more than 1 gamepad as an argument.

I have event 18 and 19 gamapads. For 18 your configuration is working:

# xboxdrv --evdev /dev/input/event11 --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --axismap -Y1=Y1,-Y2=Y2 --evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lb,BTN_BASE2=rb,BTN_TOP2=lt,BTN_PINKIE=rt,BTN_BASE5=tl,BTN_BASE6=tr --mimic-xpad --silent &

but how to execute for event18 and 19 at the same time? Because, again, I have multiple gamepads.

Hello engie, are you absolutely sure there is a typo? If yes, I can fix it. Also, try to use steam big picture to setup your controller, it might be much easier if it works for you. I've made a tutorial on this issue too, I hope it helps!
lucasolis4 22 ago. 2023 às 11:27 
Unfortunately although I managed to create the virtual Xbox 360 controller, it is not detected or recognized in Xcloud which is where I needed it.
< >
A mostrar 76-90 de 90 comentários
Por página: 1530 50

Postado a: 20 fev. 2014 às 15:36
Comentários: 90