Finding Your Phone, the Linux Way

 in
If you have a Nokia N900, you can set it up so that it helps you find it the next time you lose it. The methods shown here, with modifications, can be used on other Linux phones as well.

I decided it would make the most sense to watch for three different actions:

  • The phone changing networks.

  • The keyboard being opened or closed.

  • Low power.

If the network changes, that probably means the phone is on the move (maybe I left it in a car). If the keyboard is opened or closed, someone is using or looking at the phone. Finally, if the phone is just sitting there, eventually the batteries will drain away (and I'd like to find the phone before all power is gone).

The three lines in dbus-scripts-settings that watch for those actions are the following:

/home/user/lost.sh * * com.nokia.icd * * * CONNECTED
/home/user/lost.sh * * org.freedesktop.Hal.Device \
                           Condition ButtonPressed cover
/home/user/lost.sh * * com.nokia.bme.signal battery_low

The lost.sh script is called each time one of those events occurs. The dbus-scripts Wiki page (wiki.maemo.org/DbusScripts) has more information on formatting the configuration lines.

See the lost.sh script (Listing 1) for details of what it does. One thing I found in testing is that some of the commands I can run on the command line do not work at all when called from a script by the dbus-scripts dæmon. These include the mplayer command and setting the phone to nonsilent mode. Thankfully, other commands work fine when called from the script.

The final piece of the puzzle was getting the N900 to send at least some of the data it gathered to another phone via SMS. I found a good Python script for sending SMS messages at talk.maemo.org/showpost.php?p=558430&postcount=57.

With the SMS script in place and called by the lost.sh script, all I have to do is create the special file on my Web server, and suddenly my N900 starts sending my designated backup phone (my wife's cell phone) SMS messages whenever one of the events I configured happens.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

how about an Andriod way?

Boo's picture

how about an Andriod way?

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix