-
Notifications
You must be signed in to change notification settings - Fork 57
BLE HID paired connections not working on some Windows 10 peripherals #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
|
|
@mscosti asked out-of-band which Bluetooth/BLE dongle is working for me. I am using this one: https://www.adafruit.com/product/1327. |
Managed to get another couple datapoints today.
This rules out my laptop not having BLE support or out of date drivers. It seems there must be something different with how Arduino and Circuit python BLE libraries are advertising? (my terminology might be wrong, I'm not very familiar with the Bluetooth/BLE protocol). Or, at least different enough where Windows is being finicky in this particular scenario. @dhalbert Do you have access to a windows 10 machine with BLE built in and so you don't need to use a dongle? I'm getting the feeling that that might be a consistent way to reproduce the issue. |
Did a little bit of digging. Used the nRF connect android app to scan so I could log what if any differences there was in advertisement data between the advertisement sent while using this arduino sketch vs using this circuitpython example . I kept the device name the same between the 2 so the 2 could be more easily comparable. Here are some screenshots of what nRF Connect was seeing. Arduino Sketch Advertisement (parsed)Arduino Sketch Advertisement (raw data)
Circuit Python Code Advertisement (parsed)Circuit Python Code Advertisement (raw data)
Looking at the Raw data of each, It seems like the only difference between the two is that the python example code is not sending type It looks like we are setting the default flags in the Advertisement class here to be General Discoverability and LE Only (brEdrNotSupported) , and I confirmed the field is set to those two on the My guess is that MS is pickier than most and since it isn't getting those flags it incorrectly makes assumptions about what kind of device it is. |
This is really odd because I did pretty much the same thing as you, and am seeing the flags field ( ble_hid_periph.py.txt (renamed to .txt to be able to upload to github) |
I am seeing the "no flags" problem with 4.0.0. Will investigate further. |
CIrcuit Python firmware version: 5.0.0 beta 3: https://github.com/adafruit/circuitpython/releases/tag/5.0.0-beta.3 Not 100% sure what version of Circuitpython_BLE i'm on; whatever is the version that came precompiled in this bundle (and used the bundle for 5.x.x): https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20200111 Looking at the releases of CIrcuitpython_BLE though, I would assume it would have to be https://github.com/adafruit/Adafruit_CircuitPython_BLE/releases/tag/3.1.2 since that was the most recent release when that bundle was released? So I think we might have been on the same versions? |
This was a confluence of two separate bugs: see #63. The flags were not included in advertisements, except that if you printed the advertisement (which the code I was using did, for debugging purposes), another bug cause the flags to be included. |
That explains why running your code on 3.1.2 had advertisements for me. Thoughts on above finding about the unknown service? |
@mscosti if you'd like to test, try PR #63 (you can use https://github.com/dhalbert/Adafruit_CircuitPython_BLE/tree/fix-lazy-advertising-fields, which is my PR branch, if you want). The CircuitPython boards now advertise an Adafruit-specific service that is the beginning of supporting remote editing via BLE from host computers, such as tablets. You can ignore that. (The |
Just loaded it up and used my example file that doesn't have the same logging as you. ✅ am now seeing flags and tx power being sent in Advertisement Hmmm. Do you think its possible Windows is really picky and not liking the fact that an unknown service (to it) is being sent? Since its an HID profile, it may be expecting to only have known services sent? I'm just making guesses, since its the only visible difference to me between the BLE data being sent from Arduino vs Cpy. Since you said 'CircuitPython boards' i'm assuming the code for that lives in the firmware itself? If we think its a valid assumption that the adafruit service is causing the issue, would it be possible to get a test build that doesn't send that out? |
Hmm. I'm not sure why it's still complaining. Did you remove the device in Windows before re-pairing? I don't think it should care about the extra service: I wouldn't expect it to give such a low-level error; at worst I'd expect it to refuse to do HID. I'll check among my laptops to see if I have one with builtin BLE.
|
Which board are you using? I'll give you a build with it turned off. |
Also, could you give more details of the exact builtin Bluetooth device by looking it up in Device Manager? |
|
Not sure if relevant, but computer OS specs:
|
Here are two CPB builds. One is the latest tip of master, the other is the same, but with the ADAF services turned off. Not tested with HID. |
This is interesting: https://winbuzzer.com/2019/11/19/microsoft-sends-out-driver-update-for-older-surface-products-xcxwbn/ Also zephyr was having trouble re-pairing with the Marvell: zephyrproject-rtos/zephyr#14044. |
First, I tried Then, I tried the master build When I get some more time i'll try out some more BLE examples, like trying out more HID profiles/reports |
I implemented bonding between beta.3 and master, and changed some internal state-keeping very slightly. The zephyr issue I mentioned above seems to have something to do with connection negotiation, so it may have to do with that rather the the advertisement specifically. But the advertisements definitely were buggy. |
Copied from adafruit/circuitpython#1050.
@urish:
@mscosti:
The text was updated successfully, but these errors were encountered: