GithubHelp home page GithubHelp logo

balena-labs-projects / bluetooth Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 11.0 66 KB

Optimized bluetooth agent for balenaOS. Based on BlueZ 5.0.

Home Page: https://hub.balena.io/blocks

Python 78.50% Shell 21.50%
balena bluetooth raspberry-pi linux

bluetooth's People

Contributors

balena-ci avatar bucknalla avatar nucleardreamer avatar shawaj avatar tmigone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bluetooth's Issues

Automatically reconnect to remembered devices

Recent releases of balenaOS will "remember" connected devices in /var/lib/bluetooth.

balena-os/meta-balena@3815e42

I've confirmed this on the following device:

ID="balena-os"
NAME="balenaOS"
VERSION="2.60.1+rev1"
VERSION_ID="2.60.1+rev1"
PRETTY_NAME="balenaOS 2.60.1+rev1"
MACHINE="raspberrypi3"
VARIANT="Development"
VARIANT_ID="dev"
META_BALENA_VERSION="2.60.1"
RESIN_BOARD_REV="a28e387"
META_RESIN_REV="9aed19a"
SLUG="raspberrypi3"

However, this bluetooth block does not reconnect to devices automatically after a power cycle. I suspect this is something that can be added via this block, but if balenaOS changes are required we can open a new issue there.

Note that this was previously fixed in balenaSound before it started using this bluetooth block.

balena-io-experimental/balena-sound@78a727a

Not sure if the same fix would apply to this block since it looks like we are now relying on the host OS for more components.

Simple Example

Is there a simple example that shows how to use the bluetooth block to implement a simple communication between for example a raspberry pi 4 and a laptop or phone?

[Feature] Interact with the Bluetooth block

Currently, there is no documented way to interact or control the Bluetooth block from inside or outside the container. It would be quite helpful to issue commands to the Bluetooth block from the outside to perform functions like:

  1. Scan for Bluetooth devices
  2. Turn on/Turn off Bluetooth
  3. Connect to device

The Bluetooth block could expose an API endpoint to send requests to perform these functions or more from other containers in the application. While, if there is a tool being used to get the Bluetooth running inside the container some documentation can be linked about that tool for folks to use & control the Bluetooth block (programatically) from inside the container. Thanks for creating this! ๐Ÿ’Ÿ

Problem when trying to re-pair device after unpairing - balena device retains pairing

We have seen problems when trying to re-pair devices: balena-io-experimental/balena-sound#526

To reproduce (pi3, android phone, oneplus 7T):

  1. pair phone to pi
  2. unpair
  3. When my pi3's containers came back online, I was unable to pair to it from my phone, getting couldn't pair with balenaOS 0687 because of an incorrect pin or passkey error.
  4. I ssh'd into the bluetoothcontainer and with bluetoothctl paired-devices i saw: Device 48:01:C5:7B:61:78 OnePlus 7T - so the device was listing my phone as paired, when they were not paired.
  5. I then removed my phone from the bluetooth blocks paired devices list with bluetoothctl remove 48:01:C5:7B:61:78 - I then was able to pair my phone to the pi again!

So it seems like there's a problem with the balena device retaining the other device as being paired, even when its not, which causes some funkyness when that other device tries to re-pair

Block should reset interfaces on startup

An interface that gets configured by the block will keep it's configuration until told otherwise.
Restarting the block with a different BLUETOOTH_HCI_INTERFACE value will configure the new one but keep the old one configured. So both interfaces will be configured and broadcasting.

To avoid that we need to restart/turn off all interfaces at block startup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.