We distributed the first stray badge in a limited quantity in Technical Book 7, but we received a comment from the purchaser about "Integration with Raspberry Pi", so we decided to make it an article in Technical Book 8. .. Anyway, with a development policy that works with the same library and source code on both Mac and Linux (Raspberry Pi), make a note of the problems you faced and how to solve them.
Since there was a sample code (C) for ESP32, a sample code (JavaScript) using the Web Bluetooth API of the Chrome browser, and a message display program (Python) for the USB-HID version LED Badge in Technical Book 7, node.js I decided to develop with Python.
--Mac: macOS Mojave version 10.14.6 (18G1012) + Xcode 11.3 (11C29)
node.js worked fine with the noble library and Python worked fine on the Mac with Adafruit Python BluefruitLE, but on the Raspberry Pi " Adafruit Python Bluefruit LE didn't work ", and as expected, it didn't work either.
As we investigated, Linux uses BlueZ (5.50), and since BlueZ (5.38), the specifications of D-Bus Object Manager have changed, so it was necessary to apply a patch. As of January 26, 2020, it was not merged into the original home and should be resolved by: (reference) Fixed incompatibility with BlueZ version >= 5.38
--Linux: Python 3.7.3 + BlueZ (5.50) + Adafruit Python BluefruitLE (donatieng patch)
There are two solutions.
--If you already have the Adafruit Python BluefruitLE library installed, apply the patch manually. Alternatively, uninstall and install the patched Adafruit Python BluefruitLE library. --If you have not already installed the Adafruit Python BluefruitLE library, install the patched Adafruit Python BluefruitLE library.
$ cd /usr/local/lib/python3.7/dist-packages/Adafruit_BluefruitLE/bluez_dbus/
$ sudo mv gatt.py gatt.py_org
$ sudo wget https://raw.githubusercontent.com/donatieng/Adafruit_Python_BluefruitLE/master/Adafruit_BluefruitLE/bluez_dbus/gatt.py
$ sudo pip3 uninstall Adafruit-BluefruitLE
$ git clone https://github.com/donatieng/Adafruit_Python_BluefruitLE
$ cd Adafruit_Python_BluefruitLE/
$ sudo python3 setup.py install
Technical Book 8 is being written with the theme of "hacking light and sound"! (As of January 27, 2020) The store will open on the second day, "Ka 40", so let's meet on the day! !!
Recommended Posts