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

From: Clemens Ladisch <clemens@email-addr-hidden>
Date: Tue Jan 29 2013 - 10:39:31 EET

Muffinman wrote:
> I'm trying to poll mixer events in Alsa using C. I've used the following
> functions within an infinite while loop:
> ...
> snd_hctl_poll_descriptors(hctl, poll_fds, 1);

You are supposed to call snd_hctl_poll_descriptors_count() to get the
number of descriptors.

> if (poll_fds[0].revents & POLLIN)

You are supposed to call snd_hctl_poll_descriptors_revents() to get the
events from the descriptors.

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

You should call snd_hctl_handle_events() to read all the events.

> However, calling snd_hctl_handle_events here never returns
> and I can't quite figure out why.

See amixer/amixer.c in the alsa-utils package for an example.

"amixer events" is undocumented for some reason; but does it work?

Regards,
Clemens
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Jan 29 12:15:02 2013

This archive was generated by hypermail 2.1.8 : Tue Jan 29 2013 - 12:15:02 EET