Gamepad xbox one on linux

Gamepad xbox one on linux

A subreddit for discussions and news about gaming on the GNU/Linux family of operating systems (including the Steam Deck).

I spent the past 2 days trying to make an xbox controller to work on linux and finally managed to make it work, here is what I did.

So I recently bought an xbox controller since I saw that they were mostly plug&play on linux, I couldn’t find any originals or were way too expensive just to play some games on pc ( I do not own an xbox). I got a generic one from powerA. When I got it, I plugged it and to my surprise it was not recognized. So I researched about it and finally made it work.

First I want to give a way to know if my problem is your problem too.
Go to your terminal and type lsusb , you should get a list of all devices connected via usb and your controller should appear there, in my case it said:

Bus 002 Device 007: ID 20d6:2001 BDA Xbox Series X En Wired Controller Black Inline

Take note of the fabricator (in my case it’s 20d6) and the model (in my case it’s 2001).
Then you need to know if a driver it’s being loaded at all. Type lsusb -t and look for the driver, in my case no driver was loaded:

/: Bus 02.Port 1: Dev 1, Driver=xhci_hcd/12p, 480M |__ Port 7: Dev 7, If 0, Specific Class, Driver=, 12M

Note that the output from the command lsusb said that my controller was on bus 002 device 007, so it must match it.

Make sure you load xpad module and repeat the command, if the driver still doesn’t appear then you are pretty much where I was.

So what’s the problem?
xpad says that it should work with any generic xbox controller, but turns out my controller is not a normal xbox controller, it is an xboxOne controller and needs a startup signal to be sent to it to activate. I looked at the code of xpad and the generic controller doesn’t send this signal so you can never use it unless it’s detected as an xbox controller. Fortunately it’s quite an easy task to do it without any code knowledge.

You need to change the code of xpad so it knows that your controller is an xboxOne controller and sends the signal, then build the module and load it instead of the default xpad module that comes with your linux kernel.

You need git to get the code of xpad, so if you don’t have it you need to install it with the package manager of your OS.

Читайте также:  How to install vmware tools on kali linux

sudo git clone https://github.com/paroj/xpad.git /usr/src/xpad-0.4
This command clones the project directly into /usr/src/xpad-0.4/, always check what you are copying before doing it, right now this is the trusted repo, but it may change.

Then you need to open the xpad.c file with your favorite editor so you can modify it, you can use nano or vi since they tend to be already on most OS.

sudo vi /usr/src/xpad-0.4/xpad.c

There are a lot of lines like this one, pick one that looks alike and you are going to modify it to fit your controller, so in my case it would be
< 0x20d6, 0x2001, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOXONE >,

the 20d6 is the fabricator and 2001 is the model of your controller. then you can put any name for your controller, the 0 is for the dpad to work as a controller, if the controller you are trying to use is a dance pad you need to change it to MAP_DPAD_TO_BUTTONS , but mostly 0 should work.

Then you need to look if the fabricator is in the xpad table, so search for a line like this one

XPAD_XBOX360_VENDOR(0x20d6), /* PowerA Controllers */ XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */

In my case the fabricator is in the list, if yours is not, modify one of them by replacing with your fabricator value, if its an xboxone controller you should only need it on the xboxone_vendor, but nothing will break if you put it on both.

Once you done that, you already did what we wanted to do, get xpad to recognize your controller as an xboxone controller.

Save and Quit the document (remember to be in sudo to modify the file).

Make sure you have dkms installed (if not, install it with your package manager)

type the next commands:
sudo dkms remove -m xpad -v 0.4 —all
This removes all modules that you have already installed of xpad.
sudo dkms install -m xpad -v 0.4
Then you load the module that you just modified. dkms searches /usr/src for a match for xpad and does all the work for you.
So now you have your custom xpad ready to load.
Unload the previous xpad that is running
rmmod xpad (depending on your user permissions you may need to do this as sudo)
and load xpad again to use your custom module
modprobe xpad (depending on your user permissions you may need to do this as sudo)

Test your gamepad, mine turned on the leds as soon as I loaded the custom module and I was able to play with it.

I hope this was of help as I couldn’t find any guide at all that could help me figure out why my controller wasn’t working. The biggest issue I had was figuring out that I had an xboxone controller as there was no where on the controller box saying that, and the vendor advertised it as an xbox360 controller, so I figured out from testing.

Читайте также:  Как выйти из watch linux

