maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Request] N900 Bluetooth Identifier (https://talk.maemo.org/showthread.php?t=41669)

stobbsc 2010-02-09 16:34

Re: [Request] N900 Bluetooth Identifier
 
Indeed I'm happy to work on a little app now that I have the base of the code :-)

P.S it will take time, cause I'm new to Maemo dev. but I will try and app name searching as well.

robota 2010-02-09 16:45

Re: [Request] N900 Bluetooth Identifier
 
Let me know if you got it to work - this is just a little Bash script to do the work, basically this is what it does:

1. execute hcitool command to get a list of all devices
2. use the awk to filter out the lines with 'BD Address' in it
3. use grep to see if we have a match
4. use dbus-send to display an alert if there is a match

Cheers, Arne

stobbsc 2010-02-09 17:02

Re: [Request] N900 Bluetooth Identifier
 
after I've moved it to ~/
I then ran you chmod 755 ~/N900finder.sh

Then when I run
~/N900finder.sh
I get on the next line
/bin/sh: /home/user/N900finder.sh: not found

am I doing something wrong?

robota 2010-02-09 18:15

Re: [Request] N900 Bluetooth Identifier
 
Quote:

Originally Posted by stobbsc (Post 517963)
after I've moved it to ~/
I then ran you chmod 755 ~/N900finder.sh

Then when I run
~/N900finder.sh
I get on the next line
/bin/sh: /home/user/N900finder.sh: not found

am I doing something wrong?

the path to bash in the first line is prob. incorrect. just try placing sh in front like:

sh ~/N900finder.sh

and it should work.

stobbsc 2010-02-09 19:03

Re: [Request] N900 Bluetooth Identifier
 
oKI added another lap to the code then typed this:
sh ~/N900finder.sh

Then it returns this:
: not found N900finder: line 4:
: not found N900finder: line 4:

robota 2010-02-09 19:41

Re: [Request] N900 Bluetooth Identifier
 
OK, without modification it doesn't compain?

Line #4 should read like:

grep '00:BD:3A\|00:BD:3B'`;

Notice the \| as a separator and the '`; (quote, backtick, semicolon) at the end of the line. You should be able to add as many laps as you like as long as they have the \| in between. If you still have troubles pm me as it might be out of scope to discuss that here - all I can say is that the code runs on my N900 ... or mail me: arne at robota dot nl.

Lord Awesome 2010-02-09 22:52

Re: [Request] N900 Bluetooth Identifier
 
Quote:

Originally Posted by robota (Post 518172)
OK, without modification it doesn't compain?

I had the same issue as above, so I trimmed the whitespace and took the line breaks out and it works.

Code:

#!/bin/bash
a=`hcitool scan --class | awk '/BD Address/ {print substr($3,0,8)}' | grep '00:BD:3A\|00:BD:3B'`;
echo $a;
if [ "$a" ]
then
dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:'Pizza! N900 here!' uint32:0 string:'OK'
fi;


stobbsc 2010-02-10 09:32

Re: [Request] N900 Bluetooth Identifier
 
I copied the code above and added one more section so it look slike this:

Quote:

#!/bin/bash
a=`hcitool scan --class | awk '/BD Address/ {print substr($3,0,8)}' | grep '00:BD:3A\|00:BD:3B\|00:21:9E'`;
echo $a;
if [ "$a" ]
then
dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:'Pizza! N900 here!' uint32:0 string:'OK'
fi;
and I get the following errors:
:not found N900finder.sh:line 2:

:not found N900finder.sh:line 3:
:not found N900finder.sh:line 7: syntax error: "fi" unexpected (expecting "then")

Please not this when I'm not expecting to find a device. perhaps thats why there is an error, could someone try my code please.

robota 2010-02-10 12:42

Re: [Request] N900 Bluetooth Identifier
 
Add the path to the correct directory for the commands hcitool, awk, grep, echo and dbus-send like:

/usr/bin/hcitool

Lord Awesome 2010-02-10 13:02

Re: [Request] N900 Bluetooth Identifier
 
Quote:

Originally Posted by stobbsc (Post 519052)
I copied the code above and added one more section so it look slike this:



and I get the following errors:
:not found N900finder.sh:line 2:

:not found N900finder.sh:line 3:
:not found N900finder.sh:line 7: syntax error: "fi" unexpected (expecting "then")

Please not this when I'm not expecting to find a device. perhaps thats why there is an error, could someone try my code please.

Your addition works for me. What editor are you using to create N900finder.sh?

robota 2010-02-10 13:32

Re: [Request] N900 Bluetooth Identifier
 
Quote:

Originally Posted by Lord Awesome (Post 519333)
Your addition works for me. What editor are you using to create N900finder.sh?

I made the script using vi on my nokia but if you are not used to this editor this is probably not what you would like to use ... also nokia didn't really fix the keyboard for shell scripting as it takes two hands and a nose to type a pipe symbol.

If enough people are interested in this we could just wrap it up to a .deb for easy installation.

mr_bridger 2010-02-19 09:18

Re: [Request] N900 Bluetooth Identifier
 
Just to throw another 2p in the pot, if we want a N900 finder, couldnt we use a system like the people finder in TuneWiki, with a map full of N900 users?

i have no idea how or if this could work.

Jetz 2010-03-09 15:24

Re: [Request] N900 Bluetooth Identifier
 
wlan C0:38:F9
bt C0:38:F9

how about identifying trough imei? if i remember correctly, you can solve phone imei trough bloover or similar program...


All times are GMT. The time now is 05:45.

vBulletin® Version 3.8.8