Closed Bug 1204940 Opened 10 years ago Closed 10 years ago

startLeScan fails with hard coded service failure

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mozilla, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 Build ID: 2015082600 Steps to reproduce: I flashed a Flame device to base image v18D (2.0.0) then v18D_nightly_v4 (3.0.0). Then I shallow flashed to the latest nightly b2g-43.0a1.en-US.android-arm.tar.gz and gaia.zip from 14 September 2015. Then I created a packaged application with proper type and permissions. I tested it using: bluetooth.defaultAdapter.startDiscovery().then(disco => { disco.ondevicefound = devi => { console.log('Found', devi.device); }; setTimeout(() => { bluetooth.defaultAdapter.stopDiscovery(disco) }, 5000); }, err => console.error(err)); ...and confirmed that it found and logged devices for five seconds. FAILURE Then I replaced 'startDiscovery()' with 'startLeScan([])' in the block above which logged nothing. To narrow the scope, I tested like this next: const BATTERY_SERVICE = '0000180f-0000-1000-8000-00805f9b34fb'; var promise = bluetooth.defaultAdapter.startLeScan([BATTERY_SERVICE]); promise.then(function(result) { console.log(result); // Success }, function(err) { console.log(err); // Error }); Actual results: startLeScan() simply instantiated a promise and set it to 'pending', after which it simply returned. The 'adb logcat' suggests that a hard coded service identifier 0x9 is responsible for the error: E/bluetoothd(15331): unsupported service 0x9 When testing with Bruce Sun's gatt-client [1] the same thing happens. A longer logcat: [1] https://github.com/BruceSunMozilla/gatt-client/ --------- beginning of /dev/log/system [...] I/AutoMounter( 665): UpdateState: Volume sdcard is Mounted and inserted @ /storage/sdcard gen 1 locked 0 sharing en-n I/AutoMounter( 665): UpdateState: Volume sdcard1 is NoMedia and missing I/Smart Collections( 1290): Content JS LOG: evme init: noop I/Smart Collections( 1290): at log (app://collection.gaiamobile.org/gaia_build_defer_synchronize.js:465:619) V/WLAN_PSA( 212): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028] E/bluetoothd(15331): unsupported service 0x9 I/Smart Collections( 1290): Content JS LOG: evme init: noop I/Smart Collections( 1290): at log (app://collection.gaiamobile.org/gaia_build_defer_synchronize.js:465:619) Expected results: The ondevicefound() event should have fired.
(In reply to mozilla from comment #0) > User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 > Firefox/40.0 > Build ID: 2015082600 > > Steps to reproduce: > > I flashed a Flame device to base image v18D (2.0.0) then v18D_nightly_v4 > (3.0.0). Then I shallow flashed to the latest nightly > b2g-43.0a1.en-US.android-arm.tar.gz and gaia.zip from 14 September 2015. > > Then I created a packaged application with proper type and permissions. I > tested it using: > > bluetooth.defaultAdapter.startDiscovery().then(disco => { > disco.ondevicefound = devi => { > console.log('Found', devi.device); > }; > setTimeout(() => { > bluetooth.defaultAdapter.stopDiscovery(disco) > }, 5000); > }, err => console.error(err)); > > ...and confirmed that it found and logged devices for five seconds. > > FAILURE > > Then I replaced 'startDiscovery()' with 'startLeScan([])' in the block above > which logged nothing. To narrow the scope, I tested like this next: > > const BATTERY_SERVICE = '0000180f-0000-1000-8000-00805f9b34fb'; > var promise = bluetooth.defaultAdapter.startLeScan([BATTERY_SERVICE]); > > promise.then(function(result) { > console.log(result); // Success > }, function(err) { > console.log(err); // Error > }); > > > Actual results: > > startLeScan() simply instantiated a promise and set it to 'pending', after > which it simply returned. The 'adb logcat' suggests that a hard coded > service identifier 0x9 is responsible for the error: > > E/bluetoothd(15331): unsupported service 0x9 > > When testing with Bruce Sun's gatt-client [1] the same thing happens. A > longer logcat: > > [1] https://github.com/BruceSunMozilla/gatt-client/ > > --------- beginning of /dev/log/system > [...] > I/AutoMounter( 665): UpdateState: Volume sdcard is Mounted and inserted @ > /storage/sdcard gen 1 locked 0 sharing en-n > I/AutoMounter( 665): UpdateState: Volume sdcard1 is NoMedia and missing > I/Smart Collections( 1290): Content JS LOG: evme init: noop > I/Smart Collections( 1290): at log > (app://collection.gaiamobile.org/gaia_build_defer_synchronize.js:465:619) > V/WLAN_PSA( 212): NL MSG, len[048], NL type[0x11] WNI type[0x5050] len[028] > E/bluetoothd(15331): unsupported service 0x9 > I/Smart Collections( 1290): Content JS LOG: evme init: noop > I/Smart Collections( 1290): at log > (app://collection.gaiamobile.org/gaia_build_defer_synchronize.js:465:619) > > > Expected results: > > The ondevicefound() event should have fired. Hi, From the error message, GATT profile is not support in your build. I checked the build date of v18D_nightly_v4, looks like is around 5/26 or 5/27. GATT support requires some update in backend part also (unfortunately, they landed after 5/27), and that need to be updated by full flash. I would suggest you to unzip flame-kk.zip in the pvt and run ./flash.sh instead of shallow flashing gecko and gaia only at the first time. I have tried today's pvt build and can scan LE devices. Thanks, Jocelyn
(In reply to Jocelyn Liu [:jocelyn] [:joliu] from comment #1) > (In reply to mozilla from comment #0) >> Steps to reproduce: >> >> I flashed a Flame device to base image v18D (2.0.0) then v18D_nightly_v4 >> (3.0.0). Then I shallow flashed to the latest nightly >> b2g-43.0a1.en-US.android-arm.tar.gz and gaia.zip from 14 September 2015. >> >> [...] >> >> Actual results: >> >> startLeScan() simply instantiated a promise and set it to 'pending', after >> which it simply returned. The 'adb logcat' suggests that a hard coded >> service identifier 0x9 is responsible for the error: >> >> E/bluetoothd(15331): unsupported service 0x9 >> >> When testing with Bruce Sun's gatt-client [1] the same thing happens. >> A longer logcat: >> >> [...] >> >> Expected results: >> >> The ondevicefound() event should have fired. >> > From the error message, GATT profile is not support in your build. > I checked the build date of v18D_nightly_v4, looks like is around 5/26 or > 5/27. > v18D_nightly_v4 is not the last flash I did, as you see I also shallow flashed to b2g-43.0a1 from 14 September 2015. I followed the official 'Updating your Flame' [1] instructions. [1] https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Phone_guide/Flame/Updating_your_Flame/ > GATT support requires some update in backend part also (unfortunately, they > landed after 5/27), and that need to be updated by full flash. > I would suggest you to unzip flame-kk.zip in the pvt and run ./flash.sh > instead of shallow flashing gecko and gaia only at the first time. > I have tried today's pvt build and can scan LE devices. > Okay this is great news, but developers have no access to the pvt builds you refer to. RESOLVED Nevertheless, I've received a copy of flame-kk_eng_2015_09_15.zip and flashed it. The reported problem no longer appears, so it is a API maturity problem (coupled with user error.) For those concerned, the only public way to use bleeding edge APIs like startLeScan() seems to be to clone and build yer own B2G at considerable engineering cost (took all night in my case.)
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.