Open vovagorodok opened 2 years ago
Yes, well spotted. Looks like they got missed with 7e4bf7459c98ad592f20a34bffe96bd599e1d618
With new method examples should always runs with sudo unfortunately
No, you should not need to use sudo
. As the ukBaz.bluezero
name is not being claimed then it can be done without sudo
In case without sudo I have AccessDenied:
pi@home:~/python-bluezero/examples $ python3 ble_uart.py
ERROR:dbus.proxies:Introspect error on :1.5:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.19" (uid=1000 pid=618 comm="python3 ble_uart.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination=":1.5" (uid=0 pid=424 comm="/usr/lib/bluetooth/bluetoothd ")
Traceback (most recent call last):
File "ble_uart.py", line 69, in <module>
main(list(adapter.Adapter.available())[0].address)
File "/home/pi/.local/lib/python3.7/site-packages/bluezero/adapter.py", line 49, in available
mng_objs = dbus_tools.get_managed_objects()
File "/home/pi/.local/lib/python3.7/site-packages/bluezero/dbus_tools.py", line 93, in get_managed_objects
return manager.GetManagedObjects()
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.19" (uid=1000 pid=618 comm="python3 ble_uart.py ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination=":1.5" (uid=0 pid=424 comm="/usr/lib/bluetooth/bluetoothd ")
When you run bluetoothctl
do you have to run that with sudo
also?
No, bluetoothctl
doesn't require sudo:
pi@home:~ $ bluetoothctl
[bluetooth]#
pi@home:~ $ bluetoothctl -v
bluetoothctl: 5.50
OK, let me run some tests
I've done a fresh install of Bluezero and checked that there is no ukBaz.bluezero
is /etc/dbus-1/system.d/
.
I think your issue is coming from else were.
(venv) [bash]python-bluezero $ python examples/ble_uart.py
Advertisement registered
Connected to 58:19:A8:D6:77:DB
raw bytes: [116, 101, 115, 116]
With options: {'device': '/org/bluez/hci0/dev_58_19_A8_D6_77_DB', 'link': 'LE', 'mtu': 517}
Text value: test
Sending
raw bytes: [98, 108, 117, 101]
With options: {'device': '/org/bluez/hci0/dev_58_19_A8_D6_77_DB', 'link': 'LE', 'mtu': 517}
Text value: blue
Sending
^C(venv) [bash]python-bluezero $ ll /etc/dbus-1/system.d/uk*
ls: cannot access '/etc/dbus-1/system.d/uk*': No such file or directory
pi@home:~ $ uname -a
Linux home 5.10.63-v7+ #1496 SMP Wed Dec 1 15:58:11 GMT 2021 armv7l GNU/Linux
Its clear instalation rpi os without gui. What system do you have? and just install:
pip3 install bluezero
I've tested it on two systems:
$ uname -a
Linux TestMachine1 5.10.60-v7+ #1449 SMP Wed Aug 25 15:00:01 BST 2021 armv7l GNU/Linux
And
$ uname -a
Linux TestMachine2 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Is the OS you are referring to Raspberry Pi OS Lite? There are some known additional setup required with that. More details at: https://raspberrypi.stackexchange.com/a/116843/121848
Yes RPiOS Lite on RPi Zero 2. Works, but I don't know exact solution. What I'm done:
sudo apt install pulseaudio-module-bluetooth
sudo reboot
sudo apt remove pulseaudio-module-bluetooth
I think it is adding user pi
to group bluetooth
that is the key bit.
pi@raspberrypi4b:~ $ sudo usermod -G bluetooth -a pi
Yes. I forgot. This one was done by me to
OK. I think this sounds like a general RPi setup rather than an issue with Bluezero. Can I go ahead and close this issue?
The goal of this issue is removing Outdated text in docs
Should be removed following notes? : at: Peripheral
at: https://github.com/ukBaz/python-bluezero/blob/main/docs/install_bluez.rst#creating-a-bluezero-peripheral