'Pybluez on Nano: SDP can’t be generated
I had an issue like this on my Nano:
profiles = [ SERIAL_PORT_PROFILE ],
File "/usr/lib/python2.7/site-packages/bluetooth/bluez.py", line 176, in advertise_service
raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')
I tried adding compatibility mode in the bluetooth.service file, reloading daemon, restarting bluetooth and then adding a serial port by doing
sudo sdptool add SP
These steps work fine on my ubuntu 20.04 laptop, but on jetpack 4.5.1, they don’t. And I checked also, they don’t work on jetson NX either.
I am really curious on how to solve this issue, otherwise, another way to use bluetooth inside a python code is welcomed.
Thanks
Solution 1:[1]
You might want to have a look at the following article which shows how to do the connection with core Python Socket library https://blog.kevindoran.co/bluetooth-programming-with-python-3/.
The way BlueZ does this now is with the Profile API.
There is a Python example of using the Profile API at https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/test-profile
hciattach, hciconfig, hcitool, hcidump, rfcomm, sdptool, ciptool, and gatttool were deprecated by the BlueZ project in 2017. If you are following a tutorial that uses them, there is a chance that it might be out of date and that Linux systems will choose not to support them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ukBaz |
