Getting them to work in both Kodi and moonlight is something I'm still looking into, as @Waynosan has already informed me that there's something going wrong when following my guide. I'll work on getting it fixed as soon as I can find some time to play around with it - as you can surely understand it's more or less time consuming to test different configurations.
If I were you I'd try to get it to work in moonlight first and care about all the rest later on, as using a controller for Kodi is certainly an amazing experience, but not the "core" use case.
About your rc.local:
- you can tell xboxdrv to detach the xpad module:
Detaches the kernel driver that is currently associated with the
given device. This is useful when you have the xpad module
loaded and want to use xboxdrv without unloading it.
source. That's usually not needed after removing xpad manually once.
- or simply blacklist it by creating a file called e.g.
gamepad.conf inside the
/etc/modprobe.d/ dir with the following content:
This needs a reboot to stick.
- I'm not using uinput or joydev for my barebones configuration (which, again, won't work in Kodi, so they might be needed only for that specific case but I didn't try that yet)
My rc.local looks like this right now (exit 0 line still in place of course):
xboxdrv --daemon \
--led 2 --deadzone 4000 --dpad-rotation 90 --axismap -DPAD_X=DPAD_X --trigger-as-button \
--led 3 --deadzone 4000 --dpad-rotation 90 --axismap -DPAD_X=DPAD_X --trigger-as-button &
After changing my configuration I usually just kill xboxdrv (
sudo pkill xboxdrv) and execute my rc,local (
sudo /etc/rc.local). At this stage, this also allows me to create a new map file if necessary as Kodi has just lost the grab on my controllers (as the controllers are removed from the system when xboxdrv shuts down and get re-added when it starts back up; be aware that this won't work after a reboot because xboxdrv starts first and Kodi grabs all devices again).
Let me know if this helps.