Giter Club home page Giter Club logo

Comments (3)

jef-pearlman avatar jef-pearlman commented on August 22, 2024

I just tried creating the same situation by running two separate gatttool processes, and had the same result: while one connect is pending, others immediately fail. So presumably this is not a bluepy issue, but something lower level. I'd still love any suggestions on workarounds, fixes, or working-as-intended. Thanks!

from bluepy.

IanHarvey avatar IanHarvey commented on August 22, 2024

It looks like it's a limitation of Bluetooth LE itself. Connecting to a peripheral is done with the LE_Create_Connection command; the Bluetooth 4.0 spec says (vol 2, sec 7.8.12, page 826)

The Host shall not issue this command when another LE_Create_Connection is pending in the
Controller; if this does occur the Controller shall return the Command Disallowed error code shall
be used.

Sadly, then, it's built in to the HCI command specification that only one connection can be pending at a a time.

Thanks
Ian

from bluepy.

jef-pearlman avatar jef-pearlman commented on August 22, 2024

Apologies--I meant to close this myself. In case it is ever of use to anyone else, I also tracked down the kernel code implementing the limitation, and it appears to only limit it to one connection per CID (rather than one globally). Since all my devices are using the Attribute CID (0x04) and I don't really have control over it, I haven't tested whether you can do multiple connections on different channels or the limitation matches the BT4 spec, though I note that the error returned is EBUSY.

Also, note that canceling the connection does allow for new connections, so I'm manually timing out my asynchronous connects after a much shorter period. (I'm also now listening for announcements on another BT dongle and using that to limit connection attempts to missing devices.)

Thanks!

from bluepy.

Related Issues (20)

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.