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