Web Bluetooth requestDevice filtering on services seems to fail on Mac
Reported by
pur3m...@googlemail.com,
Jul 22 2016
|
||||
Issue descriptionChrome Version : 54.0.2804.0 (Official Build) canary (64-bit) URLs (if applicable) : https://espruino.github.io/EspruinoWebIDE/ Other browsers tested: OK: Chrome OS (any new versions) OK: Chrome 52 Linux What steps will reproduce the problem? (1) Have BLE device with Nordic UART (Puck.js, BBC Micro:bit with Espruino firmware, or Adafruit Bluefruit module) (2) Go to https://espruino.github.io/EspruinoWebIDE/ (3) Click the orange icon in the top left, and choose 'Web Bluetooth' (4) Pairing screen pops up, starts scanning What is the expected result? * Bluetooth device is found. What happens instead? * Empty 'pairing box' However, if I go to https://googlechrome.github.io/samples/web-bluetooth/device-info.html and put 'Puck' in the prefix, then search, the device is found. Makes me think it's to do with requestDevice({filters:[{services:[ "6e400001-b5a3-f393-e0a9-e50e24dcca9e" ]}]}) Actual Web Bluetooth code is here: https://github.com/espruino/EspruinoTools/blob/gh-pages/core/serial_web_bluetooth.js I've attached a dump from PacketLogger showing all the info is there, but I'm struggling to get any bluetooth logging out of Chrome Canary I'm afraid... /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-logging --vmodule=*bluetooth*=9 Creates an empty file. I'll try again and post up if I have any luck Hardware: iMac (21.5-inch, Late 2009), Mac OS 10.11.5 It doesn't have built-in bluetooth so am using a CSR Bluetooth dongle Hope that helps
,
Jul 22 2016
I wonder if macOS doesn't cache services while BlueZ does once device is paired.
Can you try and let me know if that works out for you?
navigator.bluetooth.requestDevice({
filters:[{ name: 'Puck.js' }],
optionalServices: [ NORDIC_SERVICE ]})
.then(function(device) { /* ... */ })
,
Jul 22 2016
Looking at bluetooth logs, you're right Gordon. There is ascan response from first LE advertising report. So it should work... #1 Bluetooth HCI Event - LE Meta Event Code: LE Meta (0x3e) Parameter Total Length: 29 Sub Event: LE Advertising Report (0x02) Num Reports: 1 Event Type: Connectable Undirected Advertising (0x00) Peer Address Type: Random Device Address (0x01) BD_ADDR: c3:25:1d:c7:ef:bd (c3:25:1d:c7:ef:bd) Data Length: 17 Advertising Data Flags Device Name: Puck.js efbd Length: 13 Type: Device Name (0x09) Device Name: Puck.js efbd RSSI (dB): -79 #2 Bluetooth HCI Event - LE Meta Event Code: LE Meta (0x3e) Parameter Total Length: 30 Sub Event: LE Advertising Report (0x02) Num Reports: 1 Event Type: Scan Response (0x04) Peer Address Type: Random Device Address (0x01) BD_ADDR: c3:25:1d:c7:ef:bd (c3:25:1d:c7:ef:bd) Data Length: 18 Advertising Data 128-bit Service Class UUIDs Length: 17 Type: 128-bit Service Class UUIDs (0x07) Custom UUID: 9ecadc240ee5a9e093f3a3b50100406e RSSI (dB): -78
,
Jul 22 2016
Note: In Comment 2, change "name" to "namePrefix".
,
Jul 22 2016
,
Jul 22 2016
Just tried this and yes, it works. I'm putting that code in for now.
,
Jul 22 2016
I am not able to reproduce this issue with espruino_1v84.214_nrf51822.hex image on MacBook Air - OS X El Capitan - 10.11.5 (15F34) I've used: https://googlechrome.github.io/samples/web-bluetooth/get-characteristics.html?service=6e400001-b5a3-f393-e0a9-e50e24dcca9e and I don't have a CSR Bluetooth Dongle.
,
Jul 22 2016
I've tried with Apple Bluetooth Host Controller and external USB Micro Adapter GBU521 (https://www.iogear.com/product/GBU521/)
,
Jul 22 2016
To add to this, using https://googlechrome.github.io/samples/web-bluetooth/get-characteristics.html?service=6e400001-b5a3-f393-e0a9-e50e24dcca9e I can see devices that I have previously connected to, but not devices that I haven't. If I connect to a new device then go back to that page and try again, it'll appear.
,
Jul 25 2016
This, sadly, seems like a lower level issue. When you pass in the service to requestDevice we pass those services to "scanForPeripheralsWithServices"[1] which starts a scan and filters out all devices that are not advertising those services. In this case the fact that Francois couldn't reproduce this issue with his MacBook Air leads me to believe the CSR adapter is filtering out your device. We could do an open scan and filter in software but this is discouraged by Apple due to being very inefficient.
,
Jul 25 2016
Might the CSR adapter be doing a passive scan instead of an active one? Only active scans would receive the Scan Response packet that contains the service UUID. But active scans without rotating local device addresses are bad privacy-wise, so it's reasonable for a dongle to do passive scans if it doesn't have the ability to rotate addresses.
,
Jul 25 2016
Well, in the PacketLogger log it does show what looks like the correct data (a packet with the UUID in), so it seems like the data is getting in, it just isn't being interpreted for some reason.
,
Jul 26 2016
Gordon, can you test if it also fails with the CSR adapter plugged to your Chromebook? You'll need to select as default the CSR adapter in bluetooth console. Open Chrome OS shell with [Ctrl]+[Alt]+T and follow: crosh> bt_console [NEW] Controller A4:17:31:78:A6:04 Chromebook_0A65 [default] [NEW] Controller 5C:F3:70:62:75:1B BlueZ 5.39 [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 00001112-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 00001801-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 0000110e-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 00001200-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 0000110c-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 0000110a-0000-1000-8000-00805f9b34fb [CHG] Controller 5C:F3:70:62:75:1B UUIDs: 0000111f-0000-1000-8000-00805f9b34fb [bluetooth]# select 5C:F3:70:62:75:1B Controller 5C:F3:70:62:75:1B BlueZ 5.39 [default]
,
Dec 15 2016
Hey Gordon, I've tried on my MacBook Air with latest Chrome Canary and it works great: https://beaufortfrancois.github.io/samples/web-bluetooth/device-info.html?service=6e400001-b5a3-f393-e0a9-e50e24dcca9e Can you reproduce as well?
,
Dec 15 2016
Yes - just tested and it works fine on Canary 57 now. Chrome 55 works but repeatably shows up fewer devices than 57 does - I *think* it's refusing to show the devices with a longer advertising interval. But hey - 57's fixed! \o/ Thanks!
,
Dec 15 2016
|
||||
►
Sign in to add a comment |
||||
Comment 1 by pur3m...@googlemail.com
, Jul 22 201618.0 KB
18.0 KB View Download
16.4 KB
16.4 KB View Download