[alsa-devel] [PATCH] alsa-info: Use sysfs if available instead of dmidecode

Ozan Çağlayan ozan at pardus.org.tr
Wed Aug 12 15:51:41 CEST 2009


Using sysfs for acquiring DMI data requires no root privileges. Use
it if available instead of dmidecode.

Signed-off-by: Ozan Çağlayan <ozan at pardus.org.tr>
---
 utils/alsa-info.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/utils/alsa-info.sh b/utils/alsa-info.sh
index 0ab1ddf..8f401c0 100755
--- a/utils/alsa-info.sh
+++ b/utils/alsa-info.sh
@@ -417,7 +417,12 @@ 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 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
 
-if [ -x $DMIDECODE ]; then
+#Check for DMI data
+if [ -d /sys/class/dmi/id ]; then
+    # No root privileges are required when using sysfs method
+    DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)
+    DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
+elif [ -x $DMIDECODE ]; then
     DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
     DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
 fi
-- 
1.6.3.4



More information about the Alsa-devel mailing list