mirror of https://github.com/ericonr/sndio.git
sioctl_sun.c: If no "xxx.mute" control is found, try "xxx_mute"
This commit is contained in:
parent
5750e312db
commit
8d24dd3ef8
|
@ -84,14 +84,24 @@ static int
|
|||
initmute(struct sioctl_sun_hdl *hdl, struct mixer_devinfo *info)
|
||||
{
|
||||
struct mixer_devinfo mi;
|
||||
char name[MAX_AUDIO_DEV_LEN];
|
||||
|
||||
mi.index = info->next;
|
||||
for (mi.index = info->next; mi.index != -1; mi.index = mi.next) {
|
||||
if (ioctl(hdl->fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
|
||||
break;
|
||||
if (strcmp(mi.label.name, AudioNmute) == 0)
|
||||
return mi.index;
|
||||
}
|
||||
|
||||
/* try "_mute" suffix */
|
||||
snprintf(name, sizeof(name), "%s_mute", info->label.name);
|
||||
for (mi.index = 0; ; mi.index++) {
|
||||
if (ioctl(hdl->fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
|
||||
break;
|
||||
if (info->mixer_class == mi.mixer_class &&
|
||||
strcmp(mi.label.name, name) == 0)
|
||||
return mi.index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue