All of lore.kernel.org
 help / color / mirror / Atom feed
* UCM list/set/get
@ 2011-01-28 17:36 pl bossart
  2011-01-31 11:22 ` Mark Brown
  0 siblings, 1 reply; 11+ messages in thread
From: pl bossart @ 2011-01-28 17:36 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2246 bytes --]

I've been trying to figure out what exactly needs to be filled in UCM
configuration files, and so far it's been a pretty frustrating
experience with alsa-utils/alsaucm :-(

The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
of segfaults and bad output (patches attached), but so far the only
thing I can do is list the verbs...It looks like
alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
whenever I query with predefined identifiers alsaucm seg faults or
provides an error message that doesn't help much. This happens with
the latest code.

[ume@plb alsaucm]$ ./alsaucm listcards
  0: AudioPC
    this is my AudioPCI card
  1: SDP4430
    this is my SDP4430 card
  2: TestHDA
    A test HDA card
[ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
  0: HiFi
    Play and record HiFi quality Music.
  1: Voice
    Full duplex low-power voice call

So far so good. Now the fun begins

[ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
./alsaucm: error failed to get list _devices: No such file or directory
[ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
use case: HiFi
./alsaucm: error failed to set _verb=HiFi: No such device
[ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
./alsaucm: error failed to get _verb: No such file or directory

Likewise if the .conf file contains a cset in the default values, then
the parser fails (I took the example from src/ucm/parser.c).
Commenting out the cset is the only solution. What exactly is this
index supposed to mean?
SectionDefaults [
cdev "hw:AudioPCI"
cset "name='Master Playback Switch',index=2 1,1"
]

[ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
ALSA lib main.c:302:(import_master_config) Unable to execute default sequence
ALSA lib main.c:637:(snd_use_case_mgr_open) error: failed to import
AudioPCI use case configuration -19
./alsaucm: error failed to open sound card AudioPCI: No such device

Ideally I'd like to write an interface between PulseAudio and UCM,
there are existing modules I can reuse to set voice or hifi modes,
depending on what the client roles are. But if I can't make the
examples work I don't think this is going to go anywhere.
-Pierre

[-- Attachment #2: 0001-ucm-make-verb-comments-optional.patch --]
[-- Type: application/octet-stream, Size: 1270 bytes --]

From dbd97f43a5bacf40424a986556e553267b0afdb2 Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Date: Thu, 27 Jan 2011 23:17:43 -0600
Subject: [PATCH] ucm: make verb comments optional

avoid seg fault if no comment is provided

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
---
 src/ucm/parser.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/ucm/parser.c b/src/ucm/parser.c
index f3a75e6..560c224 100644
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -777,12 +777,17 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
 	INIT_LIST_HEAD(&verb->modifier_list);
 	INIT_LIST_HEAD(&verb->value_list);
 	list_add_tail(&verb->list, &uc_mgr->verb_list);
+        if (use_case_name == NULL )
+                return -EINVAL;
 	verb->name = strdup(use_case_name);
 	if (verb->name == NULL)
 		return -ENOMEM;
-	verb->comment = strdup(comment);
-	if (verb->comment == NULL)
-		return -ENOMEM;
+
+        if (comment != NULL) {
+                verb->comment = strdup(comment);
+                if (verb->comment == NULL)
+                        return -ENOMEM;
+        }
 
 	/* open Verb file for reading */
 	snprintf(filename, sizeof(filename), "%s/%s/%s",
-- 
1.7.3.2


[-- Attachment #3: 0001-alsaucm-fix-list-command-and-output.patch --]
[-- Type: application/octet-stream, Size: 1353 bytes --]

From f42f607972f59ccbd8bd67037b422db48a828c3c Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Date: Thu, 27 Jan 2011 23:14:44 -0600
Subject: [PATCH] alsaucm: fix list command and output

add one argument to list to avoid error message, do not list
comments as verbs

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
---
 alsaucm/usecase.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c
index bb894c6..8a255ba 100644
--- a/alsaucm/usecase.c
+++ b/alsaucm/usecase.c
@@ -85,7 +85,7 @@ static struct cmd cmds[] = {
 	{ OM_RESET, 0, 1, "reset" },
 	{ OM_RELOAD, 0, 1, "reload" },
 	{ OM_LISTCARDS, 0, 0, "listcards" },
-	{ OM_LIST, 0, 1, "list" },
+	{ OM_LIST, 1, 1, "list" },
 	{ OM_SET, 2, 1, "set" },
 	{ OM_GET, 1, 1, "get" },
 	{ OM_GETI, 1, 1, "geti" },
@@ -232,8 +232,12 @@ static int do_one(struct context *context, struct cmd *cmd, char **argv)
 		}
 		if (err == 0)
 			printf("  list is empty\n");
-		for (i = 0; i < err; i++)
-			printf("  %i: %s\n", i, list[i]);
+		for (i = 0; i < err / 2; i++) {
+			printf("  %i: %s\n", i, list[i*2]);
+                        if (list[i*2+1])
+				printf("    %s\n", list[i*2+1]);
+                }
+
 		snd_use_case_free_list(list, err);
 		break;
 	case OM_SET:
-- 
1.7.3.2


[-- Attachment #4: AudioPCI.conf --]
[-- Type: application/octet-stream, Size: 935 bytes --]

Comment "this is my AudioPCI card"

SectionUseCase."HiFi" {
 		File "hifi"
 		Comment "Play and record HiFi quality Music."
}

SectionUseCase."Voice" {
 		File "voice"
 		Comment "Full duplex low-power voice call"
}

ValueDefaults {
 	PlaybackCTL "hw:CARD=0"
 	CaptureCTL "hw:CARD=0"
}

# This file also store the default sound card state.

SectionDefaults [
cdev "hw:AudioPCI"
#cset "name='Master Playback Switch',index=2 1,1"
#cset "name='Master Playback Volume',index=2 25,25"
#cset "name='Master Mono Playback',index=1 0"
#cset "name='Master Mono Playback Volume',index=1 0"
#cset "name='PCM Switch',index=2 1,1"
#cset "name='Master Playback Switch' 1,1"
#cset "name='Master Playback Volume' 10,25"
#cset "name='Master Mono Playback Switch' 0"
#cset "name='Master Mono Playback Volume' 0"
#cset "name='PCM Switch' 1,1"
#cset "name='PCM Volume' 25,25"
#cset "name='PCM Playback Switch' 1,1"
#cset "name='PCM Capture Switch' 0,0"
]


[-- Attachment #5: hifi --]
[-- Type: application/octet-stream, Size: 1139 bytes --]

SectionVerb {
	# enable and disable sequences are compulsory
	EnableSequence [
		cdev "hw:AudioPCI"
		cset "name='Master Playback Switch',index=2 0,0"
		cset "name='Master Playback Volume',index=2 25,25"
		#msleep 50
		cset "name='Master Playback Switch',index=2 1,1"
		cset "name='Master Playback Volume',index=2 50,50"
	]

	DisableSequence [
		cdev "hw:AudioPCI"
		cset "name='Master Playback Switch',index=2 0,0"
		cset "name='Master Playback Volume',index=2 25,25"
		#msleep 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
#     ]

	# Optional TQ and ALSA PCMs
	Value {
		TQ HiFi
		CapturePCM "hw:0"
		PlaybackPCM "hw:0"
	}
}

SectionDevice."Headphones".0 {
	
	EnableSequence [
		cdev "hw:AudioPCI"
		cset "name='PCM Capture Switch' 1,1"
	]

	DisableSequence [
		cdev "hw:AudioPCI"
		cset "name='PCM Capture Switch' 0,0"
	]

	# the hardware volume controls for this device
	PlaybackVolume "name='Master Playback Volume',index=2"
	PlaybackSwitch "name='Master Playback Switch',index=2"
}


[-- Attachment #6: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-28 17:36 UCM list/set/get pl bossart
@ 2011-01-31 11:22 ` Mark Brown
  2011-01-31 13:53   ` Liam Girdwood
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2011-01-31 11:22 UTC (permalink / raw)
  To: pl bossart; +Cc: alsa-devel, lrg

On Fri, Jan 28, 2011 at 11:36:47AM -0600, pl bossart wrote:
> I've been trying to figure out what exactly needs to be filled in UCM
> configuration files, and so far it's been a pretty frustrating
> experience with alsa-utils/alsaucm :-(

CCing in Liam - please always remember to CC maintainers.

> The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
> of segfaults and bad output (patches attached), but so far the only
> thing I can do is list the verbs...It looks like
> alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
> whenever I query with predefined identifiers alsaucm seg faults or
> provides an error message that doesn't help much. This happens with
> the latest code.
> 
> [ume@plb alsaucm]$ ./alsaucm listcards
>   0: AudioPC
>     this is my AudioPCI card
>   1: SDP4430
>     this is my SDP4430 card
>   2: TestHDA
>     A test HDA card
> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>   0: HiFi
>     Play and record HiFi quality Music.
>   1: Voice
>     Full duplex low-power voice call
> 
> So far so good. Now the fun begins
> 
> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
> ./alsaucm: error failed to get list _devices: No such file or directory
> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
> ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
> use case: HiFi
> ./alsaucm: error failed to set _verb=HiFi: No such device
> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
> ./alsaucm: error failed to get _verb: No such file or directory
> 
> Likewise if the .conf file contains a cset in the default values, then
> the parser fails (I took the example from src/ucm/parser.c).
> Commenting out the cset is the only solution. What exactly is this
> index supposed to mean?
> SectionDefaults [
> cdev "hw:AudioPCI"
> cset "name='Master Playback Switch',index=2 1,1"
> ]
> 
> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
> ALSA lib main.c:302:(import_master_config) Unable to execute default sequence
> ALSA lib main.c:637:(snd_use_case_mgr_open) error: failed to import
> AudioPCI use case configuration -19
> ./alsaucm: error failed to open sound card AudioPCI: No such device
> 
> Ideally I'd like to write an interface between PulseAudio and UCM,
> there are existing modules I can reuse to set voice or hifi modes,
> depending on what the client roles are. But if I can't make the
> examples work I don't think this is going to go anywhere.

There's some existing work going on with PulseAudio/UCM integration -
Liam, I'd CC in Marga but I don't know what her new address.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 11:22 ` Mark Brown
@ 2011-01-31 13:53   ` Liam Girdwood
  2011-01-31 14:07     ` Jaroslav Kysela
  2011-01-31 23:44     ` Margarita Olaya
  0 siblings, 2 replies; 11+ messages in thread
From: Liam Girdwood @ 2011-01-31 13:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: pl bossart, alsa-devel, Margarita Olaya

On Mon, 2011-01-31 at 11:22 +0000, Mark Brown wrote:
> On Fri, Jan 28, 2011 at 11:36:47AM -0600, pl bossart wrote:
> > I've been trying to figure out what exactly needs to be filled in UCM
> > configuration files, and so far it's been a pretty frustrating
> > experience with alsa-utils/alsaucm :-(
> 
> CCing in Liam - please always remember to CC maintainers.
> 
> > The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
> > of segfaults and bad output (patches attached), but so far the only
> > thing I can do is list the verbs...It looks like
> > alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
> > whenever I query with predefined identifiers alsaucm seg faults or
> > provides an error message that doesn't help much. This happens with
> > the latest code.

> > 
> > [ume@plb alsaucm]$ ./alsaucm listcards
> >   0: AudioPC
> >     this is my AudioPCI card
> >   1: SDP4430
> >     this is my SDP4430 card
> >   2: TestHDA
> >     A test HDA card
> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
> >   0: HiFi
> >     Play and record HiFi quality Music.
> >   1: Voice
> >     Full duplex low-power voice call
> > 
> > So far so good. Now the fun begins
> > 
> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
> > ./alsaucm: error failed to get list _devices: No such file or directory
> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
> > ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
> > use case: HiFi
> > ./alsaucm: error failed to set _verb=HiFi: No such device
> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
> > ./alsaucm: error failed to get _verb: No such file or directory
> > 

It looks like we need to improve the config file error reporting here.
Adding line numbers would be good.

> > Likewise if the .conf file contains a cset in the default values, then
> > the parser fails (I took the example from src/ucm/parser.c).
> > Commenting out the cset is the only solution. What exactly is this
> > index supposed to mean?
> > SectionDefaults [
> > cdev "hw:AudioPCI"
> > cset "name='Master Playback Switch',index=2 1,1"
> > ]

Jaroslav is probably best placed to answer about the cset syntax.

The "index" is not required :-

cset "name='Master Playback Switch' 1,1"

> > 
> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
> > ALSA lib main.c:302:(import_master_config) Unable to execute default sequence
> > ALSA lib main.c:637:(snd_use_case_mgr_open) error: failed to import
> > AudioPCI use case configuration -19
> > ./alsaucm: error failed to open sound card AudioPCI: No such device
> > 
> > Ideally I'd like to write an interface between PulseAudio and UCM,
> > there are existing modules I can reuse to set voice or hifi modes,
> > depending on what the client roles are. But if I can't make the
> > examples work I don't think this is going to go anywhere.
> 
> There's some existing work going on with PulseAudio/UCM integration -
> Liam, I'd CC in Marga but I don't know what her new address.

I've CC'ed Margarita. She has started some work on PA and UCM
integration and has some code that can read in the UCM verbs.

Margarita, could you provide a link to your PA git.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 13:53   ` Liam Girdwood
@ 2011-01-31 14:07     ` Jaroslav Kysela
  2011-01-31 21:57       ` pl bossart
  2011-01-31 23:44     ` Margarita Olaya
  1 sibling, 1 reply; 11+ messages in thread
From: Jaroslav Kysela @ 2011-01-31 14:07 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: pl bossart, ALSA development, Mark Brown, Margarita Olaya

On Mon, 31 Jan 2011, Liam Girdwood wrote:

> On Mon, 2011-01-31 at 11:22 +0000, Mark Brown wrote:
>> On Fri, Jan 28, 2011 at 11:36:47AM -0600, pl bossart wrote:
>>> I've been trying to figure out what exactly needs to be filled in UCM
>>> configuration files, and so far it's been a pretty frustrating
>>> experience with alsa-utils/alsaucm :-(
>>
>> CCing in Liam - please always remember to CC maintainers.
>>
>>> The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
>>> of segfaults and bad output (patches attached), but so far the only
>>> thing I can do is list the verbs...It looks like
>>> alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
>>> whenever I query with predefined identifiers alsaucm seg faults or
>>> provides an error message that doesn't help much. This happens with
>>> the latest code.
>
>>>
>>> [ume@plb alsaucm]$ ./alsaucm listcards
>>>   0: AudioPC
>>>     this is my AudioPCI card
>>>   1: SDP4430
>>>     this is my SDP4430 card
>>>   2: TestHDA
>>>     A test HDA card
>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>>>   0: HiFi
>>>     Play and record HiFi quality Music.
>>>   1: Voice
>>>     Full duplex low-power voice call
>>>
>>> So far so good. Now the fun begins
>>>
>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
>>> ./alsaucm: error failed to get list _devices: No such file or directory
>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
>>> ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
>>> use case: HiFi
>>> ./alsaucm: error failed to set _verb=HiFi: No such device
>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
>>> ./alsaucm: error failed to get _verb: No such file or directory
>>>
>
> It looks like we need to improve the config file error reporting here.
> Adding line numbers would be good.

It looks like a processing error rather than a parsing error.

>>> Likewise if the .conf file contains a cset in the default values, then
>>> the parser fails (I took the example from src/ucm/parser.c).
>>> Commenting out the cset is the only solution. What exactly is this
>>> index supposed to mean?
>>> SectionDefaults [
>>> cdev "hw:AudioPCI"
>>> cset "name='Master Playback Switch',index=2 1,1"
>>> ]
>
> Jaroslav is probably best placed to answer about the cset syntax.
>
> The "index" is not required :-
>
> cset "name='Master Playback Switch' 1,1"

For complete cset command look to 'amixer cset' syntax. You may get list 
of available identifiers using 'amixer controls'.

Anyway, I fixed some issues in alsaucm (interactive mode) and alsa-lib 
now.

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 14:07     ` Jaroslav Kysela
@ 2011-01-31 21:57       ` pl bossart
  2011-01-31 22:40         ` Jaroslav Kysela
  0 siblings, 1 reply; 11+ messages in thread
