LCD Brightess support for ppc in HAL

David Zeuthen david at fubar.dk
Sat Jan 28 14:49:59 PST 2006


On Sat, 2006-01-28 at 01:57 +0000, Richard Hughes wrote:
> LCD brightness support works well with ACPI, but is not supported
> currently for PMU.
> 
> Attached is a patch which adds the simple ioctl wrapper
> hal-system-power-pmu (as discussed before on this list) and the pmu
> infrastructure glue to make it all work. It's been tested on my iBook,
> using g-p-m, where the brightness was got, and set to, the correct
> values.

Well, it doesn't work on my Powerbook G4 12" (Powerbook6,1) which in a
way is good as it exposes bad error handling

        [root at powerbook tools]# ./hal-system-power-pmu getlcd
        power-pmu : PMU_IOC_GET_BACKLIGHT failed
        258822131[root at powerbook tools]# echo $?
        0
        [root at powerbook tools]# ./hal-system-power-pmu setlcd 5
        power-pmu : PMU_IOC_SET_BACKLIGHT failed
        [root at powerbook tools]# echo $?
        0
        
> +static PMUDevHandler pmudev_handler_laptop_panel = { 
> +       .pmu_type    = PMU_TYPE_LAPTOP_PANEL,
> +       .add         = pmu_generic_add,
> +       .compute_udi = pmu_lid_compute_udi,

Please add a new function pmu_laptop_panel_compute_udi.

> +       # FIXME: we should probably switch the cwd if safe to do so

I just fixed this in CVS - all helpers now have the working directory
set to where the helper was found. Please test that it works.

> +if [ "$HAL_PROP_LAPTOP_PANEL_ACPI_METHOD" == "pmu" ]; then
> +       # hal-system-power-pmu setlcd: {0..14}
> +       # FIXME: we should probably switch the cwd if safe to do so
> +       if [ -e "../tools/hal-system-power-pmu" ]; then
> +               ../tools/hal-system-power-pmu setlcd $value
> +       elif [ -e "/usr/share/hal/scripts/hal-system-power-pmu" ];
> then
> +               /usr/share/hal/scripts/hal-system-power-pmu setlcd
> $value
> +       fi
> +       RET=$?
> +       exit $RET

Here you need to test $RET and if non-zero you need to "throw" the
exception org.freedesktop.Hal.SystemPowerManagement.NotSupported - see
the set-power-save script for an example.

Btw, how about a patch for exposing the power button on Apple powerbooks
and iBook. I think you'll need to read the keyboard for this so this
part should probably be done in an add-on... (yes, I know that e.g.
gnome-settings-daemon could do the same but the idea here is to give a
uniform interface for the g-p-m's of the world).

Thanks,
David




More information about the hal mailing list