You are not logged in.

#1 2020-12-30 00:21:04

cathedral_junky
Member
Registered: 2020-12-04
Posts: 17

[Solved] Help automating xboxdrv

I use two different controllers on my set-up, and I'd like to have them set up automatically rather than having to enter a few lines in cli everytime I start up my pc. The controllers in question are a dualshock 4 connected via bluetooth, and an xbox360 arcade stick connected via usb. I ended up running an autostart script in kde to run ds4drv in the background with mimic-xpad so I can just put into pairing mode from the controller and it will auto connect. But with my 360 stick, in order to get it to connect on every restart I need to run

sudo rmmod xpad

and then

sudo xboxdrv

. I'm looking for a way to automate this so as long as my stick is connected it runs it in xboxdrv with my configs in '/etc/default/xboxdrv'. The problem is if I run

sudo xboxdrv

without

rmmod xpad

it says there is already an xpad loaded and I need to remove it to run with xboxdrv, which requires root permissions, and if I try to run xboxdrv as user I get the following:

xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ 
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> 
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. 

Controller:        Hori Real Arcade Pro VX-SA
Vendor/Product:    24c6:5501
USB Path:          001:003
Controller Type:   Xbox360

-- [ ERROR ] ------------------------------------------------------
USBController::USBController(): libusb_open() failed: LIBUSB_ERROR_ACCESS

How can I get this to run either on startup or login or whatever so I don't need to do it manually everytime, or at least how to run them without root permissions so I can put them with my other autostart script. I've tried running

systemctl enable xboxdrv.service

but it doesnt seem to help. Would really appreciate any insight, thanks.

Last edited by cathedral_junky (2020-12-30 04:23:15)

Offline

#2 2020-12-30 00:47:42

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved] Help automating xboxdrv

I use xboxdrv here as well. I blacklist the xpad module with a file in /etc/modprobe.d/:

# /etc/modprobe.d/blacklist-xpad.conf 
blacklist xpad

It will then never load so there's then no need to do "rmmod xpad".

I then took the xboxdrv.service file that comes with the xboxdrv package and copied it into /etc/systemd/system/ and edited it there. It now looks like this:

# /etc/systemd/system/xboxdrv.service
[Unit]
Description=Xbox controller driver daemon
Documentation=man:xboxdrv(1)

[Service]
Type=forking
User=root
PIDFile=/run/xboxdrv.pid
ExecStart=/usr/bin/xboxdrv --daemon --detach --pid-file /run/xboxdrv.pid -c /etc/default/xboxdrv

[Install]
WantedBy=multi-user.target

The changes I made is that I removed some arguments from the xboxdrv on the ExecStart=... line. There was also systemd complaining about the path on the PIDFile=... line, it didn't like the original /var/run path and wanted /run instead.

You have to do "sudo systemctl daemon-reload" after you edit service files. You can run "systemctl cat xboxdrv" to make systemd print what file contents it sees. You can do "systemctl status xboxdrv" to check on your service after you've started it. Starting+enabling is done with "sudo systemctl enable --now xboxdrv".

Offline

#3 2020-12-30 04:22:59

cathedral_junky
Member
Registered: 2020-12-04
Posts: 17

Re: [Solved] Help automating xboxdrv

awesome this was exactly what I needed. It was remapping the buttons strangely for some reason but when I tried setting mimic-xpad to false in /etc/default/xboxdrv it works great, before I had it set to true but I guess for whatever reason maybe it was ignoring my configs, and having it point directly to it in this service makes it actually work. Anyways thanks so much!

Offline

Board footer

Powered by FluxBB