Getting rumble on the 8BitDo SN30 Pro+ to work properly with Linux

TLDR: After having owned the controller for a while I noticed that every time you install a new kernel update the fixes are undone again, and have to be re-applied. I also discovered that the controller UID is the same for all SN30 Pro+ controllers. So I’ve made the following script that fixes everything automatically instead. Save it somewhere, check that the config file paths are correct, install xpadneo using the github instructions, then run the script as root.

#!/bin/bash

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root"
    exit 1
fi

# Config file paths
MP_PATH="/etc/modprobe.d/99-xpadneo-bluetooth.conf"
UDEV_PATH="/etc/udev/rules.d/99-xpadneo.rules"
ENV_PATH="/etc/environment"

# Look for already applied fixes
MPFIXED=$(grep -c "disable_ff=2" $MP_PATH)
UDEVFIXED=$(grep -c "RUN+=\"/bin/sh -c 'echo xpadneo udev: \$kernel > /dev/kmsg && { echo \$kernel > /sys/bus/hid/drivers/hid-generic/unbind; echo \$kernel > /sys/bus/hid/drivers/microsoft/unbind; echo \$kernel > /sys/bus/hid/drivers/xpadneo/bind; }; '\"" $UDEV_PATH)
ENVFIXED=$(grep -c "8BitDo SN30 Pro+" $ENV_PATH)

if [[ $MPFIXED -eq 0 ]]; then
  # Turn off trigger rumble
  echo "options hid_xpadneo debug_level=0 disable_ff=2 trigger_rumble_damping=4 fake_dev_version=4400 combined_z_axis=n" >> $MP_PATH
  echo "Applied fix to $MP_PATH."
else
  echo "Fix already applied to $MP_PATH. Skipping."
fi

if [[ $UDEVFIXED -eq 0 ]]; then
  # Apply dirty fix to udev rules
  sed -i 's/RUN/#RUN/g' $UDEV_PATH
  echo "RUN+=\"/bin/sh -c 'echo xpadneo udev: \$kernel > /dev/kmsg && { echo \$kernel > /sys/bus/hid/drivers/hid-generic/unbind; echo \$kernel > /sys/bus/hid/drivers/microsoft/unbind; echo \$kernel > /sys/bus/hid/drivers/xpadneo/bind; }; '\"" >> $UDEV_PATH
  echo "Applied fix to $UDEV_PATH"
else
  echo "Fix already applied to $UDEV_PATH. Skipping."
fi

if [[ $ENVFIXED -eq 0 ]]; then
  # Add SDL_CONTROLLERCONFIG environment variable
  echo "SDL_GAMECONTROLLERCONFIG=\"050000005e040000e002000030110000,8BitDo SN30 Pro+,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,\"" >> $ENV_PATH
  echo "Added 'SDL_CONTROLLERCONFIG' variable to $ENV_PATH."
else
  echo "'SDL_CONTROLLERCONFIG' variable already present in $ENV_PATH. Skipping."
fi

Original post follows:

I recently bought an 8BitDo SN30 Pro+ since my old gamepad was an ancient Logitech Dual Action. I wanted a gamepad that was wireless as well as having support for XInput. When I heard about the SN30 Pro+ I couldn’t contain myself, so I went and bought it the same day after reading a bit about it and how it works on Linux. It’s not officially supported, and there wasn’t really much definitive information regarding Linux compatibility, other than that the older SN30 Pro worked fine and it works on the raspberry pi. So I just took a gamble and bought it.

Continue reading “Getting rumble on the 8BitDo SN30 Pro+ to work properly with Linux”

Fixing Glitchy Graphics on Famicom Disk System

The Famicom Disk System is an interesting piece of hardware that I’ve been interested in buying for a long time, but have been a bit apprehensive about collecting for since the floppy disk format is rather fragile. Add in the fact that the disk drive itself often needs to be recalibrated and repaired because of the drive belt wearing out and that a lot of the disks for sale have been overwritten with other games over the years, and it’s a pretty hard sell for me. Continue reading “Fixing Glitchy Graphics on Famicom Disk System”

Game Boy Pocket Backlight Mod

Recently I’ve been teaching myself how to solder, and also reading up on various console mods I could try out just for fun. An obvious, and quite simple mod is installing a backlight on a Game Boy. It only involves four solder points in total, soldering the backlight to the main board of the console. The original Game Boy consoles of course didn’t have a lit-up screen, so installing a backlight is a huge improvement. Since I already have an original Game Boy with a backlight and bivert mod — generously gifted to me by a friend who did the mod himself — and the fact that I have a bunch of Game Boy Pockets lying around, I decided to install a backlight and bivert mod into one of those. Continue reading “Game Boy Pocket Backlight Mod”

New phone, and submitting to the Google overlords

So a few weeks ago I was pickpocketed on my cell-phone and my passport. While the passport is a bit of a pain to lose, I didn’t care that much about losing the phone since it was an old Samsung Xcover 2 and I was so tired of it anyway. It had 1GB of flash memory of which at least 700MB was used by Android and a significant amount of the rest by Samsung’s forced bloatware, meaning I couldn’t really install much on it. And even if I could, most newer apps wouldn’t work with it because the Android version was too old. Overall it was really slow to do anything on, and the battery life was really crap. Continue reading “New phone, and submitting to the Google overlords”