Using PDP Wired Xbox controller on Lakka 2.3.2

The PDP Xbox Wired Controller does not work on Lakka 2.3.2 out of the box but I got it working (on x86_64) so figured I would share in case others would like to use these controllers as well (https://www.amazon.com/PDP-Wired-Controller-Xbox-Midnight-Blue/dp/B073X47SG4/). The Linux kernel was patched in 4.15 (and subsequent kernels) to provide support for these controllers but Lakka 2.3.2 is using Linux 4.11.12.

Basically you have to clone the Lakka git repo, checkout v2.3.2, insert a patch to update xpad.c with the PDP patches, and then compile the xpad.c kernel module and insert it into the Lakka 2.3.2 image.

I did the following on a fresh install of Ubuntu 16.04 (with the relevant developer packages installed like build-essential, etc):

# Generate xpad.c patch for Lakka-2.3.2 based on linux kernel 5.5
mkdir -p a/drivers/input/joystick/
mkdir -p b/drivers/input/joystick/
wget -O a/drivers/input/joystick/xpad.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/input/joystick/xpad.c?h=v4.11
wget -O b/drivers/input/joystick/xpad.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/drivers/input/joystick/xpad.c?h=v5.5
diff -Naur a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c > linux-999-xpad-linux-5.5.patch

# Add patch and build Lakka linux package
git clone https://github.com/libretro/Lakka-LibreELEC
cd Lakka-LibreELEC
git checkout Lakka-2.3.2
cp ../linux-999-xpad-linux-5.5.patch packages/linux/patches/default/
DISTRO=Lakka PROJECT=Generic ARCH=x86_64 scripts/clean linux
DISTRO=Lakka PROJECT=Generic ARCH=x86_64 scripts/build linux
cp ./build.Lakka-Generic.x86_64-2.3-devel/linux-4.11.12/drivers/input/joystick/xpad.ko ../

# Insert xpad.ko module into Lakka 2.3.2 image
cd ../
wget http://le.builds.lakka.tv/Generic.x86_64/Lakka-Generic.x86_64-2.3.2.img.gz
gunzip Lakka-Generic.x86_64-2.3.2.img.gz
losetup -P --show -f Lakka-Generic.x86_64-2.3.2.img
mkdir /mnt/lakka
mount /dev/loop0p1 /mnt/lakka
cp /mnt/lakka/SYSTEM ./
unsquashfs SYSTEM
rm SYSTEM
rm ./squashfs-root/usr/lib/modules/4.11.12-rt14/kernel/drivers/input/joystick/xpad.ko
cp xpad.ko ./squashfs-root/usr/lib/modules/4.11.12-rt14/kernel/drivers/input/joystick/xpad.ko
mksquashfs squashfs-root SYSTEM -comp gzip
mkdir target
mv SYSTEM target/
md5sum target/SYSTEM > target/SYSTEM.md5
cp target/SYSTEM /mnt/lakka/
cp target/SYSTEM.md5 /mnt/lakka/
umount /mnt/lakka
losetup -d /dev/loop0
mv Lakka-Generic.x86_64-2.3.2.img Lakka-Generic.x86_64-2.3.2-xpad.img

You should be able to flash this updated image and the PDP controller should be recognized as a Generic gamepad when you load Lakka. You will need to go to the controller settings and setup the binds for the new controller as the Lakka autoconfigs for joypads do not include these controllers.

I know this is kind of old but is there a tutorial on this somewhere? I’m currently having the same issue on my first lakka pc build and all I have is the pdp xbox one controller you mentioned.

The above is a tutorial if you have the ability to install Linux and work from the command line. You should be able to search the internet for tutorials on installing a fresh version of Ubuntu (I did it with Ubuntu 16.04) and once you have that going, the above is a step by step of the commands at the command line to perform to create a patched v2.3.2 with the PDP controller support. I installed Ubuntu in a Virtual Machine and did it that way.

I could post a link to the completed/patched image, but it’s probably not a good idea given I can’t provide any trust/verification of the image.