udev rules for mayflash gamecube adapter

Flit's personal blog where they talk and rant about whatever
Post Reply
User avatar
Flit
Posts: 79
Registered for: 9 months
Location: Indiana, US
Gender:
Contact:

udev rules for mayflash gamecube adapter

#1

Post by Flit »

i've finally written a good set of udev rules for the unbranded gamecube adapter i use to play sadx and ship of harkinian. the control stick and trigger deadzones were quite bad out of the box, so i needed to use udev to configure them automatically when connected.

for the curious, a photo of the adapter (i don't remember where i got it, maybe from a brick-and-mortar gameshop?):
2025-11-07-12-15-42-973.jpg
2025-11-07-12-15-42-973.jpg (920.63 KiB) Viewed 147 times

it's identified by my system as a mayflash adapter, so it should work for those too.

these udev rules use the arch packages joyutils and linuxconsole, which provide jscal and evdev-joystick respectively. non-arch systems will want to use some equivalent packages or utilities to configure deadzones.

and now, the udev rules in question:

Code: Select all

# file location: /etc/udev/rules.d/51-gcadapter.rules

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", MODE="0666"

# set axis info for Hyperkin GameCube Adapter
ACTION=="add", ENV{ID_VENDOR_ID}=="0079", ENV{ID_MODEL_ID}=="1843", RUN+="/usr/bin/jscal -s 8,1,0,112,142,6795626,6032073,1,0,112,142,5899500,6972136,1,0,112,142,7254790,6468126,1,0,112,142,6468126,5534582,1,0,112,142,6882750,5534582,1,0,112,142,7254790,6972136,1,0,0,0,536854528,536854528,1,0,0,0,536854528,536854528 /dev/input/js%n"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 0 --minimum 33 --maximum 231"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 1 --minimum 19 --maximum 223"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 2 --minimum 37 --maximum 226"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 3 --minimum 27 --maximum 243"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 4 --minimum 29 --maximum 241"
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="1843", RUN+="/usr/bin/evdev-joystick --evdev /dev/input/event%n --axis 5 --minimum 37 --maximum 220"
see Gamepad on archwiki for information on setup and calibration. you'll want to calibrate your controller yourself, and then adjust the commands under RUN+= to fit.

also see udev on archwiki.

i hope this helps anyone who wants to use gamecube controllers on linux!
Blessed are the rich
May we labor, deliver them more
Blessed are the envious
Bless the slothful, the wrathful, the vain
Blessed are the gluttonous
May they feast us to famine and war

The Doomed - A Perfect Circle
User avatar
Flit
Posts: 79
Registered for: 9 months
Location: Indiana, US
Gender:
Contact:

addendum: sadx input delay

#2

Post by Flit »

as an addendum to this:

out of the box (as in, after configuring mods), i was getting noticeable input delay in sadx. the reason is because the SDL2 implementation in the mod loader defaulted to xinput instead of dinput - for some reason, the latter has less input lag??

to mitigate the input delay:
  1. open SA Mod Manager
  2. go to Game Config > Input > Open AppLauncher
  3. on the right hand side, select DInput
  4. test the controls here to make sure they still work, then click Save at the bottom right
  5. close the AppLauncher, Save in SA Mod Manager (just to be sure), then open the game and test
you should ONLY try this if you're already experiencing input delay in sadx. if your controller is already fine, you have no reason to do this.
Blessed are the rich
May we labor, deliver them more
Blessed are the envious
Bless the slothful, the wrathful, the vain
Blessed are the gluttonous
May they feast us to famine and war

The Doomed - A Perfect Circle
Post Reply