STMicroelectronics / BlueSTSDK_Python

Bluetooth Low Energy Sensors Technology Software Development Kit (Python version for Linux Gateways)
https://www.st.com/en/embedded-software/bluest-sdk.html
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

Is it possible to receive data as non-root? #30

Open aditi1prakash opened 2 years ago

aditi1prakash commented 2 years ago

Current example scripts need root access, is it possible to connect and receive data as non-root?

If not, then why is root access required?

davidroid commented 2 years ago

Hello @aditi1prakash, Let's say no, unless some work to configure the Bluetooth stack. The following is what I've found on the Internet, but I've never tried it actually.

By default, on Linux, the Bluetooth protocol stack needs special privileges to interact with. These privileges are implemented through properties called "capabilities" (see man 7 capability for details), and the tool to assign capabilities is "setcap".

Since the Python version of the BlueSTSDK makes use of the bluepy library, it is the binary "bluepy-helper" that interacts with the Bluetooth protocol stack; hence, in case you want to do so, you should locate where it is installed and assign the proper capabilities to it. See also here.

Regards, Davide

aditi1prakash commented 2 years ago

Hi Davide,

Thanks for the inputs. I modified the capabilities of the bluepy-helper file.

After assigning the capabilities, the blue_st_sdk throws a 'ModuleNotFoundError' for Manager module. image

The required capabilities are set for the bluepy-helper file. image

Any thoughts on a fix/workaround would be helpful.

Regards, Aditi Prakash

davidroid commented 2 years ago

Hello @aditi1prakash, Can you check the output of the following command, to see whether the SDK is there?

find / | grep blue_st_sdk

Thank you, Davide