Package: laptop-detect Version: 0.13.7 Tags: patch In recent kernels, the chassis type is available in /sys/. It can be used instead of dmidecode to detect if the current machine is a laptop or not. The value in /sys/ is available also for non-root users.
Here is a draft patch implementing this. --- /usr/sbin/laptop-detect 2008-08-04 15:06:01.000000000 +0200 +++ /usr/sbin/laptop-detect.new 2012-02-10 21:38:56.000000000 +0100 @@ -61,6 +61,27 @@ #echo "$dmitype" fi +if [ -e /sys/devices/virtual/dmi/id/chassis_type ] ; then + case "$(cat /sys/devices/virtual/dmi/id/chassis_type)" in + 8) # Portable + $PRINTIT "We're a laptop (dmidecode returned $dmitype)" >&2 + exit 0 + ;; + 9) # Laptop + $PRINTIT "We're a laptop (dmidecode returned $dmitype)" >&2 + exit 0 + ;; + 10) # Notebook + $PRINTIT "We're a laptop (dmidecode returned $dmitype)" >&2 + exit 0 + ;; + 11) # Hand Held + $PRINTIT "We're a laptop (dmidecode returned $dmitype)" >&2 + exit 0 + ;; + esac +fi + # check for any ACPI batteries /sbin/modprobe battery 2> /dev/null || true if [ -d /sys/class/power_supply ]; then -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org