LCD Brightess support for ppc in HAL

Richard Hughes hughsient at gmail.com
Sun Jan 29 05:47:07 PST 2006


On Sat, 2006-01-28 at 17:49 -0500, David Zeuthen wrote:
> On Sat, 2006-01-28 at 01:57 +0000, Richard Hughes wrote:
> > 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

I think I've sorted this now.

> Please add a new function pmu_laptop_panel_compute_udi.

Done.

> > +       # 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.

This does not work for me -- I get the following warning:

runner.c: In function ‘run_request_run’:
runner.c:244: warning: passing argument 1 of ‘g_path_get_dirname’ from
incompatible pointer type

Due to argv being gchar** and g_path_get_dirname expecting gchar*.

Changing the input to g_path_get_dirname from r->argv to r->argv[0]
fixed this warning, and made the cwd work.

Do you want me to patch this in CVS? I've attached a patch if you want
to do this yourself.

> > +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.

Sure, I've had a stab at this, new patch attached -- thanks for the
review. About the FIXME in the code, I'll send another patch, as it
changes a few other files.

> 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).

I think Matthew Garrett is working on such a patch.

Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-add-pmu-lcdbrightness-2.patch
Type: text/x-patch
Size: 16304 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20060129/d097bd69/hal-add-pmu-lcdbrightness-2-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-cwd-fix.patch
Type: text/x-patch
Size: 574 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20060129/d097bd69/hal-cwd-fix-0001.bin


More information about the hal mailing list