tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Boot time configuration of audio devices



Is it practical to use audiocfg that way, as the likely commands
(most likely only reasonable commands) to use in /etc/audio.conf
are "set" and "default", and both of those control a device
specified by a numeric index, which seems to be something that the
kerel assigns semi-arbitrarily at boot time ?

I think audiocfg would need to grow commands to allow the device
to be specified by name, rather than by index, for this to be
practical.

Or perhaps have this script accept the devices by name, convert the
name to index using the output of "audiocfg index" and then use the
numeric index obtained that way.

It is also dangerous to do

	/usr/bin/audiocfg $setting

with the unquoted $setting though I understand the rationale.

Better would be to change "read setting" to

	read cmd index direction encoding precision channels sample_rate

(or something better to replace 'index' but that's not the point here)
or you could just use cmd a1 a2 a3 a4 ... to make things less command
specific, and then do

	case "$cmd" in
	default)	/usr/bin/audiocfg "$cmd" "$index";;
	set) /usr/bin/audiocfg "$cmd" "$index" "$direction" "$encoding" \
			"$precision" "$channels" "$sample_rate" ;;
	test) echo Really!;;   # I am not serious here...
	list)	# whatever;;
	*)	;;		# do nothing, or whatever
	esac

or something like that.

kre

ps: although it is kind of traditional, you don't need quotes in
lines like
	name="audiocfg"
They achieve nothing at all (as long as there are no shell operators,
quoting, or white space characters in the value).




Home | Main Index | Thread Index | Old Index