]> git.alsa-project.org Git - alsa-utils.git/commitdiff
More generic support for poll descriptors
authorAbramo Bagnara <abramo@alsa-project.org>
Mon, 12 Feb 2001 23:51:53 +0000 (23:51 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Mon, 12 Feb 2001 23:51:53 +0000 (23:51 +0000)
amixer/amixer.c
seq/aseqnet/aseqnet.c

index 7934223ff1977a0b6ac9bb673fc99b3dee25be49..2a651167e306dccf36b4974b9aac4563274ab002 100644 (file)
@@ -1041,12 +1041,8 @@ static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
        }
        printf("Ready to listen...\n");
        while (1) {
-               struct pollfd ctl_poll;
-               int res;
-               ctl_poll.fd = snd_hctl_poll_descriptor(handle);
-               ctl_poll.events = POLLIN;
-               ctl_poll.revents = 0;
-               if ((res = poll(&ctl_poll, 1, -1)) > 0) {
+               int res = snd_hctl_wait(handle, -1);
+               if (res >= 0) {
                        printf("Poll ok: %i\n", res);
                        res = snd_hctl_handle_events(handle);
                        assert(res > 0);
@@ -1152,13 +1148,9 @@ static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
 
        printf("Ready to listen...\n");
        while (1) {
-               struct pollfd mixer_poll;
                int res;
-               mixer_poll.fd = snd_mixer_poll_descriptor(handle, card);
-               assert(mixer_poll.fd >= 0);
-               mixer_poll.events = POLLIN;
-               mixer_poll.revents = 0;
-               if ((res = poll(&mixer_poll, 1, -1)) > 0) {
+               res = snd_mixer_wait(handle, -1);
+               if (res >= 0) {
                        printf("Poll ok: %i\n", res);
                        res = snd_mixer_handle_events(handle);
                        assert(res >= 0);
index f4a4b4b7bf61741f708c43f3cf7f411667c50781..061946afd667a4584699abb56f7bd31c5823e5d6 100644 (file)
@@ -232,12 +232,17 @@ static void close_files(void)
 static void init_seq(char *source, char *dest)
 {
        snd_seq_addr_t addr;
+       int err;
+       struct pollfd pfd;
 
        if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
                perror("snd_seq_open");
                exit(1);
        }
-       seqfd = snd_seq_poll_descriptor(handle);
+       err = snd_seq_poll_descriptors(handle, &pfd, 1);
+       assert(err == 1);
+       seqfd = pfd.fd;
+
        snd_seq_nonblock(handle, 0);
 
        /* set client info */