Skip to contentSkip to conversation

alsa-info: add DMI data to the alsa-info output

PATCH/RFC Ozan Çağlayan 3 participants 4 messages May 31, 2009 – Jun 1, 2009

lore
Share & tools
lore
#0 lore raw

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.

Thanks,
Ozan Caglayan

alsa-info.sh (working copy) renamed from alsa-info.sh (revision 69253) +12 -0
Index: alsa-info.sh
===================================================================
@@ -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)
+DMI_SYSTEM_MANUFACTURER="Not provided"
+DMI_SYSTEM_PRODUCT_NAME="Not provided"
+
+if [ -f $DMIDECODE ]; then
+    $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
+fi
+
 cat /proc/asound/modules 2>/dev/null|awk {'print

$2'}>$TEMPDIR/alsamodules.tmp
cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
lspci |grep -i "multi\|audio">$TEMPDIR/lspci.tmp
@@ -391,6 +403,13 @@
echo $DISTRO >> $FILE
echo "" >> $FILE
echo "" >> $FILE
+echo "!!DMI Information" >> $FILE
+echo "!!---------------" >> $FILE
+echo "" >> $FILE
+echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE
+echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
+echo "" >> $FILE
+echo "" >> $FILE
echo "!!Kernel Information" >> $FILE
echo "!!------------------" >> $FILE
echo "" >> $FILE

#1 lore raw

At Sun, 31 May 2009 22:36:37 +0300,

Quoted 9 lines · Ozan Çağlayan

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.

alsa-info.sh (working copy) line 364

Quoted 13 lines

Thanks,
Ozan Caglayan

Index: alsa-info.sh
===================================================================

alsa-info.sh (working copy) renamed from alsa-info.sh (revision 69253) +1 -0
@@ -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.

alsa-info.sh (working copy) line 368

Quoted 4 lines
alsa-info.sh (working copy) renamed from alsa-info.sh (revision 69253) +4 -0
+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.

alsa-info.sh (working copy) line 373

Quoted 5 lines
alsa-info.sh (working copy) renamed from alsa-info.sh (revision 69253) +5 -0
+    $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
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
In reply to Ozan Çağlayan
Quoted 8 lines · Ozan Çağlayan

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.

Please note that this information is exported in sysfs anyway, in /sys/class/dmi/id/*.

It would be much better to read that data from sysfs since it doesn't need a kernel with /dev/mem, or root root priviliges or any other software installed.

Lennart

Signature · 7 lines
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#3 lore raw

Lennart Poettering wrote On 01-06-2009 15:28:

Quoted 8 lines

Please note that this information is exported in sysfs anyway, in /sys/class/dmi/id/*.

It would be much better to read that data from sysfs since it doesn't need a kernel with /dev/mem, or root root priviliges or any other software installed.

That's nice, didn't know about that, will resend the patch, thanks!