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

In reply to Re^4: Blueproximity in Perl? by Tux
in thread Blueproximity in Perl? by Tux

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.