Comments (4)
As far as I can tell, something in here is failing: https://github.com/currantlabs/ble/blob/master/linux/hci/hci.go#L187-L198
from ble.
I've discovered that after the socket is bound, there is sometimes data to be read on the socket. This is throwing everything off because the code doesn't expect anything yet. When it does start sending commands, it gets confused because the response isn't what it was expecting.
After the socket is bound (https://github.com/currantlabs/ble/blob/master/linux/hci/socket/socket.go#L107) if I add some code to sleep for 50ms and then read from the socket to clear it out, then it works flawlessly. I can submit a PR with this, but I'm still a little unsure if it's just an issue with my particular hardware or what. It may be that after an "hci down" and "hci up", something gets written to the socket when the bluetooth hardware comes back up, which may explain the time delay issue.
Any thoughts?
from ble.
Let me try it out on some of our hardware here; we haven't seen that issue, but doesn't seem like this would hurt aside from the (very slight) delay.
from ble.
Yeah, it may be something very specific to my hardware. I'm testing this with ubuntu running in VirtualBox on macOS, with a USB bluetooth dongle (you can't get a VM to attach to a Mac's builtin bluetooth). It may be something with the dongle I'm using. I've previously had good success with running bluetooth stuff in linux with this setup though.
from ble.
Related Issues (20)
- SEGV on read
- Project status? HOT 1
- Project description and docs HOT 2
- examples/lib/...
- can't accept: skt: unsupported event packet HOT 1
- notifyhandler
- can't new device : can't init hci: no devices available: (hci0: can't down device: operation not permitted) HOT 3
- support for jsut works pairing ? HOT 2
- Not working on macOS High Sierra HOT 15
- Notifications disconnected after 60 seconds
- is this repo is still live HOT 1
- # master-slave mode conversion
- WriteCharacteristic on Linux Doesn't Appear To Write HOT 7
- Can't dial error locks up device HOT 5
- Specify different HCI device
- OSX does not support MTU key, kCBMsgArgATTMTU
- ReadRSSI linux HOT 1
- Got an unregistered notification || CCCD not found HOT 4
- is it useable for android?
- Can't init device hci0: Function not implemented (38) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.