I am trying to catch a event when the ebook switch in a XO-1.5 is activated and read the switch state.<br>Using dbus-monitor I have found the signal emited, but the message does not inform the switch state. It 's odd because send a array of booleans values, but are always in False.<br>
The signal is emited when the ebook switch or the lid switch are activated.<br>Simple test code:<br><br><span style="font-family: courier new,monospace;">[olpc@xo-a7-2b-49 ~]$ cat test-dbus.py </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#!/usr/bin/env python</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#def my_func(account, sender, message, conversation, flags):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">def my_func(sender, message):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print sender, "said:", message</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import dbus, gobject</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">from dbus.mainloop.glib import DBusGMainLoop</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bus = dbus.SystemBus()</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">bus.add_signal_receiver(my_func,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> dbus_interface="org.freedesktop.Hal.Device",</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> signal_name="PropertyModified")</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">loop = gobject.MainLoop()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">loop.run()</span><br><br>I see this when activate the switchs:<br><br><span style="font-family: courier new,monospace;">[olpc@xo-a7-2b-49 ~]$ python test-dbus.py </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1 said: dbus.Array([dbus.Struct((dbus.String(u'button.state.value'), dbus.Boolean(False), dbus.Boolean(False)), signature=None)], signature=dbus.Signature('(sbb)'))</span><br>
<br>I know I can read the switch state from /proc/acpi/olpc-switch/ebook/EBK/state and /proc/acpi/button/lid/LID/state<br><br>The question is: the dbus message must send the state? i am doing anything wrong?<br>Finally, there are a similar procedure to the XO-1?<br>
<br>I am doing all this to <a href="http://dev.laptop.org/ticket/10396">http://dev.laptop.org/ticket/10396</a><br><br>Thanks<br> <br>Gonzalo<br>