maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 physical recovery (Getting your phone back!) [HOWTO] (https://talk.maemo.org/showthread.php?t=47301)

synthaxx 2010-03-13 18:39

N900 physical recovery (Getting your phone back!) [HOWTO]
 
Alright, i think i speak for a lot of us that losing our phones would be disastrous. Either because you lose it, or it was stolen. Nobody wants to go through that.

I've made some strides in making sure that you can get it back.
It's important to note that aside from the first step, the rest can be done REMOTE. So if you really have lost your phone you can do all of the steps while it's still lost but responding.

This guide will also help if you've allready lost it but can still log in.

Required:
*a modicum of unix/linux knowledge, you'll need to know how to use SSH and edit files from the commandline
*ssh installed on the phone
*a remote server, ssh/ftp etc.

DISCLAIMER: Using the below could end in tears/flames/the end of the world! Also my code will most likely be ugly/tear inducing/vommitable so use at your own risk :D


The most important step is making sure you know what your phone's public IP is. Most mobile providers will randomize your IP on each connection but that's what this whole thing is about. If you know this, and you can still login, you have a shot at recovery.

To be able to find it, you could install a dynamic DNS client, or you can do the following:
Locate the /etc/network/if-up.d/00_disable_icmp_echo_reply and add the following in between the bottom echo and exit lines:

Code:

ifconfig gprs0|awk '/inet addr/ { print $2 }'|awk -F: '{ print $2 }' > /tmp/n900ip
The line below that you add a way to make sure the file is stored on the remote server. You can do this with SCP for example:

Code:

scp /tmp/n900ip [user]@[remote computer]:/[remote location]
Or use any other way to make sure this file is stored somewhere other than the phone, and accessible to you since it contains the public IP of your phone.
Adding these lines to this script will make sure it's activated every time your phone makes a gprs/3g connection, storing the ip offsite every time.

Check to make sure this works by disconnecting and reconnecting your connection on the phone and checking the file it uploaded to your server. After you do this try logging in to your phone with this IP using SSH. Did all that work? Great, rest easy for now.



IT'S GONE! I CAN'T FIND IT!


Alright, if everything went as planned you'll have your public ip. Try the SSH connection you tested and login.


IT WORKED! Now what?

First things first. If your phone is moving, it very probably isn't in your posession anymore.
Check the accelerometers to see if this is the case with:

Code:

watch cat /sys/class/i2c-adapter/i2c-3/3-001d/coord
If you see those numbers (x,y,z) vary, then skip straight to the GPS step.


Ok so it's not moving, it could be you just left it in a pocket or somewhere close.
Let's make it make a noise. If you have mplayer you could do a:

Code:

mplayer /home/user/MyDocs/[location with an MP3]
Or make it vibrate with:

Code:

dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_activate string:PatternIncomingCall
and use:

Code:

dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_deactivate string:PatternIncomingCall
to stop vibrating.


THIS IS STUPID, YOU'RE STUPID! I DON'T HEAR IT?


Well, here is where things get a bit more complicated. It could be that you left it at work, or maybe it's not actually in your possesion anymore...

Let's see what were up against.

Make a picture with the front cam:

Code:

gst-launch v4l2src device=/dev/video1 num-buffers=1 ! ffmpegcolorspace ! jpegenc ! filesink location=frontcam.jpg
and get the picture to your server (scp [user]@[n900 public ip]:/home/user/MyDocs/frontcam.png .). You can even start a simple webserver from the commandline with:

Code:

python -m SimpleHTTPServer 80
and go to http://[public ip] to get the frontcam.jpg or any other files from the location where you started the above.


You can also make it call you and listen in on what is going on the neigbourhood of your phone:

Code:

dbus-send --system --dest=com.nokia.csd.Call --type=method_call --print-reply /com/nokia/csd/call com.nokia.csd.Call.CreateWith string:"[YOUR PHONE NUMBER GOES HERE]" uint32:0

I DON'T HEAR OR SEE A THING!


Here's where we're going to try and read the gps.

First, install python-location (apt-get install python-location) on your phone and make a new file called gps.py and fill it with this (thanks to happy_n900_user!):

Code:

import location
import gobject

def on_error(control, error, data):
    print "location error: %d... quitting" % error
    data.quit()

def on_changed(device, data):
    if not device:
        return
    if device.fix:
        if (device.fix[1] & location.GPS_DEVICE_LATLONG_SET) and (device.fix[1] & location.GPS_DEVICE_TIME_SET) and not (device.status & location.GPS_DEVICE_STATUS_NO_FIX):
            print "lat = %f, long = %f" % device.fix[4:6]
            data.stop()

def on_stop(control, data):
    print "quitting"
    data.quit()

def start_location(data):
    data.start()
    return False

loop = gobject.MainLoop()
control = location.GPSDControl.get_default()
device = location.GPSDevice()
control.set_properties(preferred_method=location.METHOD_USER_SELECTED,
                      preferred_interval=location.INTERVAL_DEFAULT)

control.connect("error-verbose", on_error, loop)
device.connect("changed", on_changed, control)
control.connect("gpsd-stopped", on_stop, loop)

gobject.idle_add(start_location, control)

loop.run()

Now save and run it with

Code:

python2.5 gps.py
If everything goes well you'll get a LAT LONG you can plug into google maps.
If it's out of GPS range, you'll have to kill it with CTRL+C.

Once you have that, GO GET YOUR PHONE BACK (but please be smart about it! ;) )

