* IO plugin and multiple poll descriptors @ 2005-05-15 16:16 Marcel Holtmann 2005-05-17 8:51 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Marcel Holtmann @ 2005-05-15 16:16 UTC (permalink / raw) To: ALSA Mailing List Hi guys, 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. Regards Marcel ------------------------------------------------------- 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=7393&alloc_id=16281&op=click ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 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 0 siblings, 1 reply; 11+ messages in thread From: Takashi Iwai @ 2005-05-17 8:51 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List At Sun, 15 May 2005 18:16:51 +0200, Marcel Holtmann wrote: > > Hi guys, > > 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... 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-17 8:51 ` Takashi Iwai @ 2005-05-17 13:03 ` Marcel Holtmann 2005-05-17 16:15 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Marcel Holtmann @ 2005-05-17 13:03 UTC (permalink / raw) To: Takashi Iwai; +Cc: ALSA Mailing List 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? Regards Marcel ------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-17 13:03 ` Marcel Holtmann @ 2005-05-17 16:15 ` Takashi Iwai 2005-05-18 11:03 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Takashi Iwai @ 2005-05-17 16:15 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List 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. 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-17 16:15 ` Takashi Iwai @ 2005-05-18 11:03 ` Takashi Iwai 2005-05-18 12:05 ` Marcel Holtmann 0 siblings, 1 reply; 11+ messages in thread From: Takashi Iwai @ 2005-05-18 11:03 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 11:03 ` Takashi Iwai @ 2005-05-18 12:05 ` Marcel Holtmann 2005-05-18 12:36 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Marcel Holtmann @ 2005-05-18 12:05 UTC (permalink / raw) To: Takashi Iwai; +Cc: ALSA Mailing List 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. We can set poll_events through the callback now, right? I like to have different events for different descriptors. One POLLIN and one POLLOUT. 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. And you never released a final version with IOPLUG support. > 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? As soon as the anonymous CVS gives me the code ;) Regards Marcel ------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 12:05 ` Marcel Holtmann @ 2005-05-18 12:36 ` Takashi Iwai 2005-05-18 12:56 ` Marcel Holtmann 0 siblings, 1 reply; 11+ messages in thread From: Takashi Iwai @ 2005-05-18 12:36 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 12:36 ` Takashi Iwai @ 2005-05-18 12:56 ` Marcel Holtmann 2005-05-18 13:21 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Marcel Holtmann @ 2005-05-18 12:56 UTC (permalink / raw) To: Takashi Iwai; +Cc: ALSA Mailing List Hi Takashi, thanks for the answers. > > What happens at the moment when I really return two poll_fd. What about this one? > > > 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. You are right. I always forget to think about binary compatibility ;) > > 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. I agree. Regards Marcel ------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 12:56 ` Marcel Holtmann @ 2005-05-18 13:21 ` Takashi Iwai 2005-05-18 13:45 ` Marcel Holtmann 0 siblings, 1 reply; 11+ messages in thread From: Takashi Iwai @ 2005-05-18 13:21 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List At Wed, 18 May 2005 14:56:43 +0200, Marcel Holtmann wrote: > > > > What happens at the moment when I really return two poll_fd. > > What about this one? The poll_descriptors_count and poll_descriptors should return 2, for example, int my_poll_descriptors_count(snd_pcm_ioplug_t *io) { return 2; } int my_poll_descriptors(snd_pcm_ioplug_t *io, struct pollfd *pfds, unsigned int space) { if (space < 2) { error("Too little pfd\n"); return 0; } pfds[0].fd = fd0; pfds[0].events = POLLOUT | POLLERR | POLLNVAL pfds[1].fd = fd1; pfds[0].events = POLLIN | POLLERR | POLLNVAL return 2; } 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 13:21 ` Takashi Iwai @ 2005-05-18 13:45 ` Marcel Holtmann 2005-05-18 13:50 ` Takashi Iwai 0 siblings, 1 reply; 11+ messages in thread From: Marcel Holtmann @ 2005-05-18 13:45 UTC (permalink / raw) To: Takashi Iwai; +Cc: ALSA Mailing List Hi Takashi, > > > > What happens at the moment when I really return two poll_fd. > > > > What about this one? > > The poll_descriptors_count and poll_descriptors should return 2, > for example, > > int my_poll_descriptors_count(snd_pcm_ioplug_t *io) > { > return 2; > } > > int my_poll_descriptors(snd_pcm_ioplug_t *io, struct pollfd *pfds, > unsigned int space) > { > if (space < 2) { > error("Too little pfd\n"); > return 0; > } > pfds[0].fd = fd0; > pfds[0].events = POLLOUT | POLLERR | POLLNVAL > pfds[1].fd = fd1; > pfds[0].events = POLLIN | POLLERR | POLLNVAL > return 2; > } I know, but what I meant was if both descriptors are handled inside the library. Previous you said that multiple descriptors are not supported. Of did I understand that wrong? Regards Marcel ------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: IO plugin and multiple poll descriptors 2005-05-18 13:45 ` Marcel Holtmann @ 2005-05-18 13:50 ` Takashi Iwai 0 siblings, 0 replies; 11+ messages in thread From: Takashi Iwai @ 2005-05-18 13:50 UTC (permalink / raw) To: Marcel Holtmann; +Cc: ALSA Mailing List At Wed, 18 May 2005 15:45:11 +0200, Marcel Holtmann wrote: > > Hi Takashi, > > > > > > What happens at the moment when I really return two poll_fd. > > > > > > What about this one? > > > > The poll_descriptors_count and poll_descriptors should return 2, > > for example, > > > > int my_poll_descriptors_count(snd_pcm_ioplug_t *io) > > { > > return 2; > > } > > > > int my_poll_descriptors(snd_pcm_ioplug_t *io, struct pollfd *pfds, > > unsigned int space) > > { > > if (space < 2) { > > error("Too little pfd\n"); > > return 0; > > } > > pfds[0].fd = fd0; > > pfds[0].events = POLLOUT | POLLERR | POLLNVAL > > pfds[1].fd = fd1; > > pfds[0].events = POLLIN | POLLERR | POLLNVAL > > return 2; > > } > > I know, but what I meant was if both descriptors are handled inside the > library. Previous you said that multiple descriptors are not supported. > Of did I understand that wrong? Ah, yes I mentioned it. Don't worry, it was fixed on CVS, too :) 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-05-18 13:50 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.