fader_master/docs/midi-identity.md

51 lines
2.5 KiB
Markdown

# Linux MIDI discovery and identity
Run `fader_master devices` to inspect discovered ports. Config lists unclaimed
ports under Detected MIDI ports; open one to add it to the profile, then Save.
Configured MIDI devices have a details popup with connection status, backend
port, errors, and a default-controller toggle. Only a sole detected input is
automatically adopted when a managed profile is first created.
`midir` 0.11.1 exposes Linux ports as ALSA sequencer `client:port` addresses and
human-readable names. Neither value is a durable USB identity: client numbers
can change with connection and discovery order, while identical controllers can
publish identical names.
For a kernel sequencer client, ALSA reports its sound-card number. The MIDI
identity probe opens that card's udev `sound/cardN` device and copies:
- `ID_VENDOR_ID` and `ID_MODEL_ID` as the controller model key;
- `ID_SERIAL_SHORT` when the USB device supplies a serial;
- `ID_PATH` as the physical connection fallback.
User and virtual ALSA clients return no card number and therefore no USB
metadata. They may be selected by a unique port name, but duplicate names remain
ambiguous.
## Matching policy
1. Match the configured port name and, for USB devices, VID/PID.
2. Prefer an exact serial when one was observed.
3. Without a serial, prefer the retained physical path.
4. A unique remaining model/name is safe to select.
5. Multiple remaining candidates stay unassigned. An explicit backend-port
choice may resolve the current topology, but the ephemeral ALSA address is
not treated as durable evidence after reconnect or reboot.
This means two identical serial-less devices can remain attached to stable USB
sockets and be distinguished by path. If they move between sockets, software
cannot prove which physical unit is which; silently binding by enumeration order
would risk controlling the wrong applications.
## Recorded host observation
On 2026-10-14, the Arch Linux host exposed only
`PortIdentity { backend_id: "14:0", name: "Midi Through:Midi Through Port-0 14:0", usb: None }`.
This validates the virtual-client fallback but is not physical-controller
acceptance. A later APC MINI observation on 2026-10-15 recorded USB
`09e8:0028`, serial `Ver00.10`, and backend port `36:0`; the serial stayed
stable when the USB socket changed. Two-identical-device ambiguity checks
remain open in [the backlog](../task.md) and
[hands-on checklist](../checklist.md). These are recorded observations, not
guarantees that every controller exposes a unique serial.