Re: [mu TECH] NEW: Runtime sound driver configuration (2)

From: Alfie Costa (agcosta@gis.net)
Date: Sun Apr 23 2000 - 05:23:02 CEST


On 22 Apr 00, at 0:11, Miguel Angel <mulinux@sunsite.auc.dk> wrote:

> Here is my latest patch for mulinux 8r3b
> It is a pair of scripts for configuring the port, irq, and dma's of the sound
> blaster driver at runtime, avoiding the need to recompile the module.
> Also, the sound setup at startup is modified to use this utility.
> I had to include a binary echo command, because i really needed it for my
> script, but it size is only 5kb, and once compressed it seems it only uses a
> few bytes.

This patch is good news. I have a sound card hooked up to Port 220 IRQ 10
DMA 0, and so far have only been using mu's speaker driver. Coincidentally, I
was thinking of writing something that would do what your code already does.
Never went beyond that 'thought' stage however, and now it's all done, and so
the code is even more interesting to read than it would be anyway.

Ran it and now my soundcard works under mu. Many times easier than Debian,
which I've never got working with sound yet, and after much study. No re-
compiling the kernel or modules either.

Some 'ash' script observations and/or questions:

1) In 'profile' there's a macro for this new '/bin/echo'.

Assuming that 'ash's built-in 'echo' is faster than an external program, (maybe
it isn't -- on general principles it should be though.), wouldn't this slow
down every script that uses 'echo'? One fix would be to rename this new
'/bin/echo' to '/bin/echobin', and call it with 'echobin'.

2) A tweak. Anything like 'if [ "$reverse" != "" ]' can be reduced to
'if [ ${reverse} ]'. Possibly it's not as obvious what that code does; my
defense would be that mu's microscopic size is one of it's best features.

3) In 'binpatch't, there's some 'awk' code...

  pos=`echo|$AWK "{print( $pos-1 )}"`

It looks as if the goal is to subtract one from 'pos'. If that's true, then
this is faster:

  pos=`expr "$pos" - 1`

4)Also from 'binpatch' is this redirection code:

  $ECHO -n -e "$byte" | \
    dd of=$1 bs=1 seek=$pos count=1 conv=notrunc>/dev/null 2>&1

If 'dd' has an output file (of=$1) then nothing ever gets sent to standard
output, only perhaps to standard error. So, this would be simpler:

    ... dd of=$1 bs=1 seek=$pos count=1 conv=notrunc 2> /dev/null

Well, that's it so far; thanks for writing and sending out this useful script,
and hope the above is somehow helpful...

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:14 CET