ucm: change msleep to usleep
PATCH 1/1 ucm: change msleep to usleep
In file src/ucm/parser.c:
if (strcmp(cmd, "usleep") == 0) {string usleep' is compared, however, in the comment and example conf file, msleep' is used, it's better to unify them all.
--- src/ucm/parser.c | 8 ++++---- test/ucm/TestHDA/TestHDA.conf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
src/ucm/parser.c +4 -4
@@ -792,7 +792,7 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* EnableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ]
@@ -800,14 +800,14 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* DisableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ] * * # Optional transition verb * TransitionSequence."ToCaseName" [ -* msleep 1 +* usleep 1 * ] * * # Optional TQ and ALSA PCMs
@@ -1106,7 +1106,7 @@ static int parse_controls(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)* cset "name='Master Mono Playback Volume',index=1 0" * cset "name='PCM Switch',index=2 1,1" * exec "some binary here" -* msleep 50 +* usleep 50 * ........ * ] *
test/ucm/TestHDA/TestHDA.conf +1 -1
@@ -7,7 +7,7 @@ SectionUseCase."Case1" { SectionDefaults [ exec "my prg" - msleep 1 + usleep 1 cdev "hw:0" cset "name='PCM Playback Volume' 50%" ]
At Fri, 19 Aug 2011 15:22:17 +0800,
Quoted 5 lines · Lu Guanqun
In file
src/ucm/parser.c:if (strcmp(cmd, "usleep") == 0) {string
usleep' is compared, however, in the comment and example conf file,msleep' is used, it's better to unify them all.
Don't we scale the value appropriately (although it's just a demo)?
Takashi
Quoted 60 lines
Signed-off-by Lu Guanqun <[email protected]>--- src/ucm/parser.c | 8 ++++---- test/ucm/TestHDA/TestHDA.conf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)src/ucm/parser.c +4
-4@@ -792,7 +792,7 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* EnableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ] @@ -800,14 +800,14 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* DisableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ] * * # Optional transition verb * TransitionSequence."ToCaseName" [ -* msleep 1 +* usleep 1 * ] * * # Optional TQ and ALSA PCMs @@ -1106,7 +1106,7 @@ static int parse_controls(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)* cset "name='Master Mono Playback Volume',index=1 0" * cset "name='PCM Switch',index=2 1,1" * exec "some binary here" -* msleep 50 +* usleep 50 * ........ * ] * test/ucm/TestHDA/TestHDA.conf +1
-1@@ -7,7 +7,7 @@ SectionUseCase."Case1" { SectionDefaults [ exec "my prg" - msleep 1 + usleep 1 cdev "hw:0" cset "name='PCM Playback Volume' 50%" ]
Hi Takashi,
Quoted 9 lines · Takashi Iwai
At Fri, 19 Aug 2011 15:22:17 +0800,
Quoted 5 lines · Lu Guanqun
In file
src/ucm/parser.c:if (strcmp(cmd, "usleep") == 0) {string
usleep' is compared, however, in the comment and example conf file,msleep' is used, it's better to unify them all.Don't we scale the value appropriately (although it's just a demo)?
No.
This is where the value gets set in src/ucm/parser.c:
if (strcmp(cmd, "usleep") == 0) {
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
err = snd_config_get_integer(n, &curr->data.sleep);
if (err < 0) {
uc_error("error: usleep requires integer!");
return err;
}
continue;
} This is where it gets used in src/ucm/main.c:
case SEQUENCE_ELEMENT_TYPE_SLEEP: usleep(s->data.sleep); break;
I don't see it gets scaled somewhere...
I agree it's a demo, but as the documentation for UCM is very limited, the wrong variable will get users into confusion.
Quoted 64 lines
Takashi
Quoted 60 lines
Signed-off-by Lu Guanqun <[email protected]>--- src/ucm/parser.c | 8 ++++---- test/ucm/TestHDA/TestHDA.conf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)src/ucm/parser.c +4
-4@@ -792,7 +792,7 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* EnableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ] @@ -800,14 +800,14 @@ static int parse_modifier_name(snd_use_case_mgr_t *uc_mgr,* DisableSequence [ * cset "name='Master Playback Switch',index=2 0,0" * cset "name='Master Playback Volume',index=2 25,25" -* msleep 50 +* usleep 50 * cset "name='Master Playback Switch',index=2 1,1" * cset "name='Master Playback Volume',index=2 50,50" * ] * * # Optional transition verb * TransitionSequence."ToCaseName" [ -* msleep 1 +* usleep 1 * ] * * # Optional TQ and ALSA PCMs @@ -1106,7 +1106,7 @@ static int parse_controls(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)* cset "name='Master Mono Playback Volume',index=1 0" * cset "name='PCM Switch',index=2 1,1" * exec "some binary here" -* msleep 50 +* usleep 50 * ........ * ] * test/ucm/TestHDA/TestHDA.conf +1
-1@@ -7,7 +7,7 @@ SectionUseCase."Case1" { SectionDefaults [ exec "my prg" - msleep 1 + usleep 1 cdev "hw:0" cset "name='PCM Playback Volume' 50%" ]
Signature · 1 line
guanqun
At Fri, 19 Aug 2011 16:13:06 +0800,
Quoted 7 lines · Lu Guanqun
Hi Takashi,
Quoted 3 lines · Takashi Iwai
At Fri, 19 Aug 2011 15:22:17 +0800,
Quoted 1 line · Lu Guanqun
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
In file
src/ucm/parser.c:if (strcmp(cmd, "usleep") == 0) {string
usleep' is compared, however, in the comment and example conf file,msleep' is used, it's better to unify them all.Don't we scale the value appropriately (although it's just a demo)?
No.
Then taking over the value as is doesn't look correct.
Takashi
Quoted 10 lines · Takashi Iwai
At Fri, 19 Aug 2011 15:22:17 +0800,
Quoted 5 lines · Lu Guanqun
In file
src/ucm/parser.c:if (strcmp(cmd, "usleep") == 0) {string
usleep' is compared, however, in the comment and example conf file,msleep' is used, it's better to unify them all.Don't we scale the value appropriately (although it's just a demo)?
msleep is more useful here for pop prevention, but I suppose usleep could be useful too.
Could you redo to support both usleep and msleep ?
Thanks
Liam
PATCH 1/1 ucm: add another sequence 'msleep'
Thus, we have two sleep statements:
msleep <milliseconds>
usleep <microseconds>
--- src/ucm/parser.c | 11 +++++++++++ src/ucm/ucm_local.h | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)
src/ucm/parser.c +11 -0
@@ -316,6 +316,17 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,continue ; } +if (strcmp (cmd,"msleep" ) ==0 ) { + curr->type =SEQUENCE_ELEMENT_TYPE_SLEEP ; + err =snd_config_get_integer (n, &curr->data.sleep); +if (err <0 ) { +uc_error ("error: msleep requires integer!" ); +return err; + } + curr->data.sleep *=1000L ; +continue ; + } +if (strcmp (cmd,"exec" ) ==0 ) { curr->type =SEQUENCE_ELEMENT_TYPE_EXEC ; err =parse_string (n, &curr->data.exec);
src/ucm/ucm_local.h +1 -1
@@ -57,7 +57,7 @@ struct sequence_element {struct list_head list;unsigned int type;union { -long sleep;/* Sleep time in msecs if sleep element, else 0 */ +long sleep;/* Sleep time in macroseconds if sleep element, else 0 */ char *cdev;char *cset;char *exec;
PATCH v2 1/1 ucm: add another sequence 'msleep'
Thus, we have two sleep statements:
msleep <milliseconds>
usleep <microseconds>
--- src/ucm/parser.c | 11 +++++++++++ src/ucm/ucm_local.h | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)
src/ucm/parser.c +11 -0
@@ -316,6 +316,17 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,continue ; } +if (strcmp (cmd,"msleep" ) ==0 ) { + curr->type =SEQUENCE_ELEMENT_TYPE_SLEEP ; + err =snd_config_get_integer (n, &curr->data.sleep); +if (err <0 ) { +uc_error ("error: msleep requires integer!" ); +return err; + } + curr->data.sleep *=1000L ; +continue ; + } +if (strcmp (cmd,"exec" ) ==0 ) { curr->type =SEQUENCE_ELEMENT_TYPE_EXEC ; err =parse_string (n, &curr->data.exec);
src/ucm/ucm_local.h +1 -1
@@ -57,7 +57,7 @@ struct sequence_element {struct list_head list;unsigned int type;union { -long sleep;/* Sleep time in msecs if sleep element, else 0 */ +long sleep;/* Sleep time in microseconds if sleep element, else 0 */ char *cdev;char *cset;char *exec;
Re: [PATCH v2] ucm: add another sequence 'msleep'
Quoted 38 lines · Lu Guanqun
Thus, we have two sleep statements:
msleep <milliseconds>
usleep <microseconds>Signed-off-by Lu Guanqun <[email protected]>--- src/ucm/parser.c | 11 +++++++++++ src/ucm/ucm_local.h | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)src/ucm/parser.c +11
-0@@ -316,6 +316,17 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,continue ; } +if (strcmp (cmd,"msleep" ) ==0 ) { + curr->type =SEQUENCE_ELEMENT_TYPE_SLEEP ; + err =snd_config_get_integer (n, &curr->data.sleep); +if (err <0 ) { +uc_error ("error: msleep requires integer!" ); +return err; + } + curr->data.sleep *=1000L ; +continue ; + } +if (strcmp (cmd,"exec" ) ==0 ) { curr->type =SEQUENCE_ELEMENT_TYPE_EXEC ; err =parse_string (n, &curr->data.exec);src/ucm/ucm_local.h +0
-0
src/ucm/ucm_local.h struct sequence_element { · line 63
Quoted 8 lines
src/ucm/ucm_local.h +1
-1@@ -57,7 +57,7 @@ struct sequence_element {struct list_head list;unsigned int type;union { -long sleep;/* Sleep time in msecs if sleep element, else 0 */ +long sleep;/* Sleep time in microseconds if sleep element, else 0 */ char *cdev;char *cset;char *exec;
Re: [PATCH v2] ucm: add another sequence 'msleep'
At Mon, 22 Aug 2011 11:39:28 +0100,
Quoted 42 lines · Liam Girdwood
Quoted 40 lines · Lu Guanqun
Thus, we have two sleep statements:
msleep <milliseconds>
usleep <microseconds>Signed-off-by Lu Guanqun <[email protected]>--- src/ucm/parser.c | 11 +++++++++++ src/ucm/ucm_local.h | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)src/ucm/parser.c +11
-0@@ -316,6 +316,17 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,continue ; } +if (strcmp (cmd,"msleep" ) ==0 ) { + curr->type =SEQUENCE_ELEMENT_TYPE_SLEEP ; + err =snd_config_get_integer (n, &curr->data.sleep); +if (err <0 ) { +uc_error ("error: msleep requires integer!" ); +return err; + } + curr->data.sleep *=1000L ; +continue ; + } +if (strcmp (cmd,"exec" ) ==0 ) { curr->type =SEQUENCE_ELEMENT_TYPE_EXEC ; err =parse_string (n, &curr->data.exec);src/ucm/ucm_local.h +0
-0@@ -57,7 +57,7 @@ struct sequence_element {struct list_head list;unsigned int type;union {
Quoted 8 lines
src/ucm/ucm_local.h struct sequence_element { · line 63
Quoted 6 lines
src/ucm/ucm_local.h +1
-1-long sleep;/* Sleep time in msecs if sleep element, else 0 */ +long sleep;/* Sleep time in microseconds if sleep element, else 0 */ char *cdev;char *cset;char *exec;Acked-by Liam Girdwood <[email protected]>
Applied now. Thanks.
Takashi