Closed DjZU closed 1 year ago
Thanks a lot!
Am currently checking whether I can reproduce the problem I previously experienced. If yes, I'll try your fix and eventually create a PR for that. While I kept having problems, another user (with the same code) did not experience any problem.
Am still waiting for BS440 to crash according to the standard installation guideline, to try your fix, ..., but it doesn't crash anymore. Weird...
I am running BS440 for years as a service on a machine running 24/7 and operating Ubuntu/XFCE. Across distribution upgrades, and maybe when I started to run this as a service instead of invoking the script directly in the command line, I went through instabilities and an annoying crash pop-up (https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/1860851).
After reading pygatt code (https://github.com/peplin/pygatt/blob/master/pygatt/backends/gatttool/gatttool.py), I managed to solve the issue by running the script as a normal user without privileges instead of running the script as root. This way, resetting the adaptor will not be required anymore, and in case it does, the service will take care of that.
I believe this may also fix other issues like #109 and #95.
Here are the steps:
Enable normal users to perform LE scanning
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
Amend BS440.py code
Amend ../BS440/dist/init/linux-systemd/bs440.service