Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old February 20th, 2008   #1
Iceni
Gee! These Aren't Roasted!
 
Iceni's Avatar
 
Join Date: Feb 2007
Beans: 176
Ubuntu 7.04 Feisty Fawn
Howto: Use BlueProximity and your cellphone for security

What is it?
  • BlueProximity is a clever program by Lars Friedrichs that sets up your computer to lock itself when your phone is out of bluetooth range, and unlock itself when it comes close enought again. You can also also make it turn off and on the monitor, music, change msn status and pretty much everything you can imagine.
Why do I want it?
  • Ultimate coolness! Nothing is as super cool as just walking up to your computer and watch it come alive without you doing anything. Ok, it can be argued that this is semi-useful, but we will all do it for the coolness factor

How to do it? {installation}

If you use Hardy or newer, blueproximity is in the repos, so simply install the usual way and jump to setup instructions:

Code:
sudo apt-get install blueproximity
If you don't have blueproximity in your reps (older ubuntu than hardy), follow these:

Install dependencies:
Code:
sudo apt-get install bluez-utils python-gtk2 python-glade2 python-configobj python-bluez
We need a newer version of the python-support package:

Code:
wget http://security.ubuntu.com/ubuntu/pool/main/p/python-support/python-support_0.7.5ubuntu1_all.deb
Install it:

Code:
sudo dpkg -i python-support_0.7.5_all.deb

Now lets get the BlueProximity program:

Code:
wget http://ovh.dl.sourceforge.net/sourceforge/blueproximity/blueproximity_1.2.4-0ubuntu1_all.deb (from official site)

- alternate download link -
wget http://mirrors.kernel.org/ubuntu/pool/universe/b/blueproximity/blueproximity_1.2.4-0ubuntu1_all.deb (from ubuntu universe (hardy?) repositories)
Install it:
Code:
sudo dpkg -i blueproximity_1.2.4-0ubuntu1_all.deb

Ok, now it is time to set this up:

Phone settings:
  • Activate bluetooth
  • Scan for your computer and authorize it so you won't need a password

Blueproximity settings:

Code:
blueproximity
  • Scan for devices and select "Use selected device"
  • Then scan channels and select one that comes up as "usable"

That should be it! Now fiddle a bit with your proximity details, don't set them too low but not to high either. I get pretty good results with the settings below, but this will of course differ according to the placement of your computer.

Settings

My settings are:
  • Lock: Distance: 7 | time: 10 - thus it won't lock at once if bluetooth connection gets disrupted, something it seems to do for a second or two.
  • Unlock: Distance: 3 | time: 3 - Unlocks very fast when I get close.

Turning the monitor off
It would be more useful if this could turn the monitor on/off as well, right? If you want this enter the BlueProximity preferences, click the locking tab and use this command::
  • Locking Command: gnome-screensaver-command -l && xset dpms force off
  • Unlocking command: xset dpms force on && gnome-screensaver-command -d
I noticed I had to change the unlock time to 1 to give the monitor time to turn on before I sat down.


Add the program to your startup list:
Of course you want to have it starting with Ubuntu. Go system > preferences > sessions. You should be on the "startup programs" tab. Click "Add" and type "blueproximity" (without the "") and a name and description you want.

This was tested by me on Ubuntu Gutsy with a Samsung D900, and works great. If you try this, please report what phone you got it working with - or not. I don't see this not working because it only really depends on bluetooth from the phone, but you never know. It will be kind of useless if you can't authorize a device on your phone.

Working phones
  • I removed the phone list because .. well this seem to work with everything

Scripts
As some users have alredy pointed out, there are several cool possiblities for this. Many things can be accomplished with simple or more advanced scripts. Despite my very limited knowledge of bash scripts, I attached a simple set of scripts that will do the following:
  • Turn on / off screensaver
  • Turn on / off monitor
  • Check if Amarok is playing and pause - then unpause. If amarok is stopped, this will do nothing.
  • Change your pidgin status to away / available*
*To get the pidgin status to work you need libpurple-bin. (install: sudo apt-get install libpurple-bin)

To use them, download the attached scripts archive, unpack it, make them all executable and stick them in /usr/bin*. If you only want some of the functions, edit the bp_lock and bp_unlock files. Then go into BlueProximity preferences - locking tab and put "bp_lock" and "bp_unlock" as locking and unlocking command.
*command is: sudo cp bp_* /usr/bin

I'm sure more knowledgeable users can make better scripts, but these does the trick for my use

Other scripts
gertvdijk details how to make a start/stop script for rhythmbox
crocowhile teaches us how to change skype status
Red_Five shared the mother of all bp scripts!
Quote:
Here's the script I use now. It's a single, monolithic script that handles away, available, status update messages, and proximity "poking". I've put in lines for several audio players (GNOME; I don't use KDE), Twitter, Pidgin, and even a line to update my Out of Office status in Exchange via Outlook Web Access.
monojohnny made a cool script that makes the computer beep when your phone is stolen

Links
FAQ
  • What happens if the phone runs out of power?
  • Nothing. You can still unlock your computer the traditional way. You don't need the phone at all.
  • What happens if someone unplugs your usb bluetooth dongle?
  • I tried because someone asked. You'll have to unlock your computer manually. If it is inserted again it will work in a minute or so.
  • Where did the python-support install go?
  • I changed it to a safer and faster method. If you need the other one, plase ask me.
  • It works, but my phone lost sound - I have to manually eneable sound - headset has no sound - other sound problems?
  • Do a "sdptool browse" in the terminal and find the channel marked as "object push". Select this channel in BlueProximity preferences. This should do the trick
Attached Files
File Type: gz scripts.tar.gz (792 Bytes, 353 views)
__________________
Against TCPA | Hell, it's about time! | FORZA FERRARI
Almost Sober tour 2008

Last edited by Iceni; September 11th, 2008 at 08:36 AM.. Reason: Updating phone list.
Iceni is offline   Reply With Quote
Old February 20th, 2008   #2
wieman01
Himbeer Brombeer Macchiato
 
wieman01's Avatar
 
Join Date: May 2006
Location: 100acrewood
Beans: 7,184
Kubuntu 9.04 Jaunty Jackalope
Re: Howto: Use BlueProximity and your cellphone for security

Just to say that this is a very interesting tutorial. I have approved it and will keep an eye on it.
wieman01 is offline   Reply With Quote
Old February 21st, 2008   #3
Anduu
Grande Half-n-Half Cinnamon Ubuntu
 
Anduu's Avatar
 
Join Date: Apr 2006
Location: Alberta,Canada
Beans: 986
Ubuntu Karmic Koala (testing)
Send a message via ICQ to Anduu
Re: Howto: Use BlueProximity and your cellphone for security

This is pretty cool.Going to try it out.

One thing though.You need to really stress the importance of switching back to your original repos so as not to hose your system.

Oh and don't forget you will have to lock the version of python-support or it will get downgraded next time you update.
__________________
What color do Smurfs turn when you choke em?
____________________________

Last edited by Anduu; February 21st, 2008 at 02:36 AM..
Anduu is offline   Reply With Quote
Old February 21st, 2008   #4
Iceni
Gee! These Aren't Roasted!
 
Iceni's Avatar
 
Join Date: Feb 2007
Beans: 176
Ubuntu 7.04 Feisty Fawn
Re: Howto: Use BlueProximity and your cellphone for security

Quote:
Originally Posted by Anduu View Post
This is pretty cool.Going to try it out.

One thing though.You need to really stress the importance of switching back to your original repos so as not to hose your system.

Oh and don't forget you will have to lock the version of python-support or it will get downgraded next time you update.
Thanks, I added some red color to stress it a bit


Are you sure about the the need to hold the package? To my (a bit limited) knowledge, apt-get will not downgrade a package?
__________________
Against TCPA | Hell, it's about time! | FORZA FERRARI
Almost Sober tour 2008

Last edited by Iceni; February 22nd, 2008 at 07:38 AM..
Iceni is offline   Reply With Quote
Old February 21st, 2008   #5
red_five
5 Cups of Ubuntu
 
Join Date: Feb 2007
Location: Tri-Cities TN
Beans: 21
Ubuntu 7.10 Gutsy Gibbon
Send a message via ICQ to red_five Send a message via AIM to red_five
Re: Howto: Use BlueProximity and your cellphone for security

There's no need to tweak sources.list for one package installation. Just download the Hardy version from the packages.ubuntu.com listings. Gdebi will complain about an older version being available in the software channels, but it'll still install just fine. No risk of system-hosing.

