Closed brianpeiris closed 6 years ago
Your adapter can use sudo (at least on the RPi) to add capabilities if they haven't been added yet. This won't work under regular linux. Under ubuntu 18.04, you can do something like:
pkexec --user root command that you'd like to run as root
which would prompt the user using a graphical dialog and then run the command ala sudo.
Hmm. Would that actually work through the gateway's usual addon installation UI, if I publish my addon?
When the addon is executed it can check to see if the appropriate capabilities are assigned, and if not, call sudo setcap some-capability
to set the capbility. Since the pi user doesn't need a password to execute sudo, this will work for any process. Each addon is started as a separate process.
Thanks, that seems to work!
Any help with the second part of the issue? thing-url-adapter
still interferes with bluepy
when it tries to connect to a bluetooth device.
It seems that bluepy doesn't play very well with noble, which thing-url-adapter (one of our default adapters) uses. Since we have that as a default, and that's the adapter which talks to native web things (our end goal), it would be best to stick with noble or other solutions that don't interfere.
I've started building an addon in python for an existing brand of commercial smart home devices. My addon uses bluepy and I've run into a couple of problems.
bluepy includes a helper executable (bluepy-helper) that it uses to communicate with bluetooth devices. This executable needs the appropriate bluetooth network capabilities to function (
cap_net_admin,cap_net_raw+eip
). Is there a mechanism for me to grant these capabilities to the helper when someone installs my addon?While testing my addon locally (after manually granting the above capabilities), I noticed that the Web Thing addon (thing-url-adapter) interferes with my addon. It seems that it uses
noble
for eddystone beacon scanning and that overrides my addon's ability to connect to its own bluetooth devices. I can work around the issue by disabling thing-url-adapter. I see this in the gateway logs:Is this a bug in thing-url-adapter, or will you disallow other bluetooth libraries (like bluepy) from also accessing bluetooth devices?