[HowTo] Scripts for using Xbox Controller in RetrOSMC

In order zu use a Xbox 360 Wireless Controller for OSMC, I followed the instructions from “Yggdrasil” until the third point. After a first reboot, everything is fine and the controller can control the system.

When I reboot the Raspyberry Pi 3 a second time, the controller no longer works.
I found out, that after entering the following commands, the controller will work again:

sudo chmod +x /home/osmc/xbmc.ini
sudo chmod +x /home/osmc/buttonswap.ini
sudo chmod +x /home/osmc/start.sh

How is it possible to use the Xbox 360 controller without this input every time?

Hello @sam_nazarko, I’m trying to use the updated xpad driver in OSMC for my xbox360 wireless controller. I tried it in a fresh OSMC installation. The installation process seems to be ok. However, the device doesn’t seem to work as expected (maybe because I’m trying to install the driver with dkms…). Here I submited a issue describing what I did.

I would like to know the way to install it without using dkms. Could you explain it a bit?

I also would like to point that the xpad driver used in Raspbian works like a charm. I really don’t know the version they use (but maybe this info be usefull for you for future kernel updates?)

Thank you very much for this amazing project.

Have you checked that the new module is being loaded?
OSMC uses a 4.14 kernel for RPi presently; I believe that’s the same in Raspbian.

Sam

Well… Current Raspbian Linux kernel version is: 4.14.79-v7+. Now I don’t know why Raspbian have the ‘good’ driver and OSMC doesn’t. I don’t think they had modified it…

Anyway, about installing in OSMC the modified one from the repo… I think the new module is being loaded because of the success on the installation process:

osmc@osmc:~$ sudo dkms install -m xpad -v 0.4

Creating symlink /var/lib/dkms/xpad/0.4/source ->
                 /usr/src/xpad-0.4

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make -j4 KERNELRELEASE=4.14.78-2-osmc KVERSION=4.14.78-2-osmc.....
cleaning build area....

DKMS: build completed.

xpad.ko:
Running module version sanity check.
 - Original module
   - Found /lib/modules/4.14.78-2-osmc/kernel/drivers/input/joystick/xpad.ko
   - Storing in /var/lib/dkms/xpad/original_module/4.14.78-2-osmc/armv7l/
   - Archiving for uninstallation purposes
 - Installation
   - Installing to /lib/modules/4.14.78-2-osmc/extra/

depmod....

DKMS: install completed.

Also, before I did the installation the modinfo xpad output was:

osmc@osmc:~$ modinfo xpad
filename:       /lib/modules/4.14.78-2-osmc/kernel/drivers/input/joystick/xpad.ko
license:        GPL
description:    X-Box pad driver
author:         Marko Friedemann <mfr@bmx-chemnitz.de>
srcversion:     208FBFF8971F23AE65A5184
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc5Dip81in*
. . . 

and after the installation it is:

osmc@osmc:~$ modinfo xpad
filename:       /lib/modules/4.14.78-2-osmc/extra/xpad.ko
license:        GPL
description:    X-Box pad driver
author:         Marko Friedemann <mfr@bmx-chemnitz.de>
srcversion:     D782DEDAD34C84170AE268F
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc47ipD0in*
alias:          usb:v24C6p*d*dc*dsc*dp*icFFisc5Dip81in*
...

The filename has changed. I don’t know a better way to check it, could be better another one?

Are you saying that you don’t need to compile the module for Raspbian? If so – there may be some userland changes or udev rules that are facilitating the improved behaviour

Yep. I didn’t need to perform any driver compilation/installation. I just installed Raspbian in my SD card to test the same way I did in OSMC and my surprise was it worked without doing anything.

With my researches I can conclude that the driver in OSMC is the same that in Raspbian BUT when I connect the gamepad in OSMC, the folders:

 /sys/class/leds/xpad0/
 /sys/class/leds/xpad1/
...

used to control the gamepad leds aren’t created. So the gamepad leds can’t be changed and they are blinking by default.

Any clue about what is going on @sam_nazarko ?

There’s probably a CONFIG_ option that’s needed to support this.

Sam

Indeed, that was the thing :smiley: :smiley: :smiley:.

I got it working by compiling/installing the xpad driver but editing xpad/xpad.c at master · paroj/xpad · GitHub file by adding in it after the first #includes block:

#define CONFIG_JOYSTICK_XPAD_LEDS 1

Anyway, I think there would be another proper way of doing this (rather than editing the source code…). But I don’t know how this driver stuff work.

Why does it work by default in Raspbian distribution and in OSMC it doesn’t? Any fix should be added in a future OSMC version?

I don’t know – probably something to take up with the maintainer of that module

Sam