[pkg-fso-commits] [SCM] Various useful tools for an FSO installation branch, master, updated. debian/0.git20080812.2-32-gb5a13bb
Michael 'Mickey' Lauer
mickey at vanille-media.de
Sun Sep 27 16:11:40 UTC 2009
The following commit has been merged in the master branch:
commit d5d3c4da59fd0ef28bf2789341ba6d42bc28a98b
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Wed Nov 26 01:33:36 2008 +0100
add fso-apm, a compatibility command for apm
diff --git a/fso-apm/apm b/fso-apm/apm
new file mode 100755
index 0000000..c39c344
--- /dev/null
+++ b/fso-apm/apm
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+"""
+apm compatibility command
+
+(C) 2008 Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+(C) 2008 Openmoko, Inc.
+GPLv2 or later
+"""
+
+import sys, dbus
+
+#=========================================================================#
+def showCapacity():
+#=========================================================================#
+ bus = dbus.SystemBus()
+ obj = bus.get_object( "org.freesmartphone.frameworkd", "/org/freesmartphone/Framework" )
+ framework = dbus.Interface( obj, "org.freesmartphone.Framework" )
+
+ batteries = framework.ListObjectsByInterface( "org.freesmartphone.Device.PowerSupply" )
+ if len( batteries ):
+ obj = bus.get_object( "org.freesmartphone.odeviced", batteries[0] )
+ battery = dbus.Interface( obj, "org.freesmartphone.Device.PowerSupply" )
+ capacity = battery.GetCapacity()
+ print "%d%%" % capacity
+
+#=========================================================================#
+def callSuspend():
+#=========================================================================#
+ bus = dbus.SystemBus()
+ obj = bus.get_object( "org.freesmartphone.ousaged", "/org/freesmartphone/Usage" )
+ usage = dbus.Interface( obj, "org.freesmartphone.Usage" )
+
+ try:
+ usage.Suspend()
+ except dbus.DBusException:
+ pass
+
+#=========================================================================#
+if __name__ == "__main__":
+#=========================================================================#
+ if len( sys.argv ) == 1:
+ showCapacity()
+ sys.exit( 0 )
+ elif len( sys.argv ) == 2 and sys.argv[1] == '-s':
+ callSuspend()
+ sys.exit( 0 )
+ else:
+ print "Usage: apm [-s]"
+ sys.exit( -1 )
--
Various useful tools for an FSO installation
More information about the pkg-fso-commits
mailing list