2015-10-02 06:33:42

by Leon Nicholls

[permalink] [raw]
Subject: Cannot write to BLE thermal printer

Hi
I'm trying to write a value to a BLE thermal printer using the Web
Bluetooth API on ChromeOS (using Bluez 5.33). I can connect to the
device and find the service and characteristic. But when I try and
write to the characteristic an error is thrown (although it looks like
it disconnects before the write happens). Please find attached
log.

Thanks
Leon

sudo btmon -w ~/Downloads/btmon.btsnoop
Bluetooth monitor ver 5.33
= New Index: 1C:3E:84:0D:F9:F8 (BR/EDR,USB,hci0)
[hci0] 0.004075
< HCI Command: LE Add Device To White List (0x08|0x0011) plen 7
[hci0] 15.209842
Address type: Random (0x01)
Address: 0F:04:E0:51:44:8B (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4 [hci0] 15.210823
LE Add Device To White List (0x08|0x0011) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
[hci0] 15.210856
Type: Passive (0x00)
Interval: 60.000 msec (0x0060)
Window: 30.000 msec (0x0030)
Own address type: Public (0x00)
Filter policy: Ignore not in white list (0x01)
> HCI Event: Command Complete (0x0e) plen 4 [hci0] 15.211822
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
[hci0] 15.211854
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4 [hci0] 15.212823
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 43 [hci0] 15.528855
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 0F:04:E0:51:44:8B (Non-Resolvable)
Data length: 31
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported
16-bit Service UUIDs (partial): 1 entry
Unknown (0x18f0)
128-bit Service UUIDs (partial): 1 entry
e7810a71-73ae-499d-8c15-faa9aef0c3f2
TX power: 4 dBm
RSSI: -46 dBm (0xd2)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
[hci0] 15.528930
Scanning: Disabled (0x00)
Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4 [hci0] 15.529824
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25
[hci0] 15.529878
Scan interval: 60.000 msec (0x0060)
Scan window: 30.000 msec (0x0030)
Filter policy: White list is not used (0x00)
Peer address type: Random (0x01)
Peer address: 0F:04:E0:51:44:8B (Non-Resolvable)
Own address type: Public (0x00)
Min connection interval: 50.00 msec (0x0028)
Max connection interval: 70.00 msec (0x0038)
Connection latency: 0x0000
Supervision timeout: 420 msec (0x002a)
Min connection length: 0.000 msec (0x0000)
Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4 [hci0] 15.530826
LE Create Connection (0x08|0x000d) ncmd 1
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19 [hci0] 15.848909
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 32
Role: Master (0x00)
Peer address type: Random (0x01)
Peer address: 0F:04:E0:51:44:8B (Non-Resolvable)
Connection interval: 67.50 msec (0x0036)
Connection latency: 0.00 msec (0x0000)
Supervision timeout: 420 msec (0x002a)
Master clock accuracy: 0x00
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
[hci0] 15.849297
Handle: 32
@ Device Connected: 0F:04:E0:51:44:8B (2) flags 0x0000
02 01 06 03 02 f0 18 11 06 f2 c3 f0 ae a9 fa 15 ................
8c 9d 49 ae 73 71 0a 81 e7 02 0a 04 00 00 00 ..I.sq.........
> HCI Event: Command Status (0x0f) plen 4 [hci0] 15.849836
LE Read Remote Used Features (0x08|0x0016) ncmd 1
Status: Success (0x00)
> ACL Data RX: Handle 32 flags 0x02 dlen 16 [hci0] 15.883695
LE L2CAP: Connection Parameter Update Request (0x12) ident 180 len 8
Min interval: 8
Max interval: 16
Slave latency: 0
Timeout multiplier: 300
> HCI Event: LE Meta Event (0x3e) plen 12 [hci0] 16.018827
LE Read Remote Used Features (0x04)
Status: Success (0x00)
Handle: 32
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
LE Encryption
< ACL Data TX: Handle 32 flags 0x00 dlen 10
[hci0] 16.018919
LE L2CAP: Connection Parameter Update Response (0x13) ident 180 len 2
Result: Connection Parameters accepted (0x0000)
< HCI Command: LE Connection Update (0x08|0x0013) plen 14
[hci0] 16.018938
Handle: 32
Min connection interval: 10.00 msec (0x0008)
Max connection interval: 20.00 msec (0x0010)
Connection latency: 0x0000
Supervision timeout: 3000 msec (0x012c)
Min connection length: 0.000 msec (0x0000)
Max connection length: 0.000 msec (0x0000)
< ACL Data TX: Handle 32 flags 0x00 dlen 7
[hci0] 16.019328
ATT: Exchange MTU Request (0x02) len 2
Client RX MTU: 517
> HCI Event: Command Status (0x0f) plen 4 [hci0] 16.019819
LE Connection Update (0x08|0x0013) ncmd 1
Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.086875
Num handles: 1
Handle: 32
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.087870
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 7 [hci0] 16.153733
ATT: Exchange MTU Response (0x03) len 2
Server RX MTU: 158
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.153997
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.221859
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 24 [hci0] 16.288359
ATT: Read By Group Type Response (0x11) len 19
Attribute data length: 6
Attribute group list: 3 entries
Handle range: 0x0001-0x0005
UUID: Generic Access Profile (0x1800)
Handle range: 0x0006-0x0006
UUID: Generic Attribute Profile (0x1801)
Handle range: 0x0007-0x000b
UUID: Battery Service (0x180f)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.288589
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x000c-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.356857
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 24 [hci0] 16.423416
ATT: Read By Group Type Response (0x11) len 19
Attribute data length: 6
Attribute group list: 3 entries
Handle range: 0x000c-0x000e
UUID: Link Loss (0x1803)
Handle range: 0x000f-0x0011
UUID: Immediate Alert (0x1802)
Handle range: 0x0012-0x001f
UUID: Alert Notification Service (0x1811)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.423732
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0020-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.491921
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 24 [hci0] 16.558416
ATT: Read By Group Type Response (0x11) len 19
Attribute data length: 6
Attribute group list: 3 entries
Handle range: 0x0020-0x0022
UUID: Tx Power (0x1804)
Handle range: 0x0023-0x0029
UUID: Unknown (0x18f0)
Handle range: 0x002a-0x002e
UUID: Device Information (0x180a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.558740
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x002f-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.626913
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 26 [hci0] 16.693364
ATT: Read By Group Type Response (0x11) len 21
Attribute data length: 20
Attribute group list: 1 entry
Handle range: 0x002f-0x0032
UUID: Unknown (e7810a71-73ae-499d-8c15-faa9aef0c3f2)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.693674
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0033-0xffff
Attribute group type: Primary Service (0x2800)
> HCI Event: LE Meta Event (0x3e) plen 10 [hci0] 16.693845
LE Connection Update Complete (0x03)
Status: Success (0x00)
Handle: 32
Connection interval: 15.00 msec (0x000c)
Connection latency: 0.00 msec (0x0000)
Supervision timeout: 3000 msec (0x012c)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.708831
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.723276
ATT: Error Response (0x01) len 4
Read By Group Type Request (0x10)
Handle: 0x0033
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.723678
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Secondary Service (0x2801)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.738822
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.753289
ATT: Error Response (0x01) len 4
Read By Group Type Request (0x10)
Handle: 0x0001
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.753627
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.768858
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.783290
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0001
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.783618
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0007-0x000b
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.798828
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.813283
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0007
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.813608
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000c-0x000e
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.828840
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.843277
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000c
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.843625
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000f-0x0011
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.858824
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.873234
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000f
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.873476
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0012-0x001f
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.888906
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.903234
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0012
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.903486
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0020-0x0022
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.918864
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.933215
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0020
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.933401
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0023-0x0029
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.948918
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.963217
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0023
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.963549
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002a-0x002e
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 16.978834
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 16.993230
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x002a
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 16.993526
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002f-0x0032
Attribute type: Include (0x2802)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.008917
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.023196
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x002f
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.023593
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.038918
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.053196
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0002
Value: 020300002a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.053464
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0003-0x0005
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.068910
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.083270
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0004
Value: 020500012a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.083583
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0005-0x0005
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.098917
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.113205
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0005
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.113705
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0007-0x000b
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.128816
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.143220
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0008
Value: 120900192a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.143457
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0009-0x000b
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.158818
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.173249
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0009
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.173568
ATT: Find Information Request (0x04) len 4
Handle range: 0x000a-0x000b
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.188871
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 14 [hci0] 17.203411
ATT: Find Information Response (0x05) len 9
Format: UUID-16 (0x01)
Handle: 0x000a
UUID: Characteristic Format (0x2904)
Handle: 0x000b
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.203778
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000c-0x000e
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.218824
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.233259
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x000d
Value: 0a0e00062a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.233596
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000e-0x000e
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.248851
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.263285
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000e
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.263643
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000f-0x0011
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.293823
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.308362
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0010
Value: 041100062a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.308668
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0011-0x0011
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.323911
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.338293
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0011
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.338649
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0012-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.353829
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.368411
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0013
Value: 021400472a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.369010
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0014-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.398916
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.413355
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0015
Value: 101600462a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.413754
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0016-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.428879
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.443345
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0018
Value: 021900482a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.443574
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0019-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.458856
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.473356
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x001a
Value: 101b00452a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.473660
ATT: Read By Type Request (0x08) len 6
Handle range: 0x001b-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.488815
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.503338
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x001d
Value: 181e00442a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.503642
ATT: Read By Type Request (0x08) len 6
Handle range: 0x001e-0x001f
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.518869
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.533201
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x001e
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.533732
ATT: Find Information Request (0x04) len 4
Handle range: 0x0017-0x0017
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.548839
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 17.563221
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0017
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.563496
ATT: Find Information Request (0x04) len 4
Handle range: 0x001c-0x001c
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.578816
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 17.593246
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x001c
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.593596
ATT: Find Information Request (0x04) len 4
Handle range: 0x001f-0x001f
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.608818
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 17.623286
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x001f
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.623640
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0020-0x0022
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.638840
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.653410
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0021
Value: 022200072a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.653721
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0022-0x0022
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.668867
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.683241
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0022
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.683511
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0023-0x0029
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.698817
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.713365
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0024
Value: 0c2500f12a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.713569
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0025-0x0029
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.728917
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.743317
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0027
Value: 302800f02a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.743573
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0028-0x0029
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.758913
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.773195
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0028
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.773531
ATT: Find Information Request (0x04) len 4
Handle range: 0x0026-0x0026
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.788913
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 17.803317
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0026
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.803739
ATT: Find Information Request (0x04) len 4
Handle range: 0x0029-0x0029
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.818913
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 17.833321
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0029
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.833757
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002a-0x002e
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.848912
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.863352
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x002b
Value: 022c00232a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.863629
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002c-0x002e
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.878828
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 13 [hci0] 17.908312
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x002d
Value: 022e00292a
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.908583
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002e-0x002e
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.923919
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.938187
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x002e
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.938450
ATT: Read By Type Request (0x08) len 6
Handle range: 0x002f-0x0032
Attribute type: Characteristic (0x2803)
> ACL Data RX: Handle 32 flags 0x02 dlen 27 [hci0] 17.968564
ATT: Read By Type Response (0x09) len 22
Attribute data length: 21
Attribute data list: 1 entry
Handle: 0x0030
Value: 3a31009f9f00c158bd32b69e4c219cc9d6f8be
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.968805
Num handles: 1
Handle: 32
Count: 1
< ACL Data TX: Handle 32 flags 0x00 dlen 11
[hci0] 17.968838
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0031-0x0032
Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 17.983876
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 9 [hci0] 17.998313
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0031
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 17.998699
ATT: Find Information Request (0x04) len 4
Handle range: 0x0032-0x0032
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 18.013849
Num handles: 1
Handle: 32
Count: 1
> ACL Data RX: Handle 32 flags 0x02 dlen 10 [hci0] 18.028315
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0032
UUID: Client Characteristic Configuration (0x2902)
< ACL Data TX: Handle 32 flags 0x00 dlen 9
[hci0] 18.030692
ATT: Read Blob Request (0x0c) len 4
Handle: 0x0003
Offset: 0x0000
> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 18.043803
Num handles: 1
Handle: 32
Count: 1
< HCI Command: Disconnect (0x01|0x0006) plen 3
[hci0] 50.049295
Handle: 32
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 [hci0] 50.050594
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
> HCI Event: Vendor (0xff) plen 7 [hci0] 50.055689
82 70 90 80 10 36 59 .p...6Y
> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 50.056491
Status: Success (0x00)
Handle: 32
Reason: Connection Terminated By Local Host (0x16)
@ Device Disconnected: 0F:04:E0:51:44:8B (2) reason 2l


Attachments:
btmon (2).btsnoop (6.13 kB)

2015-10-29 18:53:03

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Hi Leon,

On Thu, Oct 29, 2015 at 5:02 AM, Leon Nicholls <[email protected]> wrote:
> Following François instructions to explicitly stop the scan, here are
> the latest logs. I'm getting a "GATT Error Unknown" in the browser,
> although that might not be an error on the driver level but maybe just
> due to a timeout on the browser level.

I could only decode a Disconnect command from the btmon trace you
sent, there is no ATT traffic at all.

--
Luiz Augusto von Dentz

2015-10-29 03:02:09

by Leon Nicholls

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Following François instructions to explicitly stop the scan, here are
the latest logs. I'm getting a "GATT Error Unknown" in the browser,
although that might not be an error on the driver level but maybe just
due to a timeout on the browser level.


Attachments:
shell.txt (1.14 kB)
btmon (4).btsnoop (179.00 B)
Download all attachments

2015-10-28 08:00:34

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Hi François

On Wed, Oct 28, 2015 at 7:45 AM, François Beaufort
<[email protected]> wrote:
> Does it work on Android or iOS?
> If so, could you provide a trace?
>
> On Wed, Oct 28, 2015 at 6:43 AM, Leon Nicholls <[email protected]> wrote:
>> I'm still getting a GATT error.

It would be nice to know what error you are talking about, note that
in the previous trace you sent there was actually no error because the
scan is blocking any other communication to happen ATT eventually
timeout (ATT timeout is 30 seconds) which cause the ACL to be
disconnected.

--
Luiz Augusto von Dentz

2015-10-28 05:45:13

by François Beaufort

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Does it work on Android or iOS?
If so, could you provide a trace?

On Wed, Oct 28, 2015 at 6:43 AM, Leon Nicholls <[email protected]> wrote:
> I'm still getting a GATT error.

2015-10-28 05:43:59

by Leon Nicholls

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

I'm still getting a GATT error.

2015-10-28 04:43:08

by François Beaufort

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

You may want to simply try:

crosh> bt_console
[bluetooth]# scan on
Discovery started
...
[bluetooth]# scan off
Discovery stopped
[bluetooth]# connect 01:23:45:67:89:01

where 01:23:45:67:89:01 is the Bluetooth Low Energy printer address.

On Wed, Oct 28, 2015 at 3:59 AM Leon Nicholls <[email protected]> wrote:
>
> In my web app I don't explicitly do a scan for devices. That is done
> somewhere inside the polymer element or even the Web Bluetooth API in
> Chrome. I'm going to experiment with using the Web Bluetooth API
> directly to eliminate one level of abstraction.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-10-28 02:58:25

by Leon Nicholls

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

In my web app I don't explicitly do a scan for devices. That is done
somewhere inside the polymer element or even the Web Bluetooth API in
Chrome. I'm going to experiment with using the Web Bluetooth API
directly to eliminate one level of abstraction.

2015-10-27 14:47:09

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Hi Leon,

On Tue, Oct 27, 2015 at 4:22 PM, Leon Nicholls <[email protected]> wrote:
> Still seeing the same issue:
> ChromeOS version: 48.0.2546.0 canary (64 bit)
> Bluetooth monitor ver 5.35
> I'm using the Web Bluetooth Polymer element:
> https://elements.polymer-project.org/elements/platinum-bluetooth

No top-posting in this list please.

The problem seems similar, there is a Read Blob Request but after that
it just disconnect:

< ACL Data TX: Handle 32 flags 0x00 dlen 9
ATT: Read Blob Request (0x0c) len 4
Handle: 0x0003
Offset: 0x0000

But in the meantime this happens:

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
Type: Active (0x01)
Interval: 11.250 msec (0x0012)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)

This looks like you manage to start a full duty cycle scan? You
probably have changed this since at least upstream we use 50% duty
cycle:

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
Type: Active (0x01)
Interval: 22.500 msec (0x0024)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)

