Lines Matching refs:card
39 struct card { struct
78 static void card_free(struct card **card) in card_free() argument
80 struct card *c = *card; in card_free()
87 *card = NULL; in card_free()
90 static void add_card(struct card ***cards, int *count, const char *cardname) in add_card()
92 struct card *card, **cc; in add_card() local
107 card = calloc(1, sizeof(*card)); in add_card()
108 if (card == NULL) in add_card()
110 card->index = index; in add_card()
112 if (snd_ctl_open(&card->handle, device, SND_CTL_READONLY|SND_CTL_NONBLOCK) < 0) { in add_card()
113 card_free(&card); in add_card()
116 card->pfds = snd_ctl_poll_descriptors_count(card->handle); in add_card()
117 if (card->pfds < 0) { in add_card()
118 card_free(&card); in add_card()
121 if (snd_ctl_subscribe_events(card->handle, 1) < 0) { in add_card()
122 card_free(&card); in add_card()
126 (*cards)[findex] = card; in add_card()
130 card_free(&card); in add_card()
133 cc[*count] = card; in add_card()
139 static void add_cards(struct card ***cards, int *count) in add_cards()
141 int card = -1; in add_cards() local
145 if (snd_card_next(&card) < 0) in add_cards()
147 if (card < 0) in add_cards()
149 if (card >= 0) { in add_cards()
150 sprintf(cardname, "%i", card); in add_cards()
217 static int check_lists(struct card *card, snd_ctl_elem_id_t *id) in check_lists() argument
222 if (in_list(&card->blacklist, id)) in check_lists()
224 if (in_list(&card->whitelist, id)) in check_lists()
227 if (snd_ctl_elem_info(card->handle, info) < 0) in check_lists()
231 add_to_list(&card->whitelist, id); in check_lists()
234 add_to_list(&card->blacklist, id); in check_lists()
239 static int card_events(struct card *card) in card_events() argument
249 while (snd_ctl_read(card->handle, ev) == 1) { in card_events()
256 remove_from_list(&card->whitelist, id); in card_events()
257 remove_from_list(&card->blacklist, id); in card_events()
261 remove_from_list(&card->whitelist, id); in card_events()
262 remove_from_list(&card->blacklist, id); in card_events()
267 if (check_lists(card, id)) in card_events()
365 struct card **cards = NULL; in state_daemon()