More MIDI 2.0 Code Being Worked On For The Linux Kernel

Written by Michael Larabel in Multimedia on 17 July 2023 at 01:12 PM EDT. Add A Comment
MULTIMEDIA
Merged for Linux 6.5 was initial MIDI 2.0 support for the necessary USB audio and raw MIDI drivers to support this major MIDI update. Being worked on now for merging into a future kernel release is the USB gadget driver support around MIDI 2.0.

Takashi Iwai of SUSE who maintains the Linux kernel's sound subsystem and worked on the original MIDI 2.0 enablement patches is also the one working on this USB gadget driver support. Within sound.git he's published topic/midi20-gadget where he's queuing his work around the MIDI 2.0 USB gadget driver support. In those patches he explains:
This patch adds the support for USB MIDI 2.0 gadget function driver. The driver emulates a USB MIDI 2.0 interface with one or more UMP Endpoints, where each of UMP Endpoint is a pair of MIDI Endpoints for handling MIDI 2.0 UMP packets. When the function driver is bound, the driver creates an ALSA card object with UMP rawmidi devices. This is a kind of loop-back where the incoming and upcoming UMP packets from/to the MIDI 2.0 UMP Endpoints are transferred as-is. In addition, legacy (MIDI 1.0) rawmidi devices are created, so that legacy applications can work in the gadget side, too.

When a USB MIDI 2.0 gadget interface appears, the connected host can use it with the snd-usb-audio driver where MIDI 2.0 support is enabled. Both gadget and connected hosts will have the similar UMP Endpoint and Function Block (or Group Terminal Block) information. Slight differences are the direction and UI-hint bits; it's due to the nature of gadget driver, and the input/output direction is swapped in both sides (the input for gadget is the output for host, and vice versa).

The driver supports the brand-new UMP v1.1 feature, including the UMP Stream message handling for providing UMP Endpoint and Function Block information as well as dealing with the MIDI protocol switch. The driver responds to UMP Stream messages by itself. OTOH, MIDI-CI message handling isn't implemented in the kernel driver; it should be processed in the user-space through the loopback UMP device.

Or put more simply by the new Kconfig text for this MIDI 2.0 gadget support:
The MIDI 2.0 function driver provides the generic emulated USB MIDI 2.0 interface, looped back to ALSA UMP rawmidi device on the gadget host. It supports UMP 1.1 spec and responds UMP Stream messages for UMP Endpoint and Function Block information / configuration.

We'll see how this evolves and if the work manages to get into shape for merging as part of the USB changes come the time of the Linux v6.6 merge window.

Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week