There are many unresolved issues relating to controllers not working with xpad, and there are way too many different controllers for the devs to help out, hopefully this guide can help someone to resolve their issue or figure out how to do it from what I did.

Источник

How to Set Up an Xbox One Controller in Ubuntu

For a while now the Linux kernel has supported the Microsoft Xbox One controller officially. That being said, support isn’t the greatest. For starters there are some tweaks that could be done as well as the ability for multiple controller support and more. In this article we’ll show you how to set up an Xbox One controller in Ubuntu.

To be more specific we’ll go over how to use the alternative driver, the SteamOS patched driver, configuring the controller with specific tools, tweaking it, etc. If you’re a Linux gamer and the Xbox One controller is your go-to, you may want to keep on reading! Let’s get started!

Using Xbox DRV

xbox-one-xbox-drv

If you want to get the XboxDRV driver installed on Ubuntu, open up a terminal and enter the following command:

sudo apt-get install xboxdrv

Once the driver is installed, everything should be mostly set up. No need to blacklist anything, as everything should work out of the box. However, in order for XboxDRV to work effectively, some systemd services will need to be enabled.

Start off by enabling the service. This will make sure that XboxDRV will work every time you boot right out of the gate.

sudo systemctl enable xboxdrv.service

Now that it’s enabled, you can start the service so that you can use the driver right away.

sudo systemctl start xboxdrv.service

After all of this is done, XboxDRV should be operational.

Multiple controllers with Xbox DRV

Remember earlier when we said that the XboxDRV driver is better in some ways? This is the main draw to this driver. The default driver, though impressive, doesn’t have solid multi-controller support. We can’t confirm that it’s not possible; however, with XboxDRV this is confirmed to work.

Here’s how to set it up. Start out in a terminal and enter the following:

sudo nano /etc/default/xboxdrv/

This is the default configuration file. If you’re looking to add multi-controller support, you’ll need to add the following code to this file. Paste it under “silent = true” in the file. Here’s the code:

[xboxdrv] silent = true next-controller = true next-controller = true next-controller = true

After the code has been added, press “Ctrl + O” to save the file, and then restart the driver:

sudo systemctl restart xboxdrv.service

After that you should be able to use multiple controllers.

Читайте также:  Добавить системную переменную linux

Using the SteamOS patched driver

xbox-one-steam-os

If you’re interested in sticking with the Xpad driver, you might be interested in Valve’s modified driver. It’s fixed up and specialized for SteamOS and Valve’s steambox consoles. All you’ll need to get it going is to add a PPA to your system. During the installation the current driver should be taken out, so no worries.

Start off by adding the PPA:

sudo add-apt-repository ppa:mdeslaur/steamos

Once the PPA is on your system, you’ll need to update your system’s software sources.

After that, install the driver (along with the kernel headers if you don’t have them already):

sudo apt-get install steamos-xpad-dkms linux-headers-generic

After the driver is installed, simply reboot your machine. From here, you’ll be using the Valve-modified controller driver with your Xbox One controller.

Get more out of your controller with AntiMicro and JSTest

xbox-one-jstest

Drivers are one thing, and they certainly can make your Xbox One controller better on Ubuntu, but ultimately, if you want some solid configuration, you’ll need to check out some programs – two programs to be exact, the first one being JStest. It’s a simple and useful tool that you can use to calibrate your controllers’ axis.

sudo apt-get install jstest-gtk

The second program is Antmicro. If you’ve ever used Windows before, you might be familiar with a program called Xpadder. What it does is allow you to map keyboard and mouse functions directly to any controller plugged in.

This is what Antimicro does. When your Xbox One controller is detected on the system, you’ll easily be able to map keys and mouse gestures to the controller. This sort of thing is perfect if you’re playing a game that does not have gamepad support.

sudo add-apt-repository ppa:ryochan7/antimicro sudo apt-get update sudo apt-get install antimicro

Conclusion

Though we are Linux gamers, we have to admit one thing: Microsoft knows how to make a controller. Out of all the controllers out there, the Xbox gamepad manages to be the most comfortable – and it seems that the gaming community at large agrees with this fact. Both the 360 and the One controller are among some of the most supported gamepads on all of the major PC platforms.

Hopefully, with the help of this article, you’ll be able to get more out of the Xbox One controller on Ubuntu.

What’s your preferred gaming controller to use on Ubuntu? Let us know below!

Derrik Diener is a freelance technology blogger.

Our latest tutorials delivered straight to your inbox

Источник

Оцените статью
Adblock
detector