alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* patch for jack plugin
@ 2011-12-29 16:12 Fons Adriaensen
  2012-01-09 17:19 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Fons Adriaensen @ 2011-12-29 16:12 UTC (permalink / raw)
  To: alsa-devel

The following patch will make snd_pcm_poll_descriptors_revents()
return the correct value when used on a jack plugin device.
The current version returns POLLIN regardless of capture or
playback.


--- pcm_jack_orig.c     2011-12-29 16:42:07.000000000 +0100
+++ pcm_jack.c  2011-12-29 16:51:18.000000000 +0100
@@ -77,17 +77,18 @@
        return 0;
 }
 
-static int snd_pcm_jack_poll_revents(snd_pcm_ioplug_t *io ATTRIBUTE_UNUSED,
+static int snd_pcm_jack_poll_revents(snd_pcm_ioplug_t *io,
                                     struct pollfd *pfds, unsigned int nfds,
                                     unsigned short *revents)
 {
        static char buf[1];
 
        assert(pfds && nfds == 1 && revents);
-
        read(pfds[0].fd, buf, 1);
-
-       *revents = pfds[0].revents;
+       *revents = pfds[0].revents & ~(POLLIN | POLLOUT);
+        if (pfds[0].revents & POLLIN) {
+           *revents |= (io->stream == SND_PCM_STREAM_PLAYBACK) ? POLLOUT : POLLIN;
+       }
        return 0;
 }
 


Ciao,


-- 
FA

Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patch for jack plugin
  2011-12-29 16:12 patch for jack plugin Fons Adriaensen
@ 2012-01-09 17:19 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2012-01-09 17:19 UTC (permalink / raw)
  To: Fons Adriaensen; +Cc: alsa-devel

At Thu, 29 Dec 2011 16:12:04 +0000,
Fons Adriaensen wrote:
> 
> The following patch will make snd_pcm_poll_descriptors_revents()
> return the correct value when used on a jack plugin device.
> The current version returns POLLIN regardless of capture or
> playback.

Applied now.  Thanks.


Takashi

> 
> 
> --- pcm_jack_orig.c     2011-12-29 16:42:07.000000000 +0100
> +++ pcm_jack.c  2011-12-29 16:51:18.000000000 +0100
> @@ -77,17 +77,18 @@
>         return 0;
>  }
>  
> -static int snd_pcm_jack_poll_revents(snd_pcm_ioplug_t *io ATTRIBUTE_UNUSED,
> +static int snd_pcm_jack_poll_revents(snd_pcm_ioplug_t *io,
>                                      struct pollfd *pfds, unsigned int nfds,
>                                      unsigned short *revents)
>  {
>         static char buf[1];
>  
>         assert(pfds && nfds == 1 && revents);
> -
>         read(pfds[0].fd, buf, 1);
> -
> -       *revents = pfds[0].revents;
> +       *revents = pfds[0].revents & ~(POLLIN | POLLOUT);
> +        if (pfds[0].revents & POLLIN) {
> +           *revents |= (io->stream == SND_PCM_STREAM_PLAYBACK) ? POLLOUT : POLLIN;
> +       }
>         return 0;
>  }
>  
> 
> 
> Ciao,
> 
> 
> -- 
> FA
> 
> Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl.
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-09 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 16:12 patch for jack plugin Fons Adriaensen
2012-01-09 17:19 ` Takashi Iwai

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).