Oh, and I can confirm that the Verizon Moto RAZR V3m works just fine with BlueProximity.

One other thing: you can put any commands into the lock and unlock text boxes. For example, I created a couple of custom bash scripts to do the locking and unlocking. The lock script activates the screensaver, as well as sets Pidgin to away and pauses Exaile if it's running. The unlock script sets Pidgin to available, hits play on Exaile (again, only if it's running), then pokes the screensaver before deactivating it, to wake the monitors up from sleep. I stuck 'em in ~/bin, made them executable, and set 'em up in BlueProx. Golden!

Last edited by red_five; February 21st, 2008 at 11:55 AM..
red_five is offline   Reply With Quote
Old February 21st, 2008   #6
insert_name_here
A Carafe of Ubuntu
 
Join Date: Nov 2006
Location: North Carolina, USA
Beans: 116
Ubuntu 7.10 Gutsy Gibbon
Re: Howto: Use BlueProximity and your cellphone for security

Wouldn't it be easier to download and install the Hardy version of python-support from the packages.ubuntu.com site, rather than potentially borking my system messing with repos?

(I can't link to the packages.ubuntu.com/ whatever site to find the package itself because the site is down, unfortunately.)

Edit: red_five, you win.

Last edited by insert_name_here; February 21st, 2008 at 12:01 PM.. Reason: He beat me to it ;-)
insert_name_here is offline   Reply With Quote
Old February 21st, 2008   #7
GodsDead
A Carafe of Ubuntu
 
GodsDead's Avatar
 
Join Date: Oct 2007
Beans: 87
Ubuntu 9.04 Jaunty Jackalope
Re: Howto: Use BlueProximity and your cellphone for security

woah ausom idea, i just need a bluetooth adaptor for my PC now 0_o
if i use a bluetooth USB.. if someone takes it out, then what happens?
GodsDead is offline   Reply With Quote
Old February 21st, 2008   #8
Pinkydead
First Cup of Ubuntu
 
Pinkydead's Avatar
 
Join Date: Sep 2005
Beans: 10
Xubuntu 7.04 Feisty Fawn
Nice

Works for Sony Ericsson K750i.
Pinkydead is offline   Reply With Quote
Old February 21st, 2008   #9
Ryanmt
Just Give Me the Beans!
 
Join Date: Oct 2005
Beans: 68
Re: Howto: Use BlueProximity and your cellphone for security

i dont have that line in my repositorys file. I tried looking for the package but the website seems to be down. Can anybody put up a clearer version of how to install python-support.

Thanks

edit -- found a copy here
http://security.ubuntu.com/ubuntu/po...ython-support/

seems to do the trick!

Last edited by Ryanmt; February 21st, 2008 at 01:45 PM..
Ryanmt is offline   Reply With Quote
Old February 21st, 2008   #10
Iceni
Gee! These Aren't Roasted!
 
Iceni's Avatar
 
Join Date: Feb 2007
Beans: 176
Ubuntu 7.04 Feisty Fawn
Re: Howto: Use BlueProximity and your cellphone for security

Quote:
Originally Posted by red_five View Post
There's no need to tweak sources.list for one package installation. Just download the Hardy version from the packages.ubuntu.com listings. Gdebi will complain about an older version being available in the software channels, but it'll still install just fine. No risk of system-hosing.

Oh, and I can confirm that the Verizon Moto RAZR V3m works just fine with BlueProximity.

One other thing: you can put any commands into the lock and unlock text boxes. For example, I created a couple of custom bash scripts to do the locking and unlocking. The lock script activates the screensaver, as well as sets Pidgin to away and pauses Exaile if it's running. The unlock script sets Pidgin to available, hits play on Exaile (again, only if it's running), then pokes the screensaver before deactivating it, to wake the monitors up from sleep. I stuck 'em in ~/bin, made them executable, and set 'em up in BlueProx. Golden!
Thanks for the tip, I'll edit it in when I get home on my own computer. I've been messing around a bit with scripts myself, but mostly exploring possibilities so far. Maybe you could share yours, so I could add them to the guide? Would make a nice extra
__________________
Against TCPA | Hell, it's about time! | FORZA FERRARI
Almost Sober tour 2008
Iceni is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:08 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry