From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: IO plugin and multiple poll descriptors Date: Wed, 18 May 2005 14:36:41 +0200 Message-ID: References: <1116173811.8886.55.camel@pegasus> <1116335015.10063.91.camel@pegasus> <1116417943.10063.234.camel@pegasus> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <1116417943.10063.234.camel@pegasus> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Marcel Holtmann Cc: ALSA Mailing List List-Id: alsa-devel@alsa-project.org At Wed, 18 May 2005 14:05:43 +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. > > should we set poll_fd to -1 or leave it untouched when using the new > callbacks. It doesn't matter. If the callback is defined, it's always used. -1 would be better to catch possible bugs, though. > We can set poll_events through the callback now, right? I like to have > different events for different descriptors. One POLLIN and one POLLOUT. Yes. The callback has to set poll_events, too. > What happens at the moment when I really return two poll_fd. > > > This change breaks the compatibility with older versions. > > For the future compatibility, I added a new field to > > snd_pcm_ioplug_t. > > Does it? If the new callbacks are not used you will fall back to poll_fd > and so no difference at all. Well, I inserted in the middle, not at the end. > And you never released a final version with IOPLUG support. Yes. I don't care the compatibility *now* at all. But, as I wrote, this is for *future* compatibility. Once after 1.0.9-final is out, we should be careful about it. 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