device model wakeup

Johannes Berg johannes at sipsolutions.net
Tue May 8 01:37:48 PDT 2007


Hi David,

> We should probably tag device objects that can wake up with the
> capability 'wakeup'. This would go in device.c when the various bus
> devices are investigated. With this, I think this can be achieved by
> just a single fdi file that should go in 
> 
>  fdi/policy/10osvendor/10-wakeup.fdi
> 
> [...]

Looks good to me. hal-wakeup-getwakeup-linux could be as simple as:

#!/bin/sh

if [ -z "$HAL_PROP_LINUX_SYSFS_PATH" ] ; then
  echo "org.freedesktop.Hal.Device.Wakeup.NotSupported" >&2
  exit 1
fi

if [ ! -r "$HAL_PROP_LINUX_SYSFS_PATH/power/wakeup" ] ; then
  echo "org.freedesktop.Hal.Device.Wakeup.NotSupported" >&2
  exit 1
fi

if grep -q enabled "$HAL_PROP_LINUX_SYSFS_PATH/power/wakeup" ; then
  exit 1
fi

exit 0

[not sure if the exit status there is correct]

hal-wakeup-setwakeup-linux would be:

#!/bin/sh

if [ -z "$HAL_PROP_LINUX_SYSFS_PATH" ] ; then
  echo "org.freedesktop.Hal.Device.Wakeup.NotSupported" >&2
  exit 1
fi

if [ ! -w "$HAL_PROP_LINUX_SYSFS_PATH/power/wakeup" ] ; then
  echo "org.freedesktop.Hal.Device.Wakeup.NotSupported" >&2
  exit 1
fi

if [ $value -gt 0 ] ; then
 echo -n enabled > "$HAL_PROP_LINUX_SYSFS_PATH/power/wakeup"
else
 echo -n disabled > "$HAL_PROP_LINUX_SYSFS_PATH/power/wakeup"
fi


With the appropriate wrappers hal-wakeup-{set,get}wakeup, basically
copies of hal-system-lcd-{set,get}-brightness. (I'm not sure why those
scripts are present; they seem to be linux specific as well as the
-linux versions, containing sysfs checks...)

> The only problem is that we right now only allow return codes to be
> integers. That will be fixed for 0.5.10 such that int, uint64, bool,
> string, strlist can be returned.

I don't think that'll be a problem at all, we only have boolean which
can be packed into an int easily enough.

The detection code that sets the wakeup capability should basically just
check if the power/wakeup file has non-zero length (or better, contains
"enabled\n" or "disabled\n").

I haven't yet managed to build hal from git (autogen.sh errors out on my
system) but once I do I'll try to come up with a patch.

johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/hal/attachments/20070508/99361ac8/attachment.pgp


More information about the hal mailing list