Anyway this probably means the controller have no time to receive
anything else since it is busy with the scan, so at this point nothing
else will happen at ATT and the Write command is probably stuck in the
queue waiting for the response to Read Blob Request.

Btw, why you want to scan if you are already connected?

--
Luiz Augusto von Dentz

2015-10-27 14:22:01

by Leon Nicholls

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Still seeing the same issue:
ChromeOS version: 48.0.2546.0 canary (64 bit)
Bluetooth monitor ver 5.35
I'm using the Web Bluetooth Polymer element:
https://elements.polymer-project.org/elements/platinum-bluetooth

On Fri, Oct 2, 2015 at 12:15 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Leon,
>
> On Fri, Oct 2, 2015 at 9:33 AM, Leon Nicholls <[email protected]> wrote:
>> Hi
>> I'm trying to write a value to a BLE thermal printer using the Web
>> Bluetooth API on ChromeOS (using Bluez 5.33). I can connect to the
>> device and find the service and characteristic. But when I try and
>> write to the characteristic an error is thrown (although it looks like
>> it disconnects before the write happens). Please find attached
>> log.
>
>> < ACL Data TX: Handle 32 flags 0x00 dlen 9
>> [hci0] 18.030692
>> ATT: Read Blob Request (0x0c) len 4
>> Handle: 0x0003
>> Offset: 0x0000
>
> So this seems to be the last command in the sent but right after that
> we disconnect:
>
>> < HCI Command: Disconnect (0x01|0x0006) plen 3
>> [hci0] 50.049295
>> Handle: 32
>> Reason: Remote User Terminated Connection (0x13)
>>> HCI Event: Command Status (0x0f) plen 4 [hci0] 50.050594
>> Disconnect (0x01|0x0006) ncmd 1
>> Status: Success (0x00)
>>> HCI Event: Vendor (0xff) plen 7 [hci0] 50.055689
>> 82 70 90 80 10 36 59 .p...6Y
>>> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 50.056491
>> Status: Success (0x00)
>> Handle: 32
>> Reason: Connection Terminated By Local Host (0x16)
>> @ Device Disconnected: 0F:04:E0:51:44:8B (2) reason 2l
>
> I recall something similar was fixed in upstream so you might want to
> try with 5.35, this is probably caused by not registering any driver
> for the profile (see
> RegisterProfile:https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt)
> which should be used if you want to auto connect as soon the device
> start advertising.
>
> --
> Luiz Augusto von Dentz