All of this is not meant to be some all inclusive guide, it's meant to give you a shot if you ever do lose your phone.

I'll try and keep this post updated with new methods

Big thanks go to:
-Jebba for his great list of dbus commands
-happy_n900_user for getting the python script to actually spit out a GPS location
-everyone involved in making this phone as great as it is!

TomJ 2010-03-13 19:11

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
I still like the option of setting up a daemon to check a file on a server you have access to for a trigger to send the front cam photo and lat/long to an email address or save it to a server. This means that if it is out of signal range of any network when you try to get hold of it, it can still get the info to you when it finds a network connection...

white_ranger 2010-03-13 20:52

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Very useful. Thanks.

geneven 2010-03-13 21:00

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Useful and funny. I like that it helps with my most likely problem, that my N900 has fallen into an obscure corner of the rubble sometimes called my residence.

lew247 2010-03-13 21:47

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Nice ideas but totally useless if someone has stolen your phone and puts a different sim card in it

synthaxx 2010-03-13 22:36

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by lew247 (Post 566355)
Nice ideas but totally useless if someone has stolen your phone and puts a different sim card in it

He'd better have wiped the phone too, because if the sim card has a data connection, this script will still upload the current IP to your server.

zail 2010-03-13 22:56

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
That's a pretty cool thing to be able to do!

Does the phone need to have active internet connection for this to work or just be switched on?

craftyguy 2010-03-13 23:16

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
This is a nice idea and all, but how do you expect to SSH to the device if it is connected to a GSM network only? In my experience, devices on cellular GSM data networks are NAT'd behind a firewall with hundreds of other devices, so unless they explicitly forward SSH to your device, there's no way you can connect to it..

I just connected my N900 to a GSM data network, viewed IP for gprs0 in ifconfig, and even visited 'whatismyip.org' to verify, and I was unable to SSH to the device, or even ping it.

Unfortunately, unless the device somehow 'knows' it is stolen and phones home, or the thief connects to a wifi network that explicitly allows SSH forwarding to the device, it's as good as gone.

benh_n900 2010-03-13 23:24

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
I am pretty sure you could also use dynamic dns to keep track of your IP, but I have never tried it before, so not sure how to set it up.

synthaxx 2010-03-13 23:37

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
@craftyguy:

In testing this i was consistently able to setup a connection using the public IP, but this might not work for your provider.
Instead you could go the reverse port forwarding route.
This will require you have an ssh-able server on the other end, not to mention you'd still need some way to consistently reconnect. If someone has a version of autossh that runs on the phone that'd be ideal for this. The unknown however is how a permanent connection will affect the battery life.

