Reputation: 363
I have developed BLE scanning application using bluez4 library APIs.I am able to run application using root user but because of security reasons it will be required for me to run application with non root user.
Using setcap package I am able to do "hcitool lescan" as a non root user,
=> sudo setcap 'cap_net_raw,cap_net_admin+eip' which hcitool
=> getcap !$
getcap which hcitool
But these changes does not work while running my ble scanning application as non root user and it got stuck with API "hci_send_req" which returns error "Failed to set scan parameters data.Operation not permitted".
Please some one can help me on this.
Regards Nishith
Upvotes: 3
Views: 2674
Reputation: 366
Maybe two years late, but I was getting the same error and the answer was quite simple. You just need to perform a setcap operation on the binary file that you want to execute so it can get access to bluetooth operations. The command is as follows:
sudo setcap 'cap_net_raw,cap_net_admin+eip' /absolute/path/to/your/executable/file
Hope that helps!
Upvotes: 3