21 Mar 2012 00:12
Impossibility to handle resources at boot in oeventsd
Denis 'GNUtoo' Carikli <GNUtoo <at> no-log.org>
2012-03-20 23:12:44 GMT
2012-03-20 23:12:44 GMT
Hi,
I wrote a gta04 GPS handler.
I also modified oeventsd to handle resource events
I made a recipe for the gta04 GPS handler.
And finally I added the following to /etc/freesmartphone/oevents/rules.yaml :
-
trigger: ResourceState()
filters: And(HasAttr(resource, "GPS"),HasAttr(power_state, "enabled"))
actions: Command('/usr/bin/gps_handler.py start')
-
trigger: ResourceState()
filters: And(HasAttr(resource, "GPS"),HasAttr(power_state, "disabled"))
actions: Command('/usr/bin/gps_handler.py stop')
That was a clean way to integrate gta04 GPS according to Simon Busch.
However the way it is done has a major flaw:
At boot the GPS state is unknown.
And the Command in rules.yaml is not run at all at boot, only on resource
change. (when the user slide the slider in shr-settings or automatically when
an application request GPS(for instance with fso-raw)).
In /usr/lib/python2.7/site-
packages/framework/subsystems/oeventsd/fso_triggers.py,
I added a ResourceStateTrigger class for listenning to that resource:
[SIGNAL] org.freesmartphone.Usage.ResourceChanged(s:name, b:state,
a{sv}:attributes)
Is that right? did I do something wrong? or is Simon Busch implementation idea
wrong?
(Continue reading)
RSS Feed