thor77 / blueproximity Goto Github PK
View Code? Open in Web Editor NEWRun a command once a bluetooth device is in/out of a range
License: GNU General Public License v2.0
Run a command once a bluetooth device is in/out of a range
License: GNU General Public License v2.0
Hi,...
in 1.1.7 the MAC of the preferred device will not be saved to config file.
i added the MAC by hand to "~/.blueproximityrc" and i works wonderfull.
Thank you for this very nice piece of software!
i'm using:
Fedora Core 6 (2.6.22.2-42.fc6)
with:
gnome-python2-2.16.2-2.fc6
pybluez-0.9.1-3.fc6
python-configobj-4.3.2-5.fc6
bluez-libs-3.9-1.fc7
gnome-bluetooth-libs-0.7.0-12.fc6
bluez-utils-3.9-1.fc7
bluez-gnome-0.6-2.fc7
bluez-hcidump-1.33-1.fc7
gnome-bluetooth-0.7.0-12.fc6
gnome-bluetooth-devel-0.7.0-12.fc6
bluez-libs-devel-3.9-1.fc7
trying to start blueproximity, I get:
bob:~/blueproximity-1.1.5 # ./start_proximity.sh
Traceback (most recent call last):
File "proximity.py", line 27, in <module>
from configobj import ConfigObj
ImportError: No module named configobj
Hi,
On OpenSuse 11.3 with the latest 1.2.5 build, the connection is succesfully created, but monitoring it appears to have adverse effects. It's an Android 2.2 phone, and when in the vicinity of the computer the computer will lock and then immediately unlock every minute or so, depending on which channel is being monitored.
Only 4 channels are available according to the scan, and I've tried them all. Some have it locking and unlocking every 15 seconds, others every 3 minutes. Here's an excerpt from syslog if it helps. The phone is paired with the computer, and works well in all other regards.
Oct 28 11:49:43 wmws0001 blueproximity[25580]: screen is locked
Oct 28 11:49:44 wmws0001 blueproximity[25580]: screen is unlocked
Oct 28 11:49:46 wmws0001 bluetoothd[9802]: link_key_request (sba=00:0F:EA:94:57:B3, dba=38:E7:D8:44:7F:0C)
Oct 28 11:49:46 wmws0001 blueproximity[25580]: screen is locked
Oct 28 11:49:47 wmws0001 blueproximity[25580]: screen is unlocked
Oct 28 11:49:49 wmws0001 bluetoothd[9802]: link_key_request (sba=00:0F:EA:94:57:B3, dba=38:E7:D8:44:7F:0C)
Oct 28 11:49:50 wmws0001 blueproximity[25580]: screen is locked
Oct 28 11:49:51 wmws0001 blueproximity[25580]: screen is unlocked
Oct 28 11:49:53 wmws0001 bluetoothd[9802]: link_key_request (sba=00:0F:EA:94:57:B3, dba=38:E7:D8:44:7F:0C)
Oct 28 11:49:53 wmws0001 blueproximity[25580]: screen is locked
Oct 28 11:49:54 wmws0001 blueproximity[25580]: screen is unlocked
Oct 28 11:49:57 wmws0001 bluetoothd[9802]: link_key_request (sba=00:0F:EA:94:57:B3, dba=38:E7:D8:44:7F:0C)
Oct 28 11:49:57 wmws0001 blueproximity[25580]: screen is locked
Oct 28 11:49:58 wmws0001 blueproximity[25580]: screen is unlocked
Hope this helps
Kyle
When leaving the software the rfcomm connection does not stop/is not killed properly
When running blueproximity, my mobile phone asks me for a pin. When I enter the pin from /etc/bluetooth/pin, I get the error "could not connect" ("Kopplung fehlgeschlagen") on the mobile phone. blueproximity stays in the state "no connection found, trying to establish one".
Occasionally, I will return to my computer when it was locked by bp and find that the machine (Lenovo T60p running Ubuntu 10.04, fully patched) will be shutdown. The system log shows nothing out of the ordinary. Here's an example from today's event:
Nov 4 16:14:26 bozzano blueproximity[2511]: screen is locked
Nov 4 16:14:55 bozzano kernel: Kernel logging (proc) stopped.
Nov 4 16:17:54 bozzano kernel: imklog 4.2.0, log source = /proc/kmsg started.
Nov 4 16:17:54 bozzano rsyslogd: [origin software="rsyslogd" swVersion="4.2.0" x-pid="887" x-info="http://www.rsyslog.com"] (re)start
...
it is not possible to put a direct link into a desktop menu since one has to be in the directory itself to start it (otherwise pixmaps not found)
temporary fix: build a start script that does the magic...
The package dependencies should include version numbers of dependent packages as e.g. the pygtk needs at least 2.10 for icon support. To better support other platforms than Ubuntu Feisty this should be changed.
The logic for checking if python modules are working has a logic error. It runs 3 tests not 2 so the check on IMPORT_BT!=2 should say IMPORT_BT!=3:
start on line 96:
IMPORT_BT=0
try:
import bluetooth
IMPORT_BT = IMPORT_BT+1
except:
pass
try:
import _bluetooth as bluez
IMPORT_BT = IMPORT_BT+1
except:
pass
try:
import bluetooth._bluetooth as bluez
IMPORT_BT = IMPORT_BT+1
except:
pass
if (IMPORT_BT!=3):
print _("The program cannot import the module bluetooth.")
print _("Please make sure the bluetooth bindings for python as well as bluez are installed.")
print _("e.g. with Ubuntu Linux, type")
print _(" sudo apt-get install python-bluez")
Scanning leads to this error:
Traceback (most recent call last):
File "proximity.py", line 466, in cb_btnScan_clicked
macs = self.proxi.get_device_list()
File "proximity.py", line 735, in get_device_list
nearby_devices = bluetooth.discover_devices()
File "/usr/lib/python2.5/site-packages/bluetooth.py", line 277, in discover_devices
raise BluetoothError("error communicating with local "
bluetooth.BluetoothError: error communicating with local bluetooth adapter
if the already entered BT address is unreachable and not empty. It seems that the BT adapter is kind of in use trying to connect to that device and we are not to disturb it during that period. (Either that or there is actually a good function hidden somewhere that allows us to do exactly that.)
I have no notification area, so I can't click on the blueproximity icon (because it is not displayed anywhere), so I can't use the program. I suggest you fix this by adding a command line flag for --config (and also --version and --help while you're at it!).
The attached patch adds Appindicator support for Ubuntu's notification area.
Since the *.deb version cannot be installed on ubuntu 7.10 because of unresolved package problem with python, I used alien to convert that package to deb. Unfortunaltely only a short startup window appeares when I'm trying to start it. No further icon in the notification area..
Hi,
I'm trying to package blueproximity for debian, I'm only waiting for a sponsor for the upload.
I've created a man page, if you like it, can you include in source tarball?
thanks,
francesco
Hi,...
not really a bug, but i suggest not to use "<small>Text</small>" in proximity.glade.(Line 285) If one use very small system fonts, as i do, this Text strings becomes barely readable. Please refer to the attached screen shot. I would also suggest, that formatting information stays out of the LANG files, so that changing formatting becomes more easily without generating new LANG.po files.
Just me 5ct. :-) I like your program very much.
best regards
Stefan
One may click on it but it does not do anything.
When starting the settings window actually appears for parts of a second and afterwards after being activated via the icon for the first time - it is located at the upper left corner whereas all other activations show it in the center of the screen.
This has only started since the New Year (when I suspect I took a bunch of new updates):
Start blueproximity
Start an OpenOffice writer document (can be empty or not)
Wait ...
After a certain amount of time (around 20 secs for me, but I guess it's based on my blueproximity settings), the "File" menu on OpenOffice Writer will come up.
After the same amount of time, it will disappear.
Quit blueproximity, and the behaviour disappears.
This took me quite some time to track down, but I suspect it's related to this behaviour (libxine): https://bugs.launchpad.net/ubuntu/+source/xine-lib/+bug/216939
Blueproximity is a fantastic, fantastic app, and I'd hate to have to stop using it, so fix would be brilliant, please!
Ubuntu karmic, amd64
Gnome 2.28.1
blueproximity 1.2.5-4
openoffice.org-core 1:3.1.1-5ubuntu1
gnome-screensaver 2.28-0ubuntu3.2
Running 1.2.5 on Fedora 10 I notice that if I'm gone for a longer period of time +30 minutes ... my network gets disconnected.
I'm using Network Manager ...
I used the .deb file to install on Ubuntu 7.04 Feisty Fawn.
The screen is not automatically locked, it just go to sleep like a black screensaver and returns without any password.
I download the source and changed two lines (51 and 52) on proximity.py with the following:
'lock_command=string(default=''gnome-screensaver-command --lock'')',
'unlock_command=string(default=''gnome-screensaver-command --deactivate'')',
and it worked.
I also tried the older commands on a terminal ("gnome-screensaver-command -a" and "gnome-screensaver-command -d") and they did not work, just a black screen.
Great application! Please check this so that everybody can use it.
The .desktop file in addons contains Icon[de_DE]=, which is not valid (Icons are not localized). This causes other apps (like yelp for example) to nag whenever it scans .desktop files.
The attached patch simply removes the de Icon.
In "proximity details", I find an option "Distance". As to what I have read, I can enter here a number how much the signal strength decreases before the screen gets locked. However, I do not have a possibility to check my signal strength in the program - can you please provide one ?
Launchpad Link: https://bugs.launchpad.net/ubuntu/+source/blueproximity/+bug/286820
I found a couple ways to bypass blueproximity.
First off, it's either this applet or another one that doesn't immediately detect the correct range. It can take a significant amount of time for the lock limit to be reached when the proximity isn't set very high.
This can give an attacker just enough time to get on the system and do a few malicious actions, or worse would be the following.
The second thing an attacker could do using either the gap of the maximum proximity or the afore mentioned is kill blueproximity. If an attacker just right clicks the applet and clicks quit or opens a terminal and uses kill (god forbid kill -9) they will not need to worry about what the maximum proximity is.
The best way I can think of to overcome this is have a blueproximity daemon. Once the daemon detects the blueproximity applet is killed, then the lock command is executed. Remembering that the daemon will run as root only and the user and blueproximity will not interact with this device other than when the daemon requests something.
This opens up another security concern. If this occurs then an attacker could quickly change the lock command. No only that, but they could change the proximity limit to the maximum. This will make the system stay unlocked until the device is completely out of range which takes a good distance to do. Yes - this can be done with changing MAC or
A simple resolve here would be to force any setting change to only become effective after a restart of the application. This could even be performed by a right click option. The point here being that it causes the application to detach and the system to lock. This will force the user to acknowledge any changes with minimal interruption.
So...
Don't take any of this personally. I think this is an excellent application. I see that this could be extremely reliable at some point. Unfortunately, because of the items mentioned in this bug report, I don't see it as a secure setup.
I have Ubuntu 7.04 and OpenSUSE 10.2 and a Nokia 6230. Using either Ubuntu or SUSE, blueproximity does not work. When I leave the computer with my mobile phone, blueproximity changes to status "gone", but does not switch on the screensaver. If I manually execute the "Locking command", the screensaver does start.
BlueProximity sometimes can't tell two devices apart?, and gives both devices the same signal strength.
blueproximity 1.2.5-4 (lucid)
I have two bluetooth devices besides the computer, say one at a distance of 0 and another at a distance of 26 from the computer. Blueproximity starts off giving them different distances, but eventually it will say that they are both at the same distance, some seconds it'll say they are both 26, other seconds it will say they are both 0, even though none of those bluetooth devices has moved in between those seconds.
Sometimes the GUI doesn't show while restoring it from notification area (shows an empty window).
Some traductions missing (Some phrases in english, others in german)
Major problem : can't activate the locking functionality, always on simulation mode (Simulationsmodus?)
Apply button missing from GUI.
Despite the fact I can't use it, good job it sounds promising!
I'm on ubuntu feisty 2.6.20-16 french with compiz fusion, version 1.1.9.
Starting start_proximity yields in
bob:~/blueproximity-1.1.5 # ./start_proximity.sh
['/usr/lib/python2.5/configobj.py']
(2, 5, 0, 'final', 0)
2.5 (r25:51908, May 25 2007, 16:14:04)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)]
Traceback (most recent call last):
File "proximity.py", line 37, in <module>
from validate import Validator
ImportError: No module named validate
Your README.txt reads like this:
Installation - blueproximity
that means, start_proximity.sh is contained in parpwatch ? Please clarify.
In /usr/share/doc/blueproximity/manual.html:
>There are two ways of installing BlueProximity. One and by far the easiest is by installing the Ubuntu (Feisty) package that can be downloaded via sourceforge.
Should read
>There are two ways of installing BlueProximity. One and by far the easiest is by installing the Ubuntu (Hardy) package that can be downloaded via sourceforge.
Error Message:
File "proximity.py", line 671
class ScanDevice\(\):
^
SyntaxError: invalid syntax
I have changend the line in proximity.py to
class ScanDevice:
This worked for me ...
System Gentoo :)
best regards,
Ronny
Error reported is:
X Error: BadDevice, invalid or uninitialized input device 169
Major opcode: 147
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 169
Major opcode: 147
Minor opcode: 3
Resource id: 0x0
Failed to open device
Traceback (most recent call last):
File "/usr/share/blueproximity/proximity.py", line 728, in <module>
pGui = ProximityGUI(p,config,new_config)
File "/usr/share/blueproximity/proximity.py", line 108, in init
self.window.set_icon(gtk.gdk.pixbuf_new_from_file(dist_path + icon_base))
gobject.GError: Couldn't recognize the image file format for file '/usr/share/blueproximity/blueproximity_base.svg'
BlueProximity 1.2.5 causes repeated asking for password.
For the 'Locking command' I'm using:
/usr/lib/kde4/libexec/kscreenlocker_greet --immediateLock & xset dpms force off;
To stop it from repeatedly asking for my password I can:
Kill BlueProximity from CTRL+ALT+F2(any F1..F6 will do), and then go back to X, CTRL+ALT+F7(maybe F7..F12?), or
In the seconds before it re-locks the screen after I enter a correct password, I can click on the BlueProximity tray icon and get a BlueProximity window to pop up.(most of the time I need to keep retrying for this) Once the BlueProximity window shows up, even when I close this window, it stops repeatedly asking for my password.
With two different SonyEricsson K800i, and two different bluetooth dongles, it shows always negative distances:
-12 at 50cm, -7 at 1m, and so on...
The min/max data indicates: min:-31 max:255
This is the Hardy (1.2.4 version). Please, order me any other data you need.
Thanks.
To be found here:
http://developer.gnome.org/projects/gup/hig/2.0/
Would please somebody experienced with GNOME HIG have a look at the gui and tell me what to change. The HIG is a bit complicated for non native speakers...
As there is none at the moment it would be nice to be informed of what's going on and what is not working out. That should at least include
having a broken .blueproximityrc file,
using an unwritable logfile,
action commands not working out or taking too long to execute,
a mac address with the wrong format.
This utility works fantastic with my Ubuntu installation. I have even more need for this tool at work. Unfortunately, I only run on RHEL 5. I'd be happy to support this change as much as possible. Please let me know if I can help bring this to fruition.
With ubuntu 10.10 and python 2.6.6
/usr/share/blueproximity/proximity.py:186: GtkWarning: GtkSpinButton: setting an adjustment with non-zero page size is deprecated
self.wTree = gtk.glade.XML(self.gladefile)
Support for RHEL5? I think I already submitted this request. Is this a possibility or not?
«««
While investigating an unrelated issue, I found that blueproximity calls the proximity command twice as often as configured.
Steps to reproduce:
I would expect to see a timestamp every ~50 seconds... instead I see two. Here's my specific result:
Fri Jan 2 01:52:07 CET 2009
Fri Jan 2 01:52:25 CET 2009
Fri Jan 2 01:53:07 CET 2009
Fri Jan 2 01:53:25 CET 2009
Fri Jan 2 01:54:08 CET 2009
Fri Jan 2 01:54:24 CET 2009
Fri Jan 2 01:55:08 CET 2009
»»»
Please see https://bugs.launchpad.net/ubuntu/+source/blueproximity/+bug/313040 . A patch is provided there.
Traceback (most recent call last):
File "proximity.py", line 57, in <module>
print ("The program cannot import the module bluetooth.")
NameError: name '' is not defined
Change:
import _bluetooth as bluez
in
import bluetooth._bluetooth as bluez
Hello,
I am using v. 1.2.3 tarball, with a sony-ericsson w880i.
Everything is fine, except that, when i take my phone above locking distance, the proximity detected by the software is looping over.. so it goes from 0 to 6 to 18 (where it should stay at the phone is not moving), but it goes back to 0, etc... hence unlocking the screen or not doing anything at all, since the software doesn't think it stays far away for enough time.
In Proximity.run() loop, blueproximity calculates sleep cycles that it assumes to be of 1 second. Unfortunately BluetoothSocket.connect() blocks for long time if device goes out of range (for me it's usually 3-6 seconds) before it gives up. This makes computer locking time settings completely wrong and the locking time can be over 30 seconds in addition to the detection of device losing contact (that can easily take over 10 seconds by bluetooth driver). Second place where program blocks is the gobject.timeout_add() method. This is actually executed in the same thread as the user interface and if there are long-running processes (like playing a few second sound clip) or if I change the BluetoothSocket.connect() method to use this method, GUI will be unusable when device goes out of range.
This patch uses real clock time (with sleep detection) to handle bluetooth proximity events and separate threads for program and connection execution so that no blocking operation can prevent other operations from executing.
$ start_proximity.sh
Traceback (most recent call last):
File "proximity.py", line 1274, in <module>
config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),{'create_empty':True,'configspec':conf_specs})
File "/usr/lib/python2.6/site-packages/configobj.py", line 1206, in init
DeprecationWarning, stacklevel=2)
TypeError: warn() takes at most 3 arguments (4 given)
installed:
extra/bluez 4.59-1
Libraries and tools for the Bluetooth protocol stack
local/bluez-python 0.1.4-1
A BlueZ python binding on top of dbus-python
community/python-pybluez 0.18-1
Python wrapper for the BlueZ Bluetooth stack
extra/python 2.6.4-1
A high-level scripting language
proximity.py is consuming 4 GB of the 12 GB RAM on this system.
Ubuntu 10.04.1
blueproximity 1.2.5-4
up 48 days
x86_64 Intel Xeon CPU W3540
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30533 me 20 0 4431m 4.0g 9476 S 6 33.9 323:33.41 python /usr/share/blueproximity/proximity.py
valgrind tells me that hcitool leaks 24 bytes each time it returns "Read RSSI failed: Input/output error" but I don't think this happens often enough to account for the 4GB even if python's child reaping is somehow broken. Does anyone have suggestions of where to look?
The consumption of 2 pids every second for the sh -c hcitool rssi <mac> is kinda noisy. How much work would it be to use python-bluez for the rssi query?
According to https://sourceforge.net/forum/forum.php?forum\_id=734867, blueproximity 1.2 is available, but I cannot download it from https://sourceforge.net/project/platformdownload.php?group\_id=203022&sel\_platform=3886
editing the ~/.blueproximityrc
the lock and unlock commands ar added with a space bevore so the command sh anything are not recognised by the interpreter
I tryed the folowing:
lock_command = xscreensaver-command -activate
unlock_command = xscreensaver-command -deactivate
both did not work with the error:
command not found
by modifiying the two lines to:
lock_command="xscreensaver-command -activate"
unlock_command="xscreensaver-command -deactivate"
it worked once but overwrote these lines with the first two.
making the file read only did not work, because the programm did not start at all.
Please Fix this, so kde users could use the programm too.
Thanks
Valentin
vz1[remove]@gmx.net
Every time I use blueproximity my keyboard gets unresponsive after a while. I've been having this issue since the release of Hardy, and couldn't figure out the reason at first. But now I've realized that it's every time I use Blueproximity.
I love this program, but it freezes the screen occasionally. When it happens, the mouse works, and will hover over things, but not click, change focus, scroll, or anything. I figured out that moving the phone away and locking it fixes it, but it happens really often, sometimes every few minutes.
Hi,...
when proximity is loaded and in "pause mode", it prevents
the regular startup of my screensaver. If the device is in range, the screensaver will never switch on.
best regards
sigh A really dumb error using the _() translate function before actually initializing and activating gettext functions. Error messages while importing should be either all English or the imports must be done after initializiation of gettext stuff.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.