ACPI inconsistent button state

David Zeuthen david at fubar.dk
Fri May 13 07:46:20 PDT 2005


On Fri, 2005-05-13 at 09:10 +1000, Rohan McGovern wrote:
> Hi all,
> 
> I've been using Ivman to hibernate my laptop, and an issue with HAL's ACPI 
> support has come to light.  Basically, when I close the lid of my laptop, it 
> will hibernate; when I open the lid of my laptop and turn it back on, it will 
> resume, and HAL will still think the lid is closed (presumably because it was 
> opened while the power was off).  Specifically,  button.state.value = true 
> on /org/freedesktop/Hal/devices/acpi_LID, when it should be false.
> 
> Luckily this is trivial to work around (just have a hal-set-property command 
> after the hibernate script), but a fix in the HAL source would be nice :-)  
> The '/proc/acpi/button/lid/LID/state' file gives the correct state for the 
> lid no matter what, so this is definitely fixable at HAL's level.  It seems 
> to me like this could be fixed by calling acpi_rescan_device (or 
> button_refresh) on the lid device at some point, but from looking at the 
> output of lshal --monitor while hibernating, there doesn't appear to be any 
> obvious event which consistently occurs where it makes sense to do this.  It 
> could be done in acpi_poll, but hopefully someone with greater insight and 
> knowledge of HAL can think of a more efficient way :-)
> 
> This problem probably extends to all ACPI buttons with button.has_state = 
> true .  

Hi,

thanks for the testing. 

It looks like the kernel isn't emitting an ACPI event when the 'lid
button' is released which is pretty understandable (since the box is
physically powered off when the lid is opened :-). I think we may
require the hibernate script to simply poke hald. The alternative is to
fix the kernel driver of course (just make it event an ACPI event at the
right time) - this may be the right fix :-)

However, right now, poking hald is a bit complex from a shell script.
How about a command line util

 hal-find-by-capability

a'la hal-set-property so you can find all the UDI's you need to invoke
Rescan() on? I imagine it would be something like this

 BUTTON_UDIS=`hal-find-by-capability --capability button`
 for UDI in $BUTTON_UDIS; do
   dbus-send --system --dest org.freedesktop.Hal $UDI \
     org.freedesktop.Hal.Device.Rescan
 done

Would that be useful? (warning; completely untested code)

Thanks,
David




> 
>  -- Rohan McGovern
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list