edrosten / libblepp

Modern clean C++ Bluetooth Low Energy on Linux without the Bluez DBUS API
Other
239 stars 62 forks source link

Setting scan parameters: Operation not permitted #61

Open xloem opened 3 years ago

xloem commented 3 years ago
$ examples/lescan
error 1611577006.276827: Setting scan parameters: Operation not permitted
terminate called after throwing an instance of 'BLEPP::HCIScanner::IOError'
  what():  Setting scan parameters: Operation not permitted
Aborted (core dumped)

It looks like libblepp nees to be used with sudo in a default setup for me. Is this an inherent limitation of the non-dbus approach?

pearson commented 3 years ago

I don't know the answer to your question, but this post gave me a work-around.

Assuming you have libcap installed, the following line will give the lescan_simple the permissions it needs: sudo setcap 'cap_net_raw,cap_net_admin+eip' lescan_simple

There could very well be better fixes to the sudo issue, but this is doing the job for me until I find one.

edrosten commented 3 years ago

Thanks for the workaround. I'd always used sudo. I assumed dbus was needed for communication with a daemon running as root.