Posts: 6
Joined: Wed Apr 22, 2015 5:19 pm

How to connect to Bluetooth LE devices without being root (v

Mon Apr 27, 2015 1:13 am

I am running Raspbian with BlueZ 5.30 and a Cambridge Silicon Bluetooth USB Dongle installed. I can successfully bring up the BLE interface, as well as detect and connect to a TI SensorTag over BLE when logged in as "pi" and using sudo in front of every bluetooth command (such as hciconfig, hcitool, gatttool, ...)

Is there a way to set things up (file permissions, group memberships, etc.) so that a regular (non root, student) user can connect the the SensorTag (and other BLE peripherals) without having to use sudo all the time?

User avatar
Posts: 4353
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: How to connect to Bluetooth LE devices without being roo

Mon Apr 27, 2015 5:29 am

Gatttool works for the pi user without changes (too many 'tutorials' just put 'sudo' in front of everything). But bluetoothctl needs some work. Create a D-Bus security policy for the pi user.

Code: Select all

sudo nano /etc/dbus-1/system.d/bluetooth.conf
and add the following policy:

Code: Select all

  <policy user="pi">
    <allow send_destination="org.bluez"/>
    <allow send_interface="org.bluez.Agent1"/>
    <allow send_interface="org.bluez.GattCharacteristic1"/>
    <allow send_interface="org.bluez.GattDescriptor1"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>
before the closing '</busconfig>' tag. Alternately, create a 'student' group and a <policy group="student">...</policy>

bluetoothctl should give you everything you need to manage the local and remote devices.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 11 guests