At Wed, 7 Oct 2009 10:10:06 +0200 (CEST), Jaroslav Kysela wrote:
On Tue, 6 Oct 2009, Takashi Iwai wrote:
binding. What's awful on this?
CTL{reset}="mixer" CTL{name}="Master Playback Volume", CTL{value}="-21dB" CTL{name}="Master Playback Switch", CTL{value}="on" CTL{name}="Headphone Playback Switch", CTL{value}="on,on" CTL{name}="Front Playback Volume", CTL{value}="-29dB,-29dB" CTL{name}="Front Playback Switch", CTL{value}="on,on" CTL{name}="PCM Playback Volume", CTL{value}="0dB,0dB"
This is all fine, but as you wrote below:
Solving complex tasks requires complex description.
This is the reality. The alsactl's default config shows its limit.
I'm open to discuss things to make this udev-like syntax more nice. The most irritating thing in this syntax are build-in commands for me, but having another special key for these actions are not a big win, because configuration writers must learn them.
The crazy goto is also painful. It reminds me the day of MS BASIC.
I'm going to change the CTL build-in command to something more readable like:
Old syntax:
CTL{reset}="mixer" CTL{name}="Playback Volume",PROGRAM=="__ctl_search", \ CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}"
New syntax:
CTL{reset}="mixer" CTL{name}="Playback Volume",CTL{do_search}=="1", \ CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}"
But regarding goto, I'm really stuck. We can add some block control:
BEGIN="" .. END="" (looks like a goto anyway)
Hm, still not much improvement, indeed.
Or skip some lines:
SKIPLINES="3"
Oh, no! I don't want to debug a DSP assembly :)
But these solutions do not bring much readability. Another possibility (compromise) is to use a goto command to skip all lines to next label to reduce usage of named labels (which is not a big fun at least in init/default file):
GOTO="" .... LABEL=""
It works without any code change in current parser.
I'm afraid that udev config is way too simple for the conditionals. And we do need conditionals to handle many cases. XML can do better for such a purpose, but moving to XML now is another question...
thanks,
Takashi