udev rules for mayflash gamecube adapter

Flit's personal blog where they talk and rant about whatever
Post Reply
User avatar
Flit
Posts: 73
Registered for: 7 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 56 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
Post Reply