Attachments:
shell.txt (60.28 kB)
btmon (3).btsnoop (8.58 kB)
Download all attachments

2015-10-02 07:15:19

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

Hi Leon,

On Fri, Oct 2, 2015 at 9:33 AM, Leon Nicholls <[email protected]> wrote:
> Hi
> I'm trying to write a value to a BLE thermal printer using the Web
> Bluetooth API on ChromeOS (using Bluez 5.33). I can connect to the
> device and find the service and characteristic. But when I try and
> write to the characteristic an error is thrown (although it looks like
> it disconnects before the write happens). Please find attached
> log.

> < ACL Data TX: Handle 32 flags 0x00 dlen 9
> [hci0] 18.030692
> ATT: Read Blob Request (0x0c) len 4
> Handle: 0x0003
> Offset: 0x0000

So this seems to be the last command in the sent but right after that
we disconnect:

> < HCI Command: Disconnect (0x01|0x0006) plen 3
> [hci0] 50.049295
> Handle: 32
> Reason: Remote User Terminated Connection (0x13)
>> HCI Event: Command Status (0x0f) plen 4 [hci0] 50.050594
> Disconnect (0x01|0x0006) ncmd 1
> Status: Success (0x00)
>> HCI Event: Vendor (0xff) plen 7 [hci0] 50.055689
> 82 70 90 80 10 36 59 .p...6Y
>> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 50.056491
> Status: Success (0x00)
> Handle: 32
> Reason: Connection Terminated By Local Host (0x16)
> @ Device Disconnected: 0F:04:E0:51:44:8B (2) reason 2l

I recall something similar was fixed in upstream so you might want to
try with 5.35, this is probably caused by not registering any driver
for the profile (see
RegisterProfile:https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt)
which should be used if you want to auto connect as soon the device
start advertising.

--
Luiz Augusto von Dentz

2015-11-02 03:55:09

by Leon Nicholls

[permalink] [raw]
Subject: Re: Cannot write to BLE thermal printer

My chromebook got a few more updates the past few days and now the
code is working and I can send characters to the printer! Thanks for
taking a look at the issue.

On Thu, Oct 29, 2015 at 11:53 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Leon,
>
> On Thu, Oct 29, 2015 at 5:02 AM, Leon Nicholls <[email protected]> wrote:
>> Following François instructions to explicitly stop the scan, here are
>> the latest logs. I'm getting a "GATT Error Unknown" in the browser,
>> although that might not be an error on the driver level but maybe just
>> due to a timeout on the browser level.
>
> I could only decode a Disconnect command from the btmon trace you
> sent, there is no ATT traffic at all.
>
> --
> Luiz Augusto von Dentz