world leader in high performance signal processing
Trace: » midi

Gadget MIDI

This exposes an ALSA MIDI interface, which will appear in /proc/asound/cards with both recording and playback support. On the gadget side, open the MIDI gadget like any other ALSA MIDI device. Then you can write events to the host, or read them from the host.

Source file drivers/usb/gadget/gmidi.c

Kernel config for Gadget MIDI

[Linux Kernel Configuration] -→ [Device Drivers] -→ [USB support] -→ [USB Gadget Support]

<M> Support for USB Gadgets
<M>   MIDI Gadget (EXPERIMENTAL)

Using Gadget MIDI

g_midi on EZKIT-BF548

  • On EZKIT-BF548 board install the g_midi module
root:~> modprobe g_midi
g_midi gadget: MIDI Gadget, version: 25 Jul 2006
g_midi gadget: using musb_hdrc, OUT ep6out IN ep5in
g_midi gadget: gmidi_register_card finished ok
g_midi gadget: gmidi_bind finished ok
root:~> g_midi gadget: HNP inactive
g_midi gadget: high speed
  • A new MIDI ALSA interface was created on EZKIT-BF548
root:~> cat /proc/asound/cards
 0 [bf548ezkit     ]: AD1980 - bf548-ezkit
                      bf548-ezkit (AD1980)
 1 [gmidi          ]: MIDI Gadget - g_midi
                      MIDI Gadget
root:~> cat /proc/asound/gmidi/
cat: read error: Is a directory
root:~> ls /proc/asound/gmidi/ 
id         midi0      oss_mixer

Linux host configuation

  • On Linux host run following command, then will find similar the Gadget MIDI device information
$ mount -t usbfs none /proc/bus/usb/
$ cat /proc/bus/usb/devices 

T:  Bus=05 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#= 29 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=17b3 ProdID=0004 Rev= 2.16
S:  Manufacturer=Linux 2.6.22.14-ADI-2007R2-pre-svn3935 with musb_
S:  Product=MIDI Gadget
C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:* If#= 1 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-audio
E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
  • A new MIDI ALSA interface was created on Linux Host PC
$ cat /proc/asound/cards 
 0 [ICH6           ]: ICH4 - Intel ICH6
                      Intel ICH6 with AD1981B at irq 21
 1 [Gadget         ]: USB-Audio - MIDI Gadget
                      Linux 2.6.22.14-ADI-2007R2-pre-svn3935 with musb_ MIDI Gadget at usb-0000:00:1d
$ ls /proc/asound/Gadget/
id  midi0  oss_mixer  usbbus  usbid

Windows host configuation

  • On Windows XP, it will automatically install the USB MIDI Audio device driver for this g_midi application
  • A new USB Audio Device driver can be found in the device list of [Device Manager]