Package: adafruit-blinka-bleio
Introduction_bleiofor Blinka based onbleakand bluez.DependenciesThis driver depends on:bleakIt optionally also depends on these Debian packages not install on Raspbian by default:bluez-hcidumpInstalling from PyPIOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locallyfrom
PyPI. To install for current user:pip3installadafruit-blinka-bleioTo install system-wide (this may be required in some cases):sudopip3installadafruit-blinka-bleioTo install in a virtual environment in your current project:mkdirproject-name&&cdproject-namepython3-mvenv.envsource.env/bin/activatepip3installadafruit-blinka-bleioSupport for Duplicate Advertisement scanning on LinuxNoteRead this section if you are using advertising to transmit changing
data and need to receive all advertisements to receive this data.
One example of using advertising for data is described in the Adafruit Learn GuideBluetooth LE Sensor Nodes to Raspberry Pi WiFi Bridge.The regular Linux kernelbluezdriver is set up to suppress
multiple advertisements sent from the same BLE device.  As of this
writing, this cannot be changed.  If you are using BLE advertisements
to send changing data that you retrieve by scanning, the
de-duplication can cause you to lose data when scanning viableak.To get around this problem, this library can instead look at raw BLE
scanning data using thehcidumpandhcitooltools and avoid
going through the kernel driver. But this requires special setup.Normally, only root has enough privileges to do see the raw scanning
data.  Since running as root is dangerous, you can instead use Linux
capabilities to granthcitoolandhcidumpraw network
access. This is very powerful and not something to do casually. To
limit access we recommend you change file execution permissions to
restrict this capability to users in thebluetoothgroup.If you are not using advertising to transmit changing data, you do
not need to add these permissions. This library falls back to usingbleakfor regular scanning ifhcitooldoes not have
these extra permissions.If youexplicitlywant to choose the backend to ensure consistent
behavior, you can do the following:ble=BLERadio()ble._adapter.ble_backend="bleak"# Forces bleak even if hcitool works.# ble._adapter.ble_backend = "hcitool" # Forces hcitool. Raises exception if unavailable.To add yourself to thebluetoothgroup do:sudousermod-a-Gbluetooth<yourusername>You must then logout and log back in to be in the new group.To set permissions onhcitoolandhcidumpdo:sudochown:bluetooth/usr/bin/hcitool/usr/bin/hcidumpsudochmodo-x/usr/bin/hcitool/usr/bin/hcidumpsudosetcap'cap_net_raw,cap_net_admin+eip'/usr/bin/hcitoolsudosetcap'cap_net_raw,cap_net_admin+eip'/usr/bin/hcidumpUsage ExampleDo not use this library directly. Use CircuitPython BLE instead:https://github.com/adafruit/Adafruit_CircuitPython_BLE/ContributingContributions are welcome! Please read ourCode of Conductbefore contributing to help this project stay welcoming.DocumentationFor information on building library documentation, please check outthis guide.TroubleshootingRaspberry Pi 3b Rev 1.2The Raspberry Pi 3b’s BLE chip is connected over UART to the main processor without flow control.
This can cause unreliability with BLE. To improve reliability, we can slow the UART. To do so,
edit/usr/bin/btuartand replace the921600with460800.