Skip to contentSkip to conversation

patch for jack plugin

PATCH Fons Adriaensen 2 participants 2 messages Dec 29, 2011 – Jan 9, 2012

lore
Share & tools
lore
#0 lore raw

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.c 2011-12-29 16:51:18.000000000 +0100 renamed from pcm_jack_orig.c 2011-12-29 16:42:07.000000000 +0100 +5 -4
@@ -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,

Signature · 3 lines
FA

Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl.
#1 lore raw

At Thu, 29 Dec 2011 16:12:04 +0000,

Quoted 5 lines · Fons Adriaensen

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

Quoted 42 lines
pcm_jack.c 2011-12-29 16:51:18.000000000 +0100 renamed from pcm_jack_orig.c 2011-12-29 16:42:07.000000000 +0100 +5 -4
@@ -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,

Signature · 8 lines
FA

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

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel