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) ;)

  • Thank you for this guide :)


    But I am not really sure which files I need to successfully implement it and didnt know the correct location :/

  • 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 [email protected]:/storage/.config/


    At your MMC

    Disable conflicting bt options

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

    Code
    1. options bluetooth disable_ertm=y

    Nasty hardcore to make it "permanent"

    vi /storage/.config/autostart.sh

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

    chmod 755 /storage/.config/autostart.sh

    Add udev rule

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

    Code
    1. ACTION=="bind", KERNEL=="0005:045E:02FD.*|0005:045E:02E0.*", SUBSYSTEM=="hid", DRIVER=="microsoft", \
    2. 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. ().

  • 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 ().