[alsa-devel] [PATCH/RFC] alsa-info: add DMI data to the alsa-info output

Takashi Iwai tiwai at suse.de
Mon Jun 1 11:19:25 CEST 2009


At Sun, 31 May 2009 22:36:37 +0300,
Ozan Çağlayan wrote:
> 
> This is a working but not a clean/good patch for doing that because I'm
> not very good at shell scripting but I'm posting it just to give a
> possible idea.
> 
> dmidecode should be run as root because it reads /dev/mem. If alsa-info
> is run as root, providing at least the system-manufacturer and
> system-product-name in the output will be very useful for distro
> maintainers.

Yes, the idea is very good.

> 
> Thanks,
> Ozan Caglayan
> 
> Index: alsa-info.sh
> ===================================================================
> --- alsa-info.sh        (revision 69253)
> +++ alsa-info.sh        (working copy)
> @@ -361,6 +361,18 @@
>  ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
>  JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
> 
> +DMIDECODE=$(which dmidecode)

Redirection of stderr would be needed like the above lines, I guess.

> +DMI_SYSTEM_MANUFACTURER="Not provided"
> +DMI_SYSTEM_PRODUCT_NAME="Not provided"
> +
> +if [ -f $DMIDECODE ]; then

It's safer to use -x in such a case.

> +    $DMIDECODE -q &> /dev/null
> +    if [ x$? != "x1" ]; then
> +        DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer)
> +        DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name)
> +    fi

It could be just like below?

        DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
        DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/devnull)


thanks,

Takashi


More information about the Alsa-devel mailing list