From b3fb514e0425d08aa0c6c747f36942b7899bab9b Mon Sep 17 00:00:00 2001 From: Fons Adriaensen Date: Mon, 9 Jan 2012 18:18:10 +0100 Subject: [PATCH] jack: Fix revents for playback 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. Signed-off-by: Takashi Iwai --- jack/pcm_jack.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index eb3359c..c51fe84 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -77,7 +77,7 @@ static int snd_pcm_jack_close(snd_pcm_ioplug_t *io) 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) { @@ -87,7 +87,9 @@ static int snd_pcm_jack_poll_revents(snd_pcm_ioplug_t *io ATTRIBUTE_UNUSED, 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; } -- 2.47.1