aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'mixer.c')
-rw-r--r--mixer.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mixer.c b/mixer.c
index 4568cca..8a0add0 100644
--- a/mixer.c
+++ b/mixer.c
@@ -495,3 +495,35 @@ int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string)
495 return -EINVAL; 495 return -EINVAL;
496} 496}
497 497
498#ifdef OMAP_ENHANCEMENT
499int mixer_get_card_name(int card, char *str, size_t strlen)
500{
501 struct snd_ctl_card_info info;
502 char fn[256];
503 int fd;
504 int ret;
505
506 if (card > MAX_CARD_COUNT)
507 return -EINVAL;
508
509 if (!str)
510 return -EINVAL;
511
512 snprintf(fn, sizeof(fn), "/dev/snd/controlC%u", card);
513 fd = open(fn, O_RDWR);
514 if (fd < 0)
515 return -ENODEV;
516
517 ret = ioctl(fd, SNDRV_CTL_IOCTL_CARD_INFO, &info);
518 if (ret < 0) {
519 close(fd);
520 return ret;
521 }
522
523 strncpy(str, (char *)info.id, strlen);
524
525 close(fd);
526
527 return 0;
528}
529#endif