mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +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;
|
||||
snd_mixer_selem_channel_id_t chn;
|
||||
unsigned int channels = ~0U;
|
||||
unsigned int dir = 3;
|
||||
unsigned int dir = 3, okflag = 3;
|
||||
long pmin, pmax, cmin, cmax;
|
||||
snd_mixer_t *handle;
|
||||
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")) {
|
||||
/* nothing */
|
||||
} 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)) {
|
||||
|
@ -1317,10 +1314,19 @@ static int sset(unsigned int argc, char *argv[], int roflag)
|
|||
/* nothing */
|
||||
} else {
|
||||
error("Unknown capture setup '%s'..\n", ptr);
|
||||
okflag &= ~2;
|
||||
snd_mixer_close(handle);
|
||||
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)
|
||||
ptr = optr;
|
||||
firstchn = 0;
|
||||
|
|
Loading…
Reference in a new issue