Implementing xpadneo drivers for future releases ?

  • Hello Folks

    First of all: xpadneo is the device driver for the Xbox One S Gamepad (with Bluetooth builtin) (But only for bluetooth connection - on USB connection directly xpad driver is still needed).

    Now while Kodi / Libreelec supporting retro Gaming and the Xbox One Gamepads has a wide range of users - I think it would be REALLY great to get the bluetooth connection also working :)

    Source code: xpadneo Linux Drivers

    I am also available for pretesting and debugging (got one Xbox One S Gamepad) - But I only need prebuild images for testing

    On current LE 9.0 (fresh setup):

    Xbox One S Gamepad working only with USB connection

    on Bluetooth: Gamepad connects over internal Rpi3 BT chip and also stays connected but Kodi / LE doesnt get any keypresses

    On "btmon" keypresses will be recognized

    On RetroPie (same Rpi3 hardware) the Gamepad works already without any issues over bluetooth - So I think its only about to implement xpadneo drivers :)

    Have a nice day!

    EDIT: Experienced in Linux - but I am not on developer side of things (no help needed on debugging / pretest purposes) ;)

  • Hello guys,
    First at all, I love LibreELEC, best mmc ever, thank you very much!
    I tried to reply back soon but looked some issue on registration so I'm not sure if xpadneo support was already addressed.

    If not, I wrote this recipe to get it working.

    At your PC

    As root install compilation tools needed

    apt install gcc make git unzip wget xz-utils wget bash bc gcc sed patch patchutils tar bzip2 gzip perl gawk gperf zip unzip diffutils lzop libc6-dev libncurses5-dev libjson-perl

    Clone repo

    git clone https://github.com/LibreELEC/LibreELEC.tv.git

    cd LibreELEC.tv/

    Create a new package

    mkdir packages/linux-drivers/xpadneo

    vi packages/linux-drivers/xpadneo/package.mk

    Build package
    PROJECT=RPi DEVICE=RPi2 ARCH=arm scripts/build xpadneo

    If all goes well, new module should be there, you need to match running image with kernel version.

    /sbin/modinfo build.LibreELEC-RPi2.arm-9.1-devel/xpadneo-master/hid-xpadneo/src/hid-xpadneo.ko

    Quote from modinfo output

    ...

    vermagic: 5.0.13 SMP mod_unload ARMv7 p2v8

    ...

    #0507, 07-May-2019: RPi / RPi2 -- Release post (New 5.0.13 kernel; drop omxplayer)

    Copy module

    scp build.LibreELEC-RPi2.arm-9.1-devel/xpadneo-master/hid-xpadneo/src/hid-xpadneo.ko root@PI:/storage/.config/

    At your MMC

    Disable conflicting bt options

    vi /storage/.config/modprobe.d/xpadneo.conf

    Code
    options bluetooth disable_ertm=y

    Nasty hardcore to make it "permanent"

    vi /storage/.config/autostart.sh

    Code
    (
    cp -v /storage/.config/hid-xpadneo.ko /lib/modules/5.0.13/kernel/drivers/hid/
    depmod
    ) &

    chmod 755 /storage/.config/autostart.sh

    Add udev rule

    vi /storage/.config/udev.rules.d/99-xpadneo.rules

    Code
    ACTION=="bind", KERNEL=="0005:045E:02FD.*|0005:045E:02E0.*", SUBSYSTEM=="hid", DRIVER=="microsoft", \
    RUN+="/bin/sh -c 'echo $kernel > /sys/bus/hid/drivers/microsoft/unbind; echo $kernel > /sys/bus/hid/drivers/xpadneo/bind'"

    Reboot to confirm that all works as expected and that should be all.
    Keep press X button few seconds until it starts to blink and try pair it, probably you will need to remap keys, so keep a keyboard close.

    Hope you find it useful.
    Andres.-

    Edited once, last by basilean: UPDATE: I follow it today step by step and needed to comment this line: # PKG_SHA256="6626c55eeb13a0608a68209f7da29efb11a841aa443bab4d4bef5db8dc04d33d" To avoid an endless loop, naturally package changed and validation fails. Instead to update with new hash I left it out with idea to make recipe time proof (for now). Having a decent machine, downloading and compilation will take more than an hour, so be patient. (August 4, 2019 at 1:26 AM).

  • Hey, sorry for late answer - but i forgot this topic :/

    Thanks for your work - really appreciate it :)

    But I cant test it right now (much network thinks to do...) - But I will test it for sure and then I will post it here

  • Hey man, I repeated process today, I just needed to comment SHA256 line and it worked like a champ. Original post updated.

    Forgot to tell you, also remember to update autostart.sh to new kernel modules location, IE:

    cat /storage/.config/autostart.sh

    (

    cp -v /storage/.config/hid-xpadneo.ko /lib/modules/5.2.0/kernel/drivers/hid/

    depmod

    ) &

    Edited once, last by basilean (August 4, 2019 at 1:43 AM).

  • Hi,

    could anyone provide the driver package vor libreelec 9 and a short howto to implement it manually?

    sadly i cant get it to run with the manual provided by basilean, since i have no linux on hand to prepare the package

    EDIT: basilean: i spent about 5h to figure it out somehow now.

    but beeing on 9.2, the kernel on RPi4 is 4.19.76.

    how do i change this in the module AFTER building it?

    Edited once, last by Speadge (November 13, 2019 at 12:32 AM).

  • Hi, basilean, your workaround worked perfectly to me!

    Thank you, very much!

    I just made a little change on the autostart.sh file:

    Code
    (
    cp -v /storage/.config/hid-xpadneo.ko /lib/modules/$(uname -r)/kernel/drivers/hid/
    depmod
    ) &

    This way, the driver is automatically copied to the right kernel version.

  • Hi guys,

    I need your help - coming from the "Windows world", I'm a Linux NOOB, so please have mercy with me :)

    Using a RaspberryPi with "Buster" as my Linux platform, I've followed exactly the step-by-step instructions in post #4 , but unfortunately, after having entered "PROJECT=RPi DEVICE=RPi2 ARCH=arm scripts/build xpadneo" for building the package, I waited until the prompt appeared in the end again, however, I didn't get a file named "hid-xpadneo.ko" .

    I can see that the last text in the terminal program says the following:

    "NOTE: if in doubt, on Unix-ish system use './config'.

    FAILURE: scripts/build openssl:host during configure_host (package.mk)

    **************** FAILED COMMAND ******************

    ./Configure $PKG_CONFIGURE_OPTS_HOST $PKG_CONFIGURE_OPTS_SHARED linux-${MACHINE_HARDWARE_NAME} $CFLAGS $LDFLAGS

    ************************************************************

    **************** FAILED COMMAND ******************

    ${SCRIPTS}/build "${p}" "${PARENT_PKG}"

    ************************************************************

    **************** FAILED COMMAND ******************

    ${SCRIPTS}/build "${p}" "${PARENT_PKG}"

    ************************************************************

    **************** FAILED COMMAND ******************

    ${SCRIPTS}/build "${p}" "${PARENT_PKG}"

    ************************************************************

    **************** FAILED COMMAND ******************

    ${SCRIPTS}/build "${p}" "${PARENT_PKG}"

    ************************************************************"

    I apologize that I don't know how I can produce a log file giving more informations what went wrong ...

    I'm totally clueless how to solve these problems. Could you please help me?

    I'm thankful for any hint!

  • working (only build tested) package.mk for current LE master