Hello,
I have tried to make the ezx shutdown after pushing on poweroff button a
longtime. To do this, I have had a shutdown function in
fso_actions.py, a keypad trigger in fso_triggers.py and a rule in rules.yaml.
The three diff files are in attachement.
But this is not reliable. There is two problems :
1) the +EKEV unsollicited message seems to be send by the BP only after SIM PIN
has be set
2) the shutdown when call by the rules, has not the same behaviour that the
command send with mdbus or cli-framework.
Have I make a mistake ?
Thanks,
Alain
--- fso_actions.py.orig 2009-05-18 18:29:47.000000000 +0200
+++ fso_actions.py 2009-05-21 23:33:02.000000000 +0200
@@ -390,6 +390,21 @@
super(SuspendAction, self).__init__(bus, service, obj, interface,
'Suspend')
#============================================================================#
+class ShutdownAction(DBusAction):
+#============================================================================#
+ """
+ A dbus action to shutdown the device
+ """
+ function_name = 'Shutdown'
+
+ def __init__(self):
+ bus = dbus.SystemBus()
+ service = 'org.freesmartphone.ousaged'
+ obj = '/org/freesmartphone/Usage'
+ interface = 'org.freesmartphone.Usage'
+ super(ShutdownAction, self).__init__(bus, service, obj, interface,
'Shutdown')
+
+#============================================================================#
class ExternalDBusAction(DBusAction):
#============================================================================#
function_name = "ExternalDBusAction"
--- fso_triggers.py.orig 2009-05-18 18:29:47.000000000 +0200
+++ fso_triggers.py 2009-05-21 23:21:58.000000000 +0200
@@ -232,3 +232,28 @@
def __repr__(self):
return "InputTrigger"
+
+#============================================================================#
+class KeypadTrigger(DBusTrigger):
+#============================================================================#
+ """
+ A dbus trigger for org.freesmartphone.GSM.Device.KeypadEvent
+ """
+
+ function_name = 'KeypadEvent'
+
+ def __init__(self):
+ bus = dbus.SystemBus()
+ super(InputTrigger, self).__init__(
+ bus,
+ 'org.freesmartphone.ogsmd',
+ '/org/freesmartphone/GSM/Device',
+ 'org.freesmartphone.GSM.Device',
+ 'KeypadEvent'
+ )
+ def on_signal(self, name, pressed):
+ logger.debug("%s triggered", self)
+ self._trigger(name=name, pressed=pressed)
+
+ def __repr__(self):
+ return "KeypadTrigger"
--- rules.yaml.orig 2009-05-18 18:29:15.000000000 +0200
+++ rules.yaml 2009-05-21 23:24:35.000000000 +0200
@@ -35,6 +35,13 @@
- HasAttr(duration, 0)
actions: Suspend()
-
+ #
+ # Shutdown Handling
+ #
+ trigger: KeypadEvent()
+ filters: HasAttr(name, "power")
+ actions: Shutdown()
+-
#
# Call -> Audio Scenario Handling
#
_______________________________________________
Smartphones-userland mailing list
Smartphones-userland@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-userland