mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:35:43 +01:00
Added more better error fault handling for sset toggle
This commit is contained in:
parent
72a72ad7fe
commit
7876ddd70e
1 changed files with 10 additions and 4 deletions
|
@ -1168,7 +1168,7 @@ static int sset(unsigned int argc, char *argv[], int roflag)
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
snd_mixer_selem_channel_id_t chn;
|
snd_mixer_selem_channel_id_t chn;
|
||||||
unsigned int channels = ~0U;
|
unsigned int channels = ~0U;
|
||||||
unsigned int dir = 3;
|
unsigned int dir = 3, okflag = 3;
|
||||||
long pmin, pmax, cmin, cmax;
|
long pmin, pmax, cmin, cmax;
|
||||||
snd_mixer_t *handle;
|
snd_mixer_t *handle;
|
||||||
snd_mixer_elem_t *elem;
|
snd_mixer_elem_t *elem;
|
||||||
|
@ -1278,9 +1278,6 @@ static int sset(unsigned int argc, char *argv[], int roflag)
|
||||||
simple_skip_word(&ptr, "nocap") || simple_skip_word(&ptr, "norec")) {
|
simple_skip_word(&ptr, "nocap") || simple_skip_word(&ptr, "norec")) {
|
||||||
/* nothing */
|
/* nothing */
|
||||||
} else {
|
} else {
|
||||||
error("Unknown playback setup '%s'..\n", ptr);
|
|
||||||
snd_mixer_close(handle);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((dir & 2) && snd_mixer_selem_has_capture_channel(elem, chn)) {
|
if ((dir & 2) && snd_mixer_selem_has_capture_channel(elem, chn)) {
|
||||||
|
@ -1317,10 +1314,19 @@ static int sset(unsigned int argc, char *argv[], int roflag)
|
||||||
/* nothing */
|
/* nothing */
|
||||||
} else {
|
} else {
|
||||||
error("Unknown capture setup '%s'..\n", ptr);
|
error("Unknown capture setup '%s'..\n", ptr);
|
||||||
|
okflag &= ~2;
|
||||||
snd_mixer_close(handle);
|
snd_mixer_close(handle);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (okflag == 0) {
|
||||||
|
if (dir & 1)
|
||||||
|
error("Unknown playback setup '%s'..\n", ptr);
|
||||||
|
if (dir & 2)
|
||||||
|
error("Unknown capture setup '%s'..\n", ptr);
|
||||||
|
snd_mixer_close(handle);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
if (!multi)
|
if (!multi)
|
||||||
ptr = optr;
|
ptr = optr;
|
||||||
firstchn = 0;
|
firstchn = 0;
|
||||||
|
|
Loading…
Reference in a new issue