[LAD] Alsa: poll mixer events, always returns true in subsequent calls

Muffinman news at koster.tk
Mon Jan 28 22:19:00 UTC 2013


Hello,

I'm trying to poll mixer events in Alsa using C. I've used the following
functions within an infinite while loop:

if (snd_hctl_wait(hctl,-1))
{
...
}

###### and

snd_hctl_poll_descriptors(hctl, poll_fds, 1);
err = poll (poll_fds, 1, -1);
if (poll_fds[0].revents & POLLIN)
{
...
}

While I can get the first mixer event fine, in all subsequent rounds,
both snd_hctl_wait and poll always return immediately.

With the snd_mixer functions one has to call snd_mixer_handle_events to
clear events. However, calling snd_hctl_handle_events here never returns
and I can't quite figure out why. Nonetheless, I'm not even sure that's
the key to my solution.

Can anyone give me some advice on how to get this working?

Kind regards, Maarten


More information about the Linux-audio-dev mailing list