[alsa-devel] [PATCH] alsa-info: Use sysfs if available instead of dmidecode
Using sysfs for acquiring DMI data requires no root privileges. Use it if available instead of dmidecode.
Signed-off-by: Ozan Çağlayan ozan@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
At Wed, 12 Aug 2009 16:51:41 +0300, Ozan Çağlayan wrote:
Using sysfs for acquiring DMI data requires no root privileges. Use it if available instead of dmidecode.
Signed-off-by: Ozan Çağlayan ozan@pardus.org.tr
Thanks, now applied.
Takashi
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
participants (2)
-
Ozan Çağlayan
-
Takashi Iwai