Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    [Request] N900 Bluetooth Identifier

    Reply
    Page 5 of 6 | Prev |   3     4   5   6   | Next
    stobbsc | # 41 | 2010-02-09, 16:34 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    robota | # 42 | 2010-02-09, 16:45 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    stobbsc | # 43 | 2010-02-09, 17:02 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    robota | # 44 | 2010-02-09, 18:15 | Report

    Originally Posted by stobbsc View Post
    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.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by robota; 2010-02-09 at 18:53.

     
    stobbsc | # 45 | 2010-02-09, 19:03 | Report

    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:

    Edit | Forward | Quote | Quick Reply | Thanks

     
    robota | # 46 | 2010-02-09, 19:41 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Lord Awesome | # 47 | 2010-02-09, 22:52 | Report

    Originally Posted by robota View Post
    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;

    Edit | Forward | Quote | Quick Reply | Thanks

     
    stobbsc | # 48 | 2010-02-10, 09:32 | Report

    I copied the code above and added one more section so it look slike this:

    Originally Posted by
    #!/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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    robota | # 49 | 2010-02-10, 12:42 | Report

    Add the path to the correct directory for the commands hcitool, awk, grep, echo and dbus-send like:

    /usr/bin/hcitool

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Lord Awesome | # 50 | 2010-02-10, 13:02 | Report

    Originally Posted by stobbsc View Post
    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 5 of 6 | Prev |   3     4   5   6   | Next
vBulletin® Version 3.8.8
Normal Logout