[alsa-devel] [PATCH] Provide card number / PID via sequencer client info

Clemens Ladisch clemens at ladisch.de
Mon Feb 15 11:37:15 CET 2016


Takashi Iwai wrote:
> Martin Koegler wrote:
>> 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 changes adds support for exposing the card number for kernel clients
>> as well as the PID for user client.
>>
>> The minor of the API version is changed to distinguish between the zero
>> initialised reserved field and card number 0.
>>
>> Signed-off-by: Martin Koegler <martin.koegler at chello.at>
>
>> +++ b/include/uapi/sound/asequencer.h
>> @@ -357,7 +357,8 @@ struct snd_seq_client_info {
>> - char reserved[64]; /* for future use */
>> + int owner; /* RO: card number[kernel] / PID[user] */
>> + char reserved[64 - sizeof(int)]; /* for future use */
>
> The sizeof(int) is always 4. So let's make it explicit.
>
> But, please make sure that this change won't lead to any
> incompatibility. Some architectures might align with 64bit long,
> although the 32bit int and the rest char[] should be fine on all known
> architectures, AFAIK.

Or just make it two fields, card and pid. The two values are currently
exclusive, but there is no technical reason for this.


Regards,
Clemens


More information about the Alsa-devel mailing list