How to call SetBrightness in Python?

Richard Hughes hughsient at gmail.com
Fri Dec 30 10:03:17 PST 2005


On Fri, 2005-12-30 at 20:43 +0300, Andrey Borzenkov wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Is there any contemplative tutorial on HAL bindings? Using straightforward 
> code gives an error:
> 
> {pts/1}% ~/tmp/setbr
> Traceback (most recent call last):
>   File "/home/bor/tmp/setbr", line 9, in ?
>     dev.SetBrightness(4)
>   File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 64, in 
> __call__
>     reply_message = self._connection.send_with_reply_and_block(message, 
> timeout)
>   File "dbus_bindings.pyx", line 395, in 
> dbus_bindings.Connection.send_with_reply_and_block
> dbus_bindings.DBusException: Method "SetBrightness" with signature "i" on 
> interface "org.freedesktop.Hal.Device" doesn't exist
> 
> The code follows:
> 
> #!/usr/bin/python
> 
> import dbus
> 
> bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
> devobj = bus.get_object('org.freedesktop.Hal', 
> '/org/freedesktop/Hal/devices/acpi_lcd')
> dev = dbus.Interface (devobj, "org.freedesktop.Hal.Device")

Don't you need org.freedesktop.Hal.Device.LaptopPanel as your interface?

Looks okay other than that.

> dev.SetBrightness(4)
> 
> TIA and Happy New Year to everybody

Thanks,

Richard.



More information about the hal mailing list