bluetooth: writeValue needs to be resilient to device disconnection |
|||||||
Issue description
Version 50.0.2651.0 dev (64-bit)
characteristic.writeValue should eventually fail if device is disconnected - meaning doesn't return a write response.
As you can see below, this happened to me and I'm still waiting stuck as my promise doesn't resolve/reject.
< ACL Data TX: Handle 32 flags 0x00 dlen 9 [hci0] 1435.807676
ATT: Write Request (0x12) len 4
Handle: 0x000e
Data: 0104
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 1435.875299
Num handles: 1
Handle: 32
Count: 1
> HCI Event: Vendor (0xff) plen 7 [hci0] 1436.348309
82 12 95 40 10 36 59 ...@.6Y
> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 1436.349296
Status: Success (0x00)
Handle: 32
Reason: Connection Timeout (0x08)
@ Device Disconnected: F1:6F:DE:EC:F1:D6 (2) reason 1
,
Mar 1 2016
I think this should be bluez's job. We can add logic to reject all pending promises if the device disconnects but I still think the platform, in this case bluez, should tell us if a write failed because of disconnection.
,
Mar 2 2016
I've sent a request to BlueZ folks at http://permalink.gmane.org/gmane.linux.bluez.kernel/66791 to see how they feel about this. ccing there Luiz Augusto von Dentz, BlueZ maintainer.
,
Mar 2 2016
Completely agree that we need this functionality. I've seen my program hanging indefinitely at various Web Bluetooth API calls. I can start to document these to get a hold of what's going on but I believe it is similar to this issue (except also with things like connecting, discovering services etc...)
,
Mar 7 2016
FYI, BlueZ folks replied: Yes, it should probably return and error so the client is not left hanging. I will investigate how this can be fixed.
,
Mar 10 2016
This has just been fixed in BlueZ and I've verified it. BlueZ logs: [DFU_Test:/service000c/char000d]# write 01 04 Attempting to write /org/bluez/hci0/dev_F1_6F_DE_EC_F1_D6/service000c/char000d [CHG] Device F1:6F:DE:EC:F1:D6 Connected: no Failed to write: org.bluez.Error.Failed Web Bluetooth logs: NotSupportedError: GATT operation failed for unknown reason. I will apply the new "BlueZ-5.38" label to this bug so that we can ask ChromeOS people to update it when new release of BlueZ gets released. I'll mark it as "Verified" when it gets merged.
,
Mar 31 2016
,
Apr 5 2016
,
May 13 2016
,
May 23 2016
Bulk verified |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by fbeaufort@chromium.org
, Mar 1 2016