From: Martin Koegler <martin.koegler@chello.at>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>,
Martin Koegler <martin.koegler@chello.at>
Subject: Re: [PATCH] Provide card number / PID via sequencer client info
Date: Wed, 17 Feb 2016 22:30:54 +0100 [thread overview]
Message-ID: <20160217213054.GA5144@mail.zuhause> (raw)
In-Reply-To: <s5h7fi34ehu.wl-tiwai@suse.de>
On Wed, Feb 17, 2016 at 03:07:25PM +0100, Takashi Iwai wrote:
> > My users are using a few identical USB MIDI keyboards [or USB MIDI interfaces] and
> > I need to recognize the devices even after reboot.
> >
> > => I want a stable, unique (composite) device ID for kernel sequencer clients+ports.
> >
> > My current ID is: client name, sysfs-path and port number.
> >
> > The sound card number allows to find the device in sysfs and determine the used USB port as stable identifier.
> > I hope, that the registration order for the ports of one USB MIDI device [or sound card] will always be the same.
> >
> > see my prototype: https://build.opensuse.org/package/view_file/home:e9925248:branches:openSUSE:Leap:42.1:Update/grandorgue/0001-Add-support-for-unique-device-IDs.patch?expand=1
> >
> > OPL3/4 + emuXXX synth register with a different name, so they should be distinct.
>
> Yeah, there is a difference, of course. But the identifying by the
> name string suffices? In other words, how would user-space identify
> the client at best? Passing another attribute to client_info like
> port type?
port type is not property of struct snd_seq_client - so it is better reported via port info.
It already has SND_SEQ_PORT_TYPE_SYNTHESIZER and SND_SEQ_PORT_TYPE_PORT.
For my usecase, I don't care about the type.
Either the user select it from a drop-down or uses auto-detection: He triggers at request
a MIDI event and the port with activity is selected - If you want to see it in action: https://www.youtube.com/watch?v=3g7H1W4x2cg [at 1:20]
> > I just ask myself, if the device index would provide any useful information.
>
> Which "device index" do you mean? The index passed at created
> snd_seq_create_kerne_client()?
Yes.
> > I don't know, how to map it to a anything below the soundcard in sysfs.
> > Is the device ID dymanic? [= Are they depending, if I first load the rawmidi module and then the synth module or the other way around].
>
> If you mean about the client index offset, then usually they are fixed
> by each driver. And even the client id number is fixed (up to 4
> clients per card):
> client = 16 + card * 4 + index.
>
> So, in most case, the card number can be calculated even without the
> new information. But, this is rather heuristic, and a clear mapping
> would be better, of course.
The key word is "usually". Its only suitable for an interface, if it is "always" fixed or can be used as an pointer on sysfs.
Regards,
Martin
next prev parent reply other threads:[~2016-02-17 21:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 13:42 [PATCH] Provide sequencer sound card number / PID via alsa-lib Martin Koegler
2016-02-13 13:42 ` [PATCH] Show sequencer sound card numer/PID via aconnect Martin Koegler
2016-02-13 13:42 ` [PATCH] Provide card number / PID via sequencer client info Martin Koegler
2016-02-15 10:30 ` Takashi Iwai
2016-02-15 10:37 ` Clemens Ladisch
2016-02-15 18:32 ` Martin Koegler
2016-02-15 19:08 ` Takashi Iwai
2016-02-15 21:44 ` Martin Koegler
2016-02-15 22:34 ` Takashi Iwai
2016-02-16 8:03 ` Martin Koegler
2016-02-16 8:41 ` Takashi Iwai
2016-02-16 8:59 ` Clemens Ladisch
2016-02-16 9:27 ` Takashi Iwai
2016-02-16 18:21 ` Martin Koegler
2016-02-17 14:07 ` Takashi Iwai
2016-02-17 21:30 ` Martin Koegler [this message]
2016-02-15 10:39 ` [PATCH] Provide sequencer sound card number / PID via alsa-lib Clemens Ladisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160217213054.GA5144@mail.zuhause \
--to=martin.koegler@chello.at \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).