From: pl bossart @ 2011-01-31 21:57 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Margarita Olaya, ALSA development, Mark Brown, Liam Girdwood

>> cset "name='Master Playback Switch' 1,1"
>
> For complete cset command look to 'amixer cset' syntax. You may get list of
> available identifiers using 'amixer controls'.

Thanks Jaroslav. I had not connected the dots with amixer. Works fine
now for the defaults. I am still not able to get/set a verb

$ ./alsaucm -c TestHDA get _verb
sh: my: command not found
./alsaucm: error failed to get _verb: No such file or directory

same for set. Isn't _verb a know identifier in src/ucm/main.c?

Thanks,
-Pierre

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 21:57       ` pl bossart
@ 2011-01-31 22:40         ` Jaroslav Kysela
  0 siblings, 0 replies; 11+ messages in thread
From: Jaroslav Kysela @ 2011-01-31 22:40 UTC (permalink / raw)
  To: pl bossart; +Cc: Margarita Olaya, ALSA development, Mark Brown, Liam Girdwood

On Mon, 31 Jan 2011, pl bossart wrote:

>>> cset "name='Master Playback Switch' 1,1"
>>
>> For complete cset command look to 'amixer cset' syntax. You may get list of
>> available identifiers using 'amixer controls'.
>
> Thanks Jaroslav. I had not connected the dots with amixer. Works fine
> now for the defaults. I am still not able to get/set a verb
>
> $ ./alsaucm -c TestHDA get _verb
> sh: my: command not found
> ./alsaucm: error failed to get _verb: No such file or directory

