Search code examples
pythonpython-3.xbluetooth-lowenergysudo

python3 root-privileges for BLE


Why does this python2-BLE-application need sudo-rights whereas gatt-python doesn't?

Via both, you are able to communicate with a microcontroller-board. (I've tested this with a BLE-Extansion-board.)


Solution

  • gatt-python uses DBus to talk to bluetoothd, which is itself running with elevated privileges. OTOH, the BlueST SDK uses bluepy, which contains a small helper application, and that directly talks to the Bluetooth adapter using the HCI protocol, which requires root privileges (and is actually not recommended anymore, as it will interfere with bluetoothd).