As said, this is not meant to be a all inclusive guide, more of a list of pointers and commands that, should your phone be lost, can be used to track it down.

@benh_n900:
I've added this link to the above guide which has information on how to do that.
Personally I don't like to give it a DNS for fear of it getting hit too hard from outside sources. The only person who should have access to it is me. The method in the guide ensures that.

craftyguy 2010-03-13 23:42

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by synthaxx (Post 566435)
@craftyguy:

In testing this i was consistently able to setup a connection using the public IP, but this might not work for your provider.
Instead you could go the reverse port forwarding route.
This will require you have an ssh-able server on the other end, not to mention you'd still need some way to consistently reconnect. If someone has a version of autossh that runs on the phone that'd be ideal for this.

As said, this is not meant to be a all inclusive guide, more of a list of pointers and commands that, should your phone be lost, can be used to track it down.


Interesting concept. For the record, I'm on T-Mobile here in the US.

n61adm 2010-03-13 23:51

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Great GUIDE!

synthaxx 2010-03-14 00:02

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by TomJ (Post 566259)
I still like the option of setting up a daemon to check a file on a server you have access to for a trigger to send the front cam photo and lat/long to an email address or save it to a server.

As would i, but since it's not available yet i still wanted a way to get it back. Using this guide when a deamon is available will allow you to even install it if it's still lost.
Think of this as a fallback option. That's why it has single line (easily copy+pasted) commands in it.

Crogge 2010-03-14 00:06

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Really useful tutorial, didn't had a clue till now how I can make it vibrating with commands, or how to make a call that way and stuff, thanks :)

The only part which I can't get working is:

Quote:

gst-launch v4l2src device=/dev/video1 num-buffers=1 ! ffmpegcolorspace ! jpegenc ! filesink location=frontcam.jpg
It say's unknown command (Qst-launch)

synthaxx 2010-03-14 00:08

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by Crogge (Post 566451)
It say's unknown command (Qst-launch)

