Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: ALSA Mailing List <alsa-devel@lists.sourceforge.net>
Subject: Re: IO plugin and multiple poll descriptors
Date: Wed, 18 May 2005 13:03:27 +0200	[thread overview]
Message-ID: <s5hu0l0okxs.wl@alsa2.suse.de> (raw)
In-Reply-To: <s5h7jhxq15v.wl@alsa2.suse.de>

At Tue, 17 May 2005 18:15:24 +0200,
I wrote:
> 
> At Tue, 17 May 2005 15:03:35 +0200,
> Marcel Holtmann wrote:
> > 
> > Hi Takashi,
> > 
> > > > for the IO plugin we can specify one descriptor for poll().
> > > > 
> > > > 	io.poll_fd = fd;
> > > > 	io.poll_events = POLLIN;
> > > > 
> > > > I like to use more than one, because in the Bluetooth cases I always
> > > > have to deal with a signal and a separate media channel. Is it possible
> > > > to add support for that or do I must work around it.
> > > 
> > > Currently, the alsa-lib handles only one poll_fd internally although
> > > API allows the multiple poll_fds.  So, it's not quite easy to add the
> > > multiple fds...
> > 
> > are there any plans to change this in the future?
> > 
> > Maybe it is a good idea to retrieve the poll_fd through a callback. I
> > think of something like you already do in the library:
> > 
> > 	poll_descriptors(snd_pcm_ioplug_t *io, struct pollfd *pfds)
> > 	poll_descriptors_count(snd_pcm_ioplug_t *io)
> > 
> > Or do you have a good idea on how to workaround it?
> 
> I agree, adding the appropriate new callbacks would be the simplest
> solution.  I'll implement it soon if no one is against it.

I added the new callbacks to CVS.
The following two fields are added to snd_pcm_ioplug_callback_t:

	/**
	 * poll descriptors count; optional
	 */
	int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
	/**
	 * poll descriptors; optional
	 */
	int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);

If they are NULL, poll_fd is used as well as in the former version.

This change breaks the compatibility with older versions.
For the future compatibility, I added a new field to
snd_pcm_ioplug_t.

The first field of snd_pcm_ioplug_t is "version" now.  This field must
be filled by the caller with SND_PCM_IOPLUG_VERSION constant defined
in pcm_ioplug.h.

struct snd_pcm_ioplug {
	/**
	 * protocol version; SND_PCM_IOPLUG_VERSION must be filled here
	 * before calling #snd_pcm_ioplug_create()
	 */
	unsigned int version;
	/**
	 * name of this plugin; must be filled before calling #snd_pcm_ioplug_create()
	 */
	const char *name;
	...

Could you change your driver to follow this?

Any comments appreciated.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click

  reply	other threads:[~2005-05-18 11:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-15 16:16 IO plugin and multiple poll descriptors Marcel Holtmann
2005-05-17  8:51 ` Takashi Iwai
2005-05-17 13:03   ` Marcel Holtmann
2005-05-17 16:15     ` Takashi Iwai
2005-05-18 11:03       ` Takashi Iwai [this message]
2005-05-18 12:05         ` Marcel Holtmann
2005-05-18 12:36           ` Takashi Iwai
2005-05-18 12:56             ` Marcel Holtmann
2005-05-18 13:21               ` Takashi Iwai
2005-05-18 13:45                 ` Marcel Holtmann
2005-05-18 13:50                   ` Takashi Iwai

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=s5hu0l0okxs.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    /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