Bug 117150

Summary: Powersave module should only display settings for available features
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Michael Stather <kontakt>
Component: YaST2Assignee: Jiri Srain <jsrain>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Enhancement    
Priority: P5 - None CC: behlert, dkukawka, jsrain
Version: RC 1   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Michael Stather 2005-09-14 23:59:28 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.
Comment 1 Danny Al-Gaaf 2005-09-15 07:00:49 UTC
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.
Comment 2 Michael Stather 2005-09-15 10:36:45 UTC
Yeah but e.g. in Windows if you don´t have a laptop there is no option for
closing the laptop
Comment 3 Forgotten User ZhJd0F0L3x 2005-09-15 10:52:06 UTC
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.
Comment 4 Jiri Srain 2005-09-27 08:16:38 UTC
OK. Stefan, can you guide me how I can detect the availability of Sleep button 
and Lic close? 
Comment 5 Forgotten User ZhJd0F0L3x 2005-09-27 09:41:06 UTC
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
Comment 6 Jiri Srain 2005-09-29 09:13:09 UTC
Done in SVN, will submit to STABLE.