Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Blueproximity in Perl?

by Tux (Canon)
on May 24, 2018 at 12:43 UTC ( [id://1215153]=note: print w/replies, xml ) Need Help??


in reply to Re: Blueproximity in Perl?
in thread Blueproximity in Perl?

I have been playin with Juerd's script a bit already, but it suffers the same drawbacks as most other readily available solutions: it does not "see" my device. hcitool is listed as deprecated. It does not show my phone when scanning. bluetoothctl is working very well, but it needs root/sudo to connect to the phone to get the rssi data.

When I get some time, I want to investigate an XS module that uses libbluetooth (just like Net::Bluetooth).


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: Blueproximity in Perl?
by bliako (Monsignor) on May 24, 2018 at 13:53 UTC

    Maybe one needs root access to enquire bluetooth device directly but this information usually is held/collected by the system in the same way as a wifi manager collects AND displays the signal strength of each neighbouring network. So a possibility would be to ask the window manager or whatever other manager instead of accessing system directly.

    Here is an example for gnome: https://wiki.gnome.org/Projects/Vala/DBusClientSamples If I understood correctly you need to detect mobile's presence from your opensuse desktop, so if you are using gnome then ask gnome for it.

      My aim is to not need root to check phone proximity, and as bluetoothctl is not setuid, I am convinced it should be possible.

      I've been fiddling with Net::DBus, but the docs are not conclusive and missing methods like list_services and list_objects.

      I've been playing a bit with d-feet, but that didn't bring me any further (yet) with the correct arguments to Net::DBus. (and time lacks to keep trying).

      What I had:

      use 5.16.2; use warnings; use Net::DBus; use Data::Peek; my $bus = Net::DBus->find or die "Cannot connect to DBus\n"; my $hal = $bus->get_service ("org.bluez") or die "Cannot get Handle\n" +;

      Giving no die message, but a disappointing

      org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not +provided by any .service files

      That plus

      $ cat /etc/systemd/system/dbus-org.bluez.service [Unit] Description=Bluetooth service Documentation=man:bluetoothd(8) ConditionPathIsDirectory=/sys/class/bluetooth [Service] Type=dbus BusName=org.bluez ExecStart=/usr/lib/bluetooth/bluetoothd NotifyAccess=main #WatchdogSec=10 #Restart=on-failure CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE LimitNPROC=1 ProtectHome=true ProtectSystem=full [Install] WantedBy=bluetooth.target Alias=dbus-org.bluez.service

      Made me skip digging into DBus for now


      Enjoy, Have FUN! H.Merijn
        org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not 
        +provided by any .service files

        I am curious why. maybe your bluetooth usb was not plugged in or turned on and the service did not auto-start. I have linux but it is without bluetooth and in my osx, well, i guess they have their own drivers.

        Here are some other DIY ideas for unlocking your computer: face recognition, fingerprint recognition, voice recognition, whistle recognition, toe recognition (requires sandals but no socks). Of course security is big concern because someone with your phone or a picture of your iris or your finger can unlock. For this reason I propose to have a 2-level security. Unlock the screen with the proximity test only to reveal the usual login-box. This system is secure and also techie beyond cool. bw

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215153]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found