All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fons Adriaensen <fons@linuxaudio.org>
To: alsa-devel@alsa-project.org
Subject: patch for jack plugin
Date: Thu, 29 Dec 2011 16:12:04 +0000	[thread overview]
Message-ID: <20111229161204.GB22822@linuxaudio.org> (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_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.

             reply	other threads:[~2011-12-29 16:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 16:12 Fons Adriaensen [this message]
2012-01-09 17:19 ` patch for jack plugin Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111229161204.GB22822@linuxaudio.org \
    --to=fons@linuxaudio.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.