[alsa-devel] [PATCH/RFC] alsa-info: add DMI data to the alsa-info output
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
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) +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
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
On Sun, 31.05.09 22:36, Ozan Çağlayan (ozan@pardus.org.tr) 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.
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
Lennart Poettering wrote On 01-06-2009 15:28:
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!
participants (3)
-
Lennart Poettering
-
Ozan Çağlayan
-
Takashi Iwai