[alsa-devel] Linking ALSA sequencer kernel clients to their device

Clemens Ladisch clemens at ladisch.de
Thu Feb 11 10:17:03 CET 2016


Martin Koegler wrote:
> In my domain, people use multiple identical USB-MIDI keyboards - each
> is assigned a different functions. They expect to kept this mapping
> across reboots.
>
> The sound card number are dynamic, therefore they can change after
> reboots. The only stable device ID is the sysfs path of the used USB
> port.
>
> This means, that I need to associate a kernel sequencer client number
> with a sysfs device.
>
> rawmidi devices expose the card number via IOCTLs, which allows to
> find the corresponding device in sysfs.
>
> The sequencer provides no identifing data. Chromium works around this
> issue by scanning rawmidi as well as sequencer devices and matching
> them by using assumtions, how the kernel register sequencer devices.

This information wouldn't be wrong in the commit message.

> So I thought about exposing the missing information via sysfs:

The ioctl API (and the library API on top of it) already exists.  Why
do you want to introduce another kind of API that cannot be used for
virtual devices?

Just add the card number to snd_seq_client_info.  (For kernel drivers;
user clients might have the PID here while we're at it.)


Regards,
Clemens


More information about the Alsa-devel mailing list