MT-147614: Add USB midi ports to pipewire#39
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to make USB MIDI ports visible to PipeWire by enabling ALSA sequencer support (/dev/snd/seq) and improving gadget MIDI device naming to avoid ambiguous duplicates.
Changes:
- Enable ALSA sequencer + seq-midi in the mt_connect arm64 defconfig.
- Change USB gadget MIDI ALSA card shortname to prefer the instance
id(to help distinguish multiple MIDI gadgets). - Modify
/dev/kmsgratelimit initialization and increase ARM32COMMAND_LINE_SIZE(both appear unrelated to the stated MIDI/PipeWire goal).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| kernel/printk/printk.c | Changes /dev/kmsg userspace injection ratelimit init parameters. |
| drivers/usb/gadget/function/f_midi.c | Uses gadget instance id for ALSA card shortname to reduce name collisions. |
| arch/arm64/configs/mt_connect_defconfig | Enables ALSA sequencer and seq-midi options needed for /dev/snd/seq. |
| arch/arm/include/uapi/asm/setup.h | Increases ARM32 UAPI COMMAND_LINE_SIZE from 1024 to 4096. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Add CONFIG_SND_SEQUENCER=y and CONFIG_SND_SEQ_MIDI=y to mt_connect_defconfig * Sequencer creates /dev/snd/seq; snd-seq-midi bridges f_midi rawmidi devices to ALSA seq clients * WirePlumber alsa-midi.lua detects /dev/snd/seq and exposes both USB-C f_midi ports as PipeWire MIDI nodes automatically
* Replace hardcoded shortname "f_midi" with the configfs id attribute * id propagates to rawmidi name, ALSA sequencer client name, and PipeWire port name — enabling per-port identification in PipeWire * Falls back to "f_midi" if id is not set
|
In devQA of this PR, discovered another issue which @dnappier-mt is looking into. Will complete this devQA when other issue addressed. |
|
DevQA: Pass Tested in conjunction with firmware PR #617 (Doug's userspace pipewire/wireplumber + gadget Process
Result
/proc/asound/cards
Test target: i.MX8 dev unit, paired userspace from dnappier-mt/firmware:MT-147614. |
MT-147614
Dev QA: @AmeNote-Michael
Currently USB midi ports are available as ALSA midi devices but they are not showing up in pipewire. You can verify that they are available in ALSA using
amidi -lbut that they are not available in pipewire usingpw-link -i | grep -i midiThe fix is to add the snd-seq-midi subsystem to linux. Pipewire only support midi devices through /dev/snd/seq so that it can, among the other benefits of seq, connect multiple midi clients to a hardware midi device.
The other issue is that the USB driver was naming the USB midi device as the "'shortname" which ends up with both devices being named the same thing ("f_midi") so an easy change was made to include the USB id in the name to delineate which midi device belongs to which USB port.
The easiest way to test this is to connect the 2 USB midi devices together:
pw-link "Midi-Bridge:usbc0 3:(capture_0) usbc0" "Midi-Bridge:usbc1 5:(playback_0) usbc1"pw-link "Midi-Bridge:usbc1 5:(capture_0) usbc1" "Midi-Bridge:usbc0 3:(playback_0) usbc0"This functionally makes the routing [USB1 Midi] <---> [USB0 Midi] so you can send midi data from one IPad to another externally