That could be the problem ;) (it's gst-launch, also keep in mind that these commands are CaSe SeNsiTiVe :D)

synthaxx 2010-03-14 00:17

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by craftyguy (Post 566437)
Interesting concept. For the record, I'm on T-Mobile here in the US.

I'm on T-Mobile Netherlands, and even accessing the webserver on the public IP seems to work. Sucks that it doesn't work the same way for everyone.

It got me thinking though, if instead of the "write ip to a file" line in the if-up script you put a reverse port forward like:
Code:

ssh -R 2210:localhost:22 [yourserver]
would that consistently reconnect an ssh session to your server without any problems?

Might be worth trying out.

TomJ 2010-03-14 08:15

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by synthaxx (Post 566447)
As would i, but since it's not available yet i still wanted a way to get it back. Using this guide when a deamon is available will allow you to even install it if it's still lost.
Think of this as a fallback option. That's why it has single line (easily copy+pasted) commands in it.

Oh, I'm not denigrating your good work here, just looking at a next step. You seem to have all the necessary scripts for uploading the recoverry gen; is it possible to trigger them using, frinstance, alarmed?

Aranel 2010-03-14 15:41

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by TomJ (Post 566259)
I still like the option of setting up a daemon to check a file on a server you have access to for a trigger to send the front cam photo and lat/long to an email address or save it to a server. This means that if it is out of signal range of any network when you try to get hold of it, it can still get the info to you when it finds a network connection...

And.. Is there any HOWTO available to do it?

ecksun 2010-03-14 19:40

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Excellent collections of one liners synthaxx, here is what I modified:

Writing your IP to a file does not really have anything to do with ping reply, so for better abstraction I created a new file instead of editing /etc/network/if-up.d/00_disable_icmp_echo_reply
I named it /etc/network/if-up.d/10_send_ip
Code:

#!/bin/sh
ifconfig gprs0|awk '/inet addr/ { print $2 }'|awk -F: '{ print $2 }' > /tmp/n900ip

I might also mention that I had some problems SCP:ing the file to my server, considering the script isn't run as my user, my SSH config doesn't get used, add the -F parameter in order to use a specific config file.

Code:

scp -F /home/user/.ssh/config /tmp/n900ip

You can also skip saving the IP to a file by changing the file 10_send_ip to:

Code:

#!/bin/sh
SERVER_HOST=remote.computer.org
LOGGFILE=n900_ip_logg
ip=`ifconfig gprs0|awk '/inet addr/ { print $2 }'|awk -F: '{ print $2 }'`
ssh -F /home/user/.ssh/config $SERVER_HOST "echo `date` $ip >> $LOGGFILE"


synthaxx 2010-03-15 09:47

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
@ecksun
Thanks! I was just trying to get this to go directly to an ssh session, and yours works very nicely.

I agree that putting it in the disable echo reply script is not the prettiest method, but since that script will only execute with an external connection it'd do for now.


Got me thinking too. What if you have the script checking for a specific file, something like "stolen" on your server. If that file exists, start a reverse portforward.

That way, if you make that file it'll start an ssh which allows people that don't have direct access to the ssh session via their public ip to still access it remotely.

ecksun 2010-03-15 16:29

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Oh, I see, that would be easy to check though, can update the script in a little while (to check for external connection), however that might not always be desired?

It doesn't sound too hard to start a reverse port forward if there exists a file on the server, however it might take a while for the phone to recognize the file considering it only checks for it when a new connection is established. Could be crontabed though.

Just on a side note, the N900 and the SSH server does per default accept connections even on the gprs0 interface? I'm having some troubles connecting but my ISP claims they don't block any ports :/

Edit: I beleave I just have to add the following line to the file, though i have not tested it..

Code:

if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then
        exit 0
fi

So in the end the file /etc/network/if-up.d/10_send_ip would look like this

Code:

#!/bin/sh

if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then
        exit 0
fi
SERVER_HOST=host.to.server.org
LOGGFILE=n900_ip_logg
ip=`ifconfig gprs0 | awk '/inet addr/ { print $2 }' | awk -F: '{ print $2 }'`
ssh -F /home/user/.ssh/config $SERVER_HOST "echo `date` $ip >> $LOGGFILE"


dhcmega 2010-03-15 23:22

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
It could be triggered by SMS to the phone.
If SIM card changed, then detect it and use it to send an SMS to other phone, so you will have the new SIM's phone number.

hellnick 2010-03-18 18:05

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
This is fascinating stuff.

I am still thinking about how to get this script working on my N900 and about where it should send the file to, but I'm also wondering if we could have a little more information included in the file before it's sent. Nearby wireless AP for example. I know that iwlist wlan0 scan will give me MAC addresses and power levels and I can then use something like http://outflux.net to /geoloc/ to get a street.

Does this sound possible or have I missed the point?

Venomrush 2010-03-18 18:27

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
What I learnt from this, if I manage to nick a N900, I'll flash it :p
firmware AND eMMC just to be safe that no one can track me down :p

also i will buy a simcard with data connection blocked and use with the stolen phone :p

solution:
implement some sort of security protection for Flasher

speculatrix 2010-03-19 11:06

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
I hacked up a script, designed to be run in a cron job, which gathers information about the machine's current internet connection and send it hidden in a ping message as well as via a UDP packet; I didn't think to interrogate the GPS as none of my computers have one built in, it'd be easy to add. The only thing it needs is

Here it is, please attempt improvements or offer ideas.

http://pastebin.com/SHf1ynzj

mgardina 2010-03-19 21:13

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Would there be an easy way to have the phone send this off in an email? I'm thinking that it could run a few times a day and I can filter these off into a folder other than my inbox.

hellnick 2010-03-19 22:08

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by speculatrix (Post 573122)
I hacked up a script, designed to be run in a cron job, which gathers information about the machine's current internet connection and send it hidden in a ping message as well as via a UDP packet; I didn't think to interrogate the GPS as none of my computers have one built in, it'd be easy to add. The only thing it needs is

Here it is, please attempt improvements or offer ideas.

http://pastebin.com/SHf1ynzj

Would you mind explaining this in a little more detail for us "special needs" types? I've never heard of sending info within a ping message and would appreciate it if you could take a few minutes to add a few explanatory notes to your script.

zvogt 2010-03-24 02:55

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Per this python-location thread I suggest adding an additional conditional check to the if statement in you GPS code. I was having problems with the first iteration through the loop returning inaccurate LAT/LONG data. If I only return a value when device.fix[6] is less than a constant (I chose a value of 2000), then I get the results I would expect.

Jerome 2010-03-24 06:29

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Maybe I am pointing the obvious, but it is not necessary to use dyndns. If you have a voip account active on your N900, its i.p. is known from the registar.

casper27 2010-03-24 09:10

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Any further with this guys? I can execute all the scripts via ssh in my won lan or when the phone is connected to another Lan. Its just when it is connected to data plan connection im hitting a stumbling block. I think Vodafone UK block it maybe?
There was a application a while back called RemoteSecurity that locked the phone when you sent a particular message to it. It had a few bugs but it worked.
Could it not work if say you nominate a Mob number as emergancy contact. If you then send a particular word/phrase from that mobile it could then lock the pone and send all this data Gps position ect back to nominated number. Also if a new sim is detected it could send the data to the emergancy number aswell as IP address if connected to WLan.

ny-hardcore 2010-03-24 13:12

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
i just got ddclient to work so it can update my dynamic IP adress (http://sourceforge.net/apps/trac/ddclient)

only one problem: perl on de n900 seems to lack the sys/hostname.pm module.
so i copied this from my ubuntu box to the n900 , made the configfile in /etc/ddclient, made a /var/cache/ddclient dir and the ddclient is running and updating my ip adress with zonedit :D
very happy with this..

planning to run it every time the gprs0 goes ip .. if its on wifi i guess remote ssh'ing is useless when stolen, they have to forward all ssh traffic for this to work..

Sonny_Jim 2010-03-28 02:25

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
I saw this thread but immediately saw that it is not going to work unless you use the phone to intiate a reverse ssh tunnel to a remote host, due to most internet connections being NAT.

My solution which I have finally got working is this:

1. setup an ssh server on a remote host that is on the internet. I run it on port 443 as it's unlikely that it'll get blocked

2. setup key file based login on the server and copy the public key to the phone. This is the fiddly step.

3. create a file in /etc/network/if-up.d/ that contains something like:
ssh -o ExitOnForwardFailure=yes -vvnTNx -p 443 -R 22222:localhost:22 user@remotehost

This way, every time it connects to the internet, it will try to create a reverse tunnel to your remote host. Then if I need to connect to my phone, I do the following command on my remote host:

ssh -p 22222 localhost

hope this helps.

Jerome 2010-03-28 06:26

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by Sonny_Jim (Post 584967)
I saw this thread but immediately saw that it is not going to work unless you use the phone to intiate a reverse ssh tunnel to a remote host, due to most internet connections being NAT.

Why not use the built-in sip client? Not only it always store the N900's i.p. in the registar (and you can normally get the i.p. of your N900 from the web interface of your int. phone company), but it will also open a port in the NAT router so that it can be called.

If you use sipphone (which is the company behind gizmo), you can logon using your user i.d. and get the i.p. and the open port of your N900. You can also use any port, not just 5060.

benh_n900 2010-03-28 16:41

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by Sonny_Jim (Post 584967)
3. create a file in /etc/network/if-up.d/ that contains something like:
ssh -o ExitOnForwardFailure=yes -vvnTNx -p 443 -R 22222:localhost:22 user@remotehost

This way, every time it connects to the internet, it will try to create a reverse tunnel to your remote host.

From my basic understanding of how Maemo works, this will happen whenever the internet connection is brought up. I am currently roaming, so I don't want to accrue data charges while I am not connecting to wifi.
My question is this - if I only allow the device to connect to the internet via wifi, is there any way that this tunnel could use one of the other interfaces to send/receive data? (they go up, even if they don't get an internet connection, right?), or is it constrained by my internet connection choices?

Ben

Sonny_Jim 2010-03-28 20:47

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

but it will also open a port in the NAT router so that it can be called.
Maybe it'll be able to get the port forwarded, but then maybe it's behind a very restrictive firewall. I feel that using a reverse tunnel on port 443 to a remote host is the bulletproof method:

It can be hidden at a very low level (/etc/inittab) and doesn't rely on any kind of user input, only that the thief has the phone switched on whilst near any open wifi.

You can make the phone connect to a different server by updating the dns of the remote host you programmed it to connect to. So, say you needed to bring down the remote server, you could put another in it's place without having to reprogram the phone.

Pretty much every firewall in the land allows port 443 and traditionally it's not monitored that heavily, as most traffic across it is expected to be encrypted/

Quote:

Originally Posted by benh_n900 (Post 585576)
My question is this - if I only allow the device to connect to the internet via wifi, is there any way that this tunnel could use one of the other interfaces to send/receive data? (they go up, even if they don't get an internet connection, right?),

There is a global var that tells you whether you are connected via wlan or gprs, so you can use that to stop it from sending data when it's using GPRS:

if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then

It could quite easily use GPRS and shouldn't use much bandwidth at all unless you use the tunnel. I was thinking of having some rules as to when it should try and use GPRS to connect, something like no connection for a week via WLAN, try using the GPRS. It would be nice to work out a script that collected as much geographical/call related information, encrypt it then use the ssh tunnel to drop it off at the remote server.

benh_n900 2010-03-29 02:21

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by Sonny_Jim (Post 585874)
There is a global var that tells you whether you are connected via wlan or gprs, so you can use that to stop it from sending data when it's using GPRS:

if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then

It could quite easily use GPRS and shouldn't use much bandwidth at all unless you use the tunnel.

I looked at that and played with it, but it always seems to have no value in it for me, but then I am only connecting via wifi right now as I am roaming abroad, hence don't want to use non-wifi internet because of the data charges.

Thanks though!

Ben

zimon 2010-04-02 17:45

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by synthaxx (Post 566224)
Code:

...
def on_changed(device, data):
    if not device:
        return
    if device.fix:
        if (device.fix[1] & location.GPS_DEVICE_LATLONG_SET) and (device.fix[1] & location.GPS_DEVICE_TIME_SET) and not (device.status & location.GPS_DEVICE_STATUS_NO_FIX):
            print "lat = %f, long = %f" % device.fix[4:6]
            data.stop()
...

loop.run()

Now save and run it with

Code:

python2.5 gps.py
If everything goes well you'll get a LAT LONG you can plug into google maps.
If it's out of GPS range, you'll have to kill it with CTRL+C.

How to change that Python script to get altitude also?
(Sowwy for being lazy and not look it up from specs myself.)

ecksun 2010-04-06 14:08

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by zimon (Post 592855)
How to change that Python script to get altitude also?
(Sowwy for being lazy and not look it up from specs myself.)

Code:

$ diff oldgps.py gps.py
14c14
<            print "lat = %f, long = %f" % device.fix[4:6]
---
>            print "lat = %f, long = %f, alt = %f" % (device.fix[4:6] + (device.fix[7],))

Hopefully that will help :)

oay_usman 2010-04-06 19:01

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
hi , i need some help from you guys , my mobile(n900) is stolen . i m living in Qatar . is there any way that i can track the location of my mobile . plz help

speculatrix 2010-04-08 09:23

Re: N900 physical recovery (Getting your phone back!) [HOWTO]
 
Quote:

Originally Posted by Sonny_Jim (Post 584967)
1. setup an ssh server on a remote host that is on the internet. I run it on port 443 as it's unlikely that it'll get blocked

it's easier to set up openvpn!


All times are GMT. The time now is 17:47.

vBulletin® Version 3.8.8