Glamońćanin.net

About

Stuff i did

Bring MidiSport keyboards to life with udev and fxload on linux
25.12.2012

I'm on of those linux users who likes to tinker, and boy do i get the opportunities:)

Things change all the time, specifications, parameters, the way things work, and one of those things is how udev activates USB devices that need custom firmware loading.

For my M-audio Oxygen8 keyboard i need to run "fxload" with the firmware and usb device parameter before it starts working normally. Years ago i snatched an ubuntu targeted udev script for that, just create the file /etc/udev/rules.d/99-midisport-firmware.rules with this content:
# midisport-firmware.rules - udev rules for loading firmware into MidiSport devices

# DEVPATH=="/*.0" selects interface 0 only
# (some udev versions don't work with SYSFS{bInterfaceNumber})

# MidiSport 2x2
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1001/*", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport2x2.ihx"
# MidiSport 1x1
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1010/*", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport1x1.ihx"
# KeyStation
#ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1014/*", RUN+="/sbin/fxload -s /lib/firmware/MidiSportLoader.ihx -I /lib/firmware/MidiSportKS.ihx"
# MidiSport 4x4
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1020/*", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport4x4.ihx"
# MidiSport 8x8
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1031/110", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport8x8-2.10.ihx"
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1031/121", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport8x8-2.21.ihx"

Great, it worked! 

But I use gentoo and a couple of udev upgrades later... it stopped:|

After debugging i discovered that fxload was not getting it's parameter for the device path. The fix is kind of simple, change all run lines to add " -D /dev/%P", like this: 
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1014/*", RUN+="/sbin/fxload -s /lib/firmware/MidiSportLoader.ihx -I /lib/firmware/MidiSportKS.ihx -D /dev/%P"

Also, check the location of the firmware files, this is where we gentooers have them.

Have fun using your M-Audio gear:)