New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 775855 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Bluetooth: Android App writing to a characteristic led to disconnection

Reported by abel...@gmail.com, Oct 18 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Platform: 9901.46.0 (Official Build) beta-channel kevin

Steps to reproduce the problem:
1. Establish BLE connection with device
2. Write to a characteristic

What is the expected behavior?
The Chromebook connects to device, writes to characteristic and stills connected.

What went wrong?
Chromebook lost BLE connection with device after writing to charcteristic

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 62.0.3202.55  Channel: beta
OS Version: 62.0.3202.55
Flash Version: 27.0.0.170

I have developed an Android App that connects with a BLE device and writes commands to a writable characteristic. It works fine in Android devices.

Now, I'm trying the same App in Chromebook and it's showing a weird behaviour related to BLE connection:

First, when data is written to the characteristic the messages order is altered and some command are duped. Then, each time it finish writing, BLE connection is lost.

I've attached two hcidump files, one from Chromebook and the other from the device.
 
chromebook-hcidump
10.3 KB View Download
device-hcidump
4.1 KB View Download
Components: OS>Systems>Bluetooth
Cc: mcchou@chromium.org rjahagir@chromium.org josephsih@chromium.org pbath...@chromium.org
Owner: mcchou@chromium.org
Status: Assigned (was: Unconfirmed)
Assigning to mcchou@. 

Comment 3 by mcchou@chromium.org, Oct 31 2017

Labels: M-65

Comment 4 by mcchou@chromium.org, Oct 31 2017

Owner: josephsih@chromium.org
Received from the developer via email today: 

We have tested 63.0.3239.20 from Chrome OS dev channel.

The result is that now the data written to the device arrives in the correct order, but the disconnection problem is still happening.

To minimize friction between Chromebook and our device in terms of BLE communication, we think that we can work in a PoC using the same BLE low-level implementation used in Chromebook, as far as I know, that is BlueZ. The problem is that we have no experience working with BlueZ library and it has a very steep learning curve, so it can take us long time to get it working.

Do you think some experienced developer from Chromebook team could help us to speed up this PoC giving some support, sample code or documentation about BlueZ library and its usage to create BLE peripheral devices?

We really think this can help Chromebook team and our team to speed up the resolution of the problem and this way we can give your product team more valuable information with can help to troubleshoot the BLE problems they are addressing to help all developers that are reporting BLE problems on Chromebook devices.

If you think this could be possible it will be great, else, if you need more information (hardware specs, data logs...) please tell me and we try to collect and attach it to the bug report we opened.
Can someone please provide comms that I can share with the developer regarding how/when this bug will be addressed? This is a high profile partner in Spain and they are eagerly awaiting our response.

Thank you!

Comment 7 by abel...@gmail.com, Nov 1 2017

Hi,

I've enabled detailed log for bluetooth in Chromebook and tried the next steps:

1) Establish connection with peripheral device.
2) Subscribe to characteristic 0x1202 (type NOTIFY)
3) Write several times to characteristic 0x1201 (type WRITE NO-RESPONSE)


Steps 1 and 2 seems Ok. But in step 3, after writing, connection is always closed. There are 2 different, but related, behaviours:

- In case writes are 7 or less, all writes are performed and then connection is lost.

- In case writes count is greater than 7, connection is lost after 7th write finishes, so the rest of data is lost.


I guess this will not be very relevant, but the data written is of string type in form of text commands (like "FWD", "BCK", "STOP"...)


I've attached a zip file containing logged data during the test.


P.S.: This has been tested on Acer Chromebook R11 and Samsung Chromebook Plus devices in developer mode and running 63.0.3239.20 from dev channel and the result was the same.
chromebook-ble-issue-2017-11-01.zip
12.1 KB Download
Summary: Bluetooth: Android App writing to a characteristic led to disconnection (was: Android App with BLE weird behaviour on Chromebook)
The disconnection problem was incurred by the incorrect write response packet, i.e., an extra trailing 0, on the device side, not on the chromebook side. If you remove the trailing 0 in the write response packet sent by the device, that should fix the problem. 

Even if your app works well on an android device, that does not necessarily mean that the app does the correct thing. The bluetooth stack, bluez, in chromebook does check the packet format in a strict manner.


----- More details below -----

From the chrome-hcidump log in Comment#0.

# Packet A
# This was a correct Write Response. Note that dlen was 5 here which was correct.
> ACL Data RX: Handle 128 flags 0x02 dlen 5   [hci0] 11736.995578
    ATT: Write Response (0x13) len 0

# Packet B
# This was an incorrect Write Response. Note that dlen was 6 here which was incorrect.
# Hence, the error message, “invalid size", was shown.
> ACL Data RX: Handle 128 flags 0x02 dlen 6   [hci0] 11748.094864
    ATT: Write Response (0x13) len 1
    invalid size
    00


# If you check the device-hcidump log, you would find that the dlen was 6 corresponding to Packet B above. # A correct value should be 5.
1970-01-01 00:00:59.816964 < ACL data: handle 16 flags 0x00 dlen 6
    ATT: Write resp (0x13)

This invalid ATT packet was discarded at l2cap layer and was not passed up to higher layer; hence it led to a timeout in kernel after 2 seconds. The timeout caused the disconnection.

So please check if you accidentally append “0” in the write response packet on the device side. And please let us know if this fixes the issue.


Per C#9, this issue was caused on the peripheral side instead of on the chrome os side. 

abelcsz@gmail.com please let me know if you have a different view point. I will close this issue if there is no response within 1 week. Thanks!
Status: WontFix (was: Assigned)
Per C#9, this issue was caused on the peripheral side instead of on the chrome os side. Hence, I will mark it WontFix.

Sign in to add a comment