aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbmixer.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-04-22 09:49:52 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:05:11 -0400
commit8e062ec7108f8a91149e6bccddc3b7341e406274 (patch)
treeda052b40bcc2cbc7480a9999360f20c2a63c640d /sound/usb/usbmixer.c
parent08fe15899df9696a6d34abf96230ae0691f5de66 (diff)
[ALSA] usb-audio - add selector unit names override for Audigy 2 NX
USB generic driver Add a mechanism to specify source names of selector units, and add such names for the SB Audigy 2 NX. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbmixer.c')
-rw-r--r--sound/usb/usbmixer.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 5f1906915aa6..6ad154aaba1b 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -70,6 +70,7 @@ struct usb_mixer_build {
70 DECLARE_BITMAP(unitbitmap, 32*32); 70 DECLARE_BITMAP(unitbitmap, 32*32);
71 usb_audio_term_t oterm; 71 usb_audio_term_t oterm;
72 const struct usbmix_name_map *map; 72 const struct usbmix_name_map *map;
73 const struct usbmix_selector_map *selector_map;
73}; 74};
74 75
75struct usb_mixer_elem_info { 76struct usb_mixer_elem_info {
@@ -187,6 +188,21 @@ static int check_ignored_ctl(mixer_build_t *state, int unitid, int control)
187 return 0; 188 return 0;
188} 189}
189 190
191/* get the mapped selector source name */
192static int check_mapped_selector_name(mixer_build_t *state, int unitid,
193 int index, char *buf, int buflen)
194{
195 const struct usbmix_selector_map *p;
196
197 if (! state->selector_map)
198 return 0;
199 for (p = state->selector_map; p->id; p++) {
200 if (p->id == unitid && index < p->count)
201 return strlcpy(buf, p->names[index], buflen);
202 }
203 return 0;
204}
205
190/* 206/*
191 * find an audio control unit with the given unit id 207 * find an audio control unit with the given unit id
192 */ 208 */
@@ -1415,7 +1431,9 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
1415 kfree(cval); 1431 kfree(cval);
1416 return -ENOMEM; 1432 return -ENOMEM;
1417 } 1433 }
1418 if (check_input_term(state, desc[5 + i], &iterm) >= 0) 1434 len = check_mapped_selector_name(state, unitid, i, namelist[i],
1435 MAX_ITEM_NAME_LEN);
1436 if (! len && check_input_term(state, desc[5 + i], &iterm) >= 0)
1419 len = get_term_name(state, &iterm, namelist[i], MAX_ITEM_NAME_LEN, 0); 1437 len = get_term_name(state, &iterm, namelist[i], MAX_ITEM_NAME_LEN, 0);
1420 if (! len) 1438 if (! len)
1421 sprintf(namelist[i], "Input %d", i); 1439 sprintf(namelist[i], "Input %d", i);
@@ -1521,6 +1539,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
1521 for (map = usbmix_ctl_maps; map->vendor; map++) { 1539 for (map = usbmix_ctl_maps; map->vendor; map++) {
1522 if (map->vendor == state.vendor && map->product == state.product) { 1540 if (map->vendor == state.vendor && map->product == state.product) {
1523 state.map = map->map; 1541 state.map = map->map;
1542 state.selector_map = map->selector_map;
1524 chip->ignore_ctl_error = map->ignore_ctl_error; 1543 chip->ignore_ctl_error = map->ignore_ctl_error;
1525 break; 1544 break;
1526 } 1545 }