Bugzilla – Bug 117150
Powersave module should only display settings for available features
Last modified: 2005-09-29 09:13:09 UTC
I don´t know whether there´s a way to do this with acpid, but the powersave module should only display the appropriate settings, e.g if you have a desktop pc there shouldn´t be an option what to do if the laptop is closed.
Would be nice if this would be possible, but unfortunately you can't say surely if the machine is a laptop or a desktop machine.
Yeah but e.g. in Windows if you don´t have a laptop there is no option for closing the laptop
in windows, the Hardware manufacturer delivers special "drivers" or configuration files that tell the operating system that this machine is actually a laptop and that it has a Lid / a sleep button etc. On Linux, we have to use what the BIOS provides, which unfortunately often has not much to do with reality :-) Said that, we will try to improve this, we can probably detect a sleep button and a LID switch reliably, so YaST could do better. This is in fact a good idea for an enhancement for one of the next releases, thanks for that. I'll assign the bug over to Jiri who will probably have to implement that and will work with him on this.
OK. Stefan, can you guide me how I can detect the availability of Sleep button and Lic close?
yes, it is relatively easy: 1) if you want to do it by yourself, you can read from the /proc/acpi/button directory (warning: this will change in the future as /proc/acpi/* will be deprecated and moved to sysfs) A) This is a machine without sleep button: seife@susi:~> ls -l /proc/acpi/button/ dr-xr-xr-x 3 root root 0 2005-09-27 11:12 lid dr-xr-xr-x 4 root root 0 2005-09-27 11:12 power B) This is a machine with sleep button:seife@fix:~> ls -l /proc/acpi/button/ dr-xr-xr-x 3 root root 0 2005-09-27 11:12 lid dr-xr-xr-x 3 root root 0 2005-09-27 11:12 power dr-xr-xr-x 3 root root 0 2005-09-27 11:12 sleep 2. using hal, it gets more future-proof: if hal-find-by-property --key button.type --string lid >/dev/null; then echo "Lid switch present" fi if hal-find-by-property --key button.type --string power >/dev/null; then echo "power button present" fi if hal-find-by-property --key button.type --string sleep >/dev/null; then echo "sleep button present" fi
Done in SVN, will submit to STABLE.