No verb is active here, so the error code is correct. In this state, you 
can just list available verbs or devices and set one. The command to list 
devices for TestHDA case is:

list _devices/Case1

> same for set. Isn't _verb a know identifier in src/ucm/main.c?

This works for me:

ALSA_CONFIG_UCM="$HOME/alsa/alsa-lib/test/ucm" ./alsaucm open TestHDA \
set _verb Case1 get _verb set _enadev Device1.0 list _devices

You may split commands to the interactive mode or you may use a batch file 
and run:

ALSA_CONFIG_UCM="$HOME/alsa/alsa-lib/test/ucm" ./alsaucm -b test.batch

test.batch file contents:

open TestHDA
set _verb Case1
get _verb
set _enadev Device1.0
list _devices

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 13:53   ` Liam Girdwood
  2011-01-31 14:07     ` Jaroslav Kysela
@ 2011-01-31 23:44     ` Margarita Olaya
  2011-02-02  8:11       ` Jaroslav Kysela
  1 sibling, 1 reply; 11+ messages in thread
From: Margarita Olaya @ 2011-01-31 23:44 UTC (permalink / raw)
  To: Liam Girdwood, pl bossart; +Cc: alsa-devel, Mark Brown

On Mon, Jan 31, 2011 at 7:53 AM, Liam Girdwood <lrg@slimlogic.co.uk> wrote:
> On Mon, 2011-01-31 at 11:22 +0000, Mark Brown wrote:
>> On Fri, Jan 28, 2011 at 11:36:47AM -0600, pl bossart wrote:
>> > I've been trying to figure out what exactly needs to be filled in UCM
>> > configuration files, and so far it's been a pretty frustrating
>> > experience with alsa-utils/alsaucm :-(
>>
>> CCing in Liam - please always remember to CC maintainers.
>>
>> > The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
>> > of segfaults and bad output (patches attached), but so far the only
>> > thing I can do is list the verbs...It looks like
>> > alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
>> > whenever I query with predefined identifiers alsaucm seg faults or
>> > provides an error message that doesn't help much. This happens with
>> > the latest code.
>
>> >
>> > [ume@plb alsaucm]$ ./alsaucm listcards
>> >   0: AudioPC
>> >     this is my AudioPCI card
>> >   1: SDP4430
>> >     this is my SDP4430 card
>> >   2: TestHDA
>> >     A test HDA card
>> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>> >   0: HiFi
>> >     Play and record HiFi quality Music.
>> >   1: Voice
>> >     Full duplex low-power voice call
>> >
>> > So far so good. Now the fun begins
>> >
>> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
>> > ./alsaucm: error failed to get list _devices: No such file or directory
>> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
>> > ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
>> > use case: HiFi
>> > ./alsaucm: error failed to set _verb=HiFi: No such device
>> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
>> > ./alsaucm: error failed to get _verb: No such file or directory
>> >
>
> It looks like we need to improve the config file error reporting here.
> Adding line numbers would be good.
>
>> > Likewise if the .conf file contains a cset in the default values, then
>> > the parser fails (I took the example from src/ucm/parser.c).
>> > Commenting out the cset is the only solution. What exactly is this
>> > index supposed to mean?
>> > SectionDefaults [
>> > cdev "hw:AudioPCI"
>> > cset "name='Master Playback Switch',index=2 1,1"
>> > ]
>
> Jaroslav is probably best placed to answer about the cset syntax.
>
> The "index" is not required :-
>
> cset "name='Master Playback Switch' 1,1"
>
>> >
>> > [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>> > ALSA lib main.c:302:(import_master_config) Unable to execute default sequence
>> > ALSA lib main.c:637:(snd_use_case_mgr_open) error: failed to import
>> > AudioPCI use case configuration -19
>> > ./alsaucm: error failed to open sound card AudioPCI: No such device
>> >
>> > Ideally I'd like to write an interface between PulseAudio and UCM,
>> > there are existing modules I can reuse to set voice or hifi modes,
>> > depending on what the client roles are. But if I can't make the
>> > examples work I don't think this is going to go anywhere.
>>
>> There's some existing work going on with PulseAudio/UCM integration -
>> Liam, I'd CC in Marga but I don't know what her new address.
>
> I've CC'ed Margarita. She has started some work on PA and UCM
> integration and has some code that can read in the UCM verbs.
>
> Margarita, could you provide a link to your PA git.
>

Here is the link to the  PA git, it has the code that can read the ucm verbs.

http://git.slimlogic.co.uk/cgi-bin/cgit.cgi/pulseaudio.git/?h=9.20-ucm

If the following ucm command works then you will not have issues with the patch

$ alsaucm YOUR_CARD listv

Regards,
Margarita

> Thanks
>
> Liam
> --
> Freelance Developer, SlimLogic Ltd
> ASoC and Voltage Regulator Maintainer.
> http://www.slimlogic.co.uk
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-01-31 23:44     ` Margarita Olaya
@ 2011-02-02  8:11       ` Jaroslav Kysela
  2011-02-02 20:42         ` Liam Girdwood
  0 siblings, 1 reply; 11+ messages in thread
From: Jaroslav Kysela @ 2011-02-02  8:11 UTC (permalink / raw)
  To: Margarita Olaya; +Cc: pl bossart, ALSA development, Mark Brown, Liam Girdwood

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4130 bytes --]

On Mon, 31 Jan 2011, Margarita Olaya wrote:

> On Mon, Jan 31, 2011 at 7:53 AM, Liam Girdwood <lrg@slimlogic.co.uk> wrote:
>> On Mon, 2011-01-31 at 11:22 +0000, Mark Brown wrote:
>>> On Fri, Jan 28, 2011 at 11:36:47AM -0600, pl bossart wrote:
>>>> I've been trying to figure out what exactly needs to be filled in UCM
>>>> configuration files, and so far it's been a pretty frustrating
>>>> experience with alsa-utils/alsaucm :-(
>>>
>>> CCing in Liam - please always remember to CC maintainers.
>>>
>>>> The interactive mode in alsa-utils/alsaucm is broken, I fixed a couple
>>>> of segfaults and bad output (patches attached), but so far the only
>>>> thing I can do is list the verbs...It looks like
>>>> alsa-lib/include/use-case.h and alsa-utils/alsaucm are not aligned,
>>>> whenever I query with predefined identifiers alsaucm seg faults or
>>>> provides an error message that doesn't help much. This happens with
>>>> the latest code.
>>
>>>>
>>>> [ume@plb alsaucm]$ ./alsaucm listcards
>>>>   0: AudioPC
>>>>     this is my AudioPCI card
>>>>   1: SDP4430
>>>>     this is my SDP4430 card
>>>>   2: TestHDA
>>>>     A test HDA card
>>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>>>>   0: HiFi
>>>>     Play and record HiFi quality Music.
>>>>   1: Voice
>>>>     Full duplex low-power voice call
>>>>
>>>> So far so good. Now the fun begins
>>>>
>>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _devices
>>>> ./alsaucm: error failed to get list _devices: No such file or directory
>>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI set _verb HiFi
>>>> ALSA lib main.c:1250:(set_verb_user) error: failed to initialize new
>>>> use case: HiFi
>>>> ./alsaucm: error failed to set _verb=HiFi: No such device
>>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI get _verb
>>>> ./alsaucm: error failed to get _verb: No such file or directory
>>>>
>>
>> It looks like we need to improve the config file error reporting here.
>> Adding line numbers would be good.
>>
>>>> Likewise if the .conf file contains a cset in the default values, then
>>>> the parser fails (I took the example from src/ucm/parser.c).
>>>> Commenting out the cset is the only solution. What exactly is this
>>>> index supposed to mean?
>>>> SectionDefaults [
>>>> cdev "hw:AudioPCI"
>>>> cset "name='Master Playback Switch',index=2 1,1"
>>>> ]
>>
>> Jaroslav is probably best placed to answer about the cset syntax.
>>
>> The "index" is not required :-
>>
>> cset "name='Master Playback Switch' 1,1"
>>
>>>>
>>>> [ume@plb alsaucm]$ ./alsaucm -c AudioPCI list _verbs
>>>> ALSA lib main.c:302:(import_master_config) Unable to execute default sequence
>>>> ALSA lib main.c:637:(snd_use_case_mgr_open) error: failed to import
>>>> AudioPCI use case configuration -19
>>>> ./alsaucm: error failed to open sound card AudioPCI: No such device
>>>>
>>>> Ideally I'd like to write an interface between PulseAudio and UCM,
>>>> there are existing modules I can reuse to set voice or hifi modes,
>>>> depending on what the client roles are. But if I can't make the
>>>> examples work I don't think this is going to go anywhere.
>>>
>>> There's some existing work going on with PulseAudio/UCM integration -
>>> Liam, I'd CC in Marga but I don't know what her new address.
>>
>> I've CC'ed Margarita. She has started some work on PA and UCM
>> integration and has some code that can read in the UCM verbs.
>>
>> Margarita, could you provide a link to your PA git.
>>
>
> Here is the link to the  PA git, it has the code that can read the ucm verbs.
>
> http://git.slimlogic.co.uk/cgi-bin/cgit.cgi/pulseaudio.git/?h=9.20-ucm
>
> If the following ucm command works then you will not have issues with the patch
>
> $ alsaucm YOUR_CARD listv
>
> Regards,
> Margarita

This patch does not use the released UCM API in alsa-lib. Also, more work 
is required to separate ALSA card from UCM card (to support virtual or 
mixed "soundcards").

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-02-02  8:11       ` Jaroslav Kysela
@ 2011-02-02 20:42         ` Liam Girdwood
  2011-02-03 15:31           ` pl bossart
  0 siblings, 1 reply; 11+ messages in thread
From: Liam Girdwood @ 2011-02-02 20:42 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: pl bossart, ALSA development, Mark Brown, Margarita Olaya

On Wed, 2011-02-02 at 09:11 +0100, Jaroslav Kysela wrote:
> On Mon, 31 Jan 2011, Margarita Olaya wrote:
> 
> > On Mon, Jan 31, 2011 at 7:53 AM, Liam Girdwood <lrg@slimlogic.co.uk> wrote:

> >>
> >> Margarita, could you provide a link to your PA git.
> >>
> >
> > Here is the link to the  PA git, it has the code that can read the ucm verbs.
> >
> > http://git.slimlogic.co.uk/cgi-bin/cgit.cgi/pulseaudio.git/?h=9.20-ucm
> >
> > If the following ucm command works then you will not have issues with the patch
> >
> > $ alsaucm YOUR_CARD listv
> >
> > Regards,
> > Margarita
> 
> This patch does not use the released UCM API in alsa-lib. 

Margarita was using the earlier version of the alsaucm tool here, and
was using a pre-release UCM branch. Now updated to use the release.

> Also, more work 
> is required to separate ALSA card from UCM card (to support virtual or 
> mixed "soundcards").

Agreed, but Margarita will initially be targeting a simpler system with
one sound card and then move on to support a virtual sound card.

Thanks

Liam

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: UCM list/set/get
  2011-02-02 20:42         ` Liam Girdwood
@ 2011-02-03 15:31           ` pl bossart
  2011-02-03 16:08             ` Pulseaudio UCM integration - (Was:UCM list/set/get) Liam Girdwood
  0 siblings, 1 reply; 11+ messages in thread
From: pl bossart @ 2011-02-03 15:31 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Margarita Olaya, ALSA development, Mark Brown

>> Also, more work
>> is required to separate ALSA card from UCM card (to support virtual or
>> mixed "soundcards").
>
> Agreed, but Margarita will initially be targeting a simpler system with
> one sound card and then move on to support a virtual sound card.

I quickly looked at the code. Interesting. I was thinking of a
different approach where a separate pulseaudio module would open the
use case manager, get the list of cards and verbs. this would be done
on startup. Doing this inside module-alsa-card results in redundant
activity, you're going to re-open and read the verbs for each card.

I am also concerned about the card_set_profile() code in module-alsa-card
   if (nd->profile->is_ucm) {
        pa_log_debug("set UCM %s", nd->profile->name + 4);
        return snd_use_case_set(nd->profile->uc_mgr, verb,
nd->profile->name + 4);
    }
There's an awful amount of code after the return to handle multiple
sinks that may become active for a given profile. Even if you have a
single card, it's not clear to me how multiple devices would be
handled (eg. voice, music, tones in the 4430 case) if you bypass this
code. Are they considered as different sinks from a PulseAudio
perspective? The routing and how devices allowed in a specific use
case are exposed in PulseAudio isn't clear to me at all.

Last, looking at the code, I saw this comment
	/* FIXME: UCM needs to provide API to acquire verb comments */
A change is not needed, the list of verbs already comes as verb0,
comment0, verb1, comment1, etc.
My $0.02
-Pierre

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pulseaudio UCM integration - (Was:UCM list/set/get)
  2011-02-03 15:31           ` pl bossart
@ 2011-02-03 16:08             ` Liam Girdwood
  0 siblings, 0 replies; 11+ messages in thread
From: Liam Girdwood @ 2011-02-03 16:08 UTC (permalink / raw)
  To: pl bossart; +Cc: Margarita Olaya, ALSA development, Mark Brown, Colin Guthrie

On Thu, 2011-02-03 at 09:31 -0600, pl bossart wrote:
> >> Also, more work
> >> is required to separate ALSA card from UCM card (to support virtual or
> >> mixed "soundcards").
> >
> > Agreed, but Margarita will initially be targeting a simpler system with
> > one sound card and then move on to support a virtual sound card.
> 
> I quickly looked at the code. Interesting. I was thinking of a
> different approach where a separate pulseaudio module would open the
> use case manager, get the list of cards and verbs. this would be done
> on startup. Doing this inside module-alsa-card results in redundant
> activity, you're going to re-open and read the verbs for each card.
> 

I should say that the initial design and patch implementation was
carried out before Jaroslav added the virtual card support. The initial
plan was to compute UCM values per card at startup.

This code is also experimental, Margarita planned to see what worked
best with one card at first before moving to virtual card support.

> I am also concerned about the card_set_profile() code in module-alsa-card
>    if (nd->profile->is_ucm) {
>         pa_log_debug("set UCM %s", nd->profile->name + 4);
>         return snd_use_case_set(nd->profile->uc_mgr, verb,
> nd->profile->name + 4);
>     }
> There's an awful amount of code after the return to handle multiple
> sinks that may become active for a given profile. Even if you have a
> single card, it's not clear to me how multiple devices would be
> handled (eg. voice, music, tones in the 4430 case) if you bypass this
> code. Are they considered as different sinks from a PulseAudio
> perspective? The routing and how devices allowed in a specific use
> case are exposed in PulseAudio isn't clear to me at all.
> 

I don't think Margarita has got this far yet.

> Last, looking at the code, I saw this comment
> 	/* FIXME: UCM needs to provide API to acquire verb comments */
> A change is not needed, the list of verbs already comes as verb0,
> comment0, verb1, comment1, etc.

Again, this comment was from the ancient code.

> My $0.02
> -Pierre

I've CC'ed Colin for his $0.02 too. I do agree though, that with virtual
card support it does seem right to create a new Pulseaudio module to
manage UCM.

At a high level, the new module could :-

Compute use cases for each sound device at init {
	if (ucm config exists)
		use UCM config
	else
		use existing config method
}

Whilst Pulseaudio would use computed use case values for every new
client stream (using module-intended-roles ?).

Thoughts ?

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-02-03 16:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 17:36 UCM list/set/get pl bossart
2011-01-31 11:22 ` Mark Brown
2011-01-31 13:53   ` Liam Girdwood
2011-01-31 14:07     ` Jaroslav Kysela
2011-01-31 21:57       ` pl bossart
2011-01-31 22:40         ` Jaroslav Kysela
2011-01-31 23:44     ` Margarita Olaya
2011-02-02  8:11       ` Jaroslav Kysela
2011-02-02 20:42         ` Liam Girdwood
2011-02-03 15:31           ` pl bossart
2011-02-03 16:08             ` Pulseaudio UCM integration - (Was:UCM list/set/get) Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.