mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-14 04:55:41 +01:00
Fixed thinkos (power on, power off)
This commit is contained in:
parent
191da60508
commit
c72696ff39
1 changed files with 7 additions and 3 deletions
|
@ -1049,9 +1049,13 @@ static int load_state(char *file, const char *cardname)
|
||||||
|
|
||||||
static int get_int_state(const char *str)
|
static int get_int_state(const char *str)
|
||||||
{
|
{
|
||||||
|
if (!strcasecmp(str, "on"))
|
||||||
|
return SND_CTL_POWER_D0;
|
||||||
|
if (!strcasecmp(str, "off"))
|
||||||
|
return SND_CTL_POWER_D3hot;
|
||||||
if (*str == 'D' || *str == 'd') {
|
if (*str == 'D' || *str == 'd') {
|
||||||
str++;
|
str++;
|
||||||
if (!strcmp(str, "0") || !strcmp(str, "on"))
|
if (!strcmp(str, "0"))
|
||||||
return SND_CTL_POWER_D0;
|
return SND_CTL_POWER_D0;
|
||||||
if (!strcmp(str, "1"))
|
if (!strcmp(str, "1"))
|
||||||
return SND_CTL_POWER_D1;
|
return SND_CTL_POWER_D1;
|
||||||
|
@ -1059,7 +1063,7 @@ static int get_int_state(const char *str)
|
||||||
return SND_CTL_POWER_D2;
|
return SND_CTL_POWER_D2;
|
||||||
if (!strcmp(str, "3"))
|
if (!strcmp(str, "3"))
|
||||||
return SND_CTL_POWER_D3;
|
return SND_CTL_POWER_D3;
|
||||||
if (!strcmp(str, "3hot") || !strcmp(str, "off"))
|
if (!strcmp(str, "3hot"))
|
||||||
return SND_CTL_POWER_D3hot;
|
return SND_CTL_POWER_D3hot;
|
||||||
if (!strcmp(str, "3cold"))
|
if (!strcmp(str, "3cold"))
|
||||||
return SND_CTL_POWER_D3cold;
|
return SND_CTL_POWER_D3cold;
|
||||||
|
@ -1167,7 +1171,7 @@ static int power(const char *argv[], int argc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
power_state = get_int_state(argv[0]);
|
power_state = get_int_state(argv[0]);
|
||||||
if (power_state > 0) {
|
if (power_state >= 0) {
|
||||||
int card, first = 1;
|
int card, first = 1;
|
||||||
|
|
||||||
card = -1;
|
card = -1;
|
||||||
|
|
Loading…
Reference in a new issue