Sad Story
Timo Juhani Lindfors
timo.lindfors at iki.fi
Mon Dec 1 22:47:28 CET 2008
"Yorick Moko" <yorickmoko at gmail.com> writes:
> we need a way to remotely activate the gps and make it send an sms and
> e-mail etc etc
My ~/bin/remote-wakeup will run remote-wakeup-script when I call the
phone from a preconfigured number:
#!/usr/bin/python
import dbus
import dbus.mainloop
import dbus.mainloop.glib
import gobject
import subprocess
actions = { \
"CENSORED":"/home/lindi/bin/remote-wakeup-script" }
def onCallStatus( index, status, properties ):
if status == "incoming":
try:
action = actions[properties["peer"]]
except KeyError:
pass
else:
obj = bus.get_object( "org.freesmartphone.ogsmd", "/org/freesmartphone/GSM/Device" )
callInterface = dbus.Interface( obj, "org.freesmartphone.GSM.Call" )
callInterface.Release( index )
subprocess.Popen( action, shell=True )
dbus.mainloop.glib.DBusGMainLoop( set_as_default=True )
mainloop = gobject.MainLoop()
bus = dbus.SystemBus()
bus.add_signal_receiver( onCallStatus,
"CallStatus",
"org.freesmartphone.GSM.Call",
"org.freesmartphone.ogsmd",
"/org/freesmartphone/GSM/Device" )
mainloop.run()
At the moment ~/bin/remote-wakeup-script does just
#!/bin/sh
start-gprs-and-report-ip &
where start-gprs-and-report-ip does
#!/bin/bash
set -x
gprs-start
while true; do
ip="$(/sbin/ifconfig usb0|grep "inet addr:"|cut -d':' -f2|cut -d' ' -f1|head -n1)"
if [ "$ip" != "" ]; then
wget -O /dev/null "http://iki.fi/lindi/openmoko/wakeup"
ret=$?
if [ $ret -eq 0 ]; then
exit
fi
fi
sleep 10
done
where gprs-start does
#!/bin/sh
APN="internet.saunalahti"
USERNAME="x"
PASSWORD="x"
BUSNAME="org.freesmartphone.frameworkd"
OBJECTPATH="/org/freesmartphone/GSM/Device"
METHODNAME="org.freesmartphone.GSM.PDP.ActivateContext"
mdbus -s $BUSNAME $OBJECTPATH $METHODNAME $APN $USERNAME $PASSWORD
More information about the support
mailing list