Not working acquire-write for Read/Write characteristic in Bluetoothctl

1.3k Views Asked by At

I connected to smart watch via bluetoothctl. I listed all attribute. Then got info for target UUID (6e400002-b5a3-f393-e0a9-e50e24dcca9e). I saw it has both read and write capability (Read/Write). I selected attribute with "select-attribute" command. But I got failed to acquire write: org.bluez.Error.NotSupported.

Why cannot I do it?

linaro@linaro-alip:~$ bluetoothctl
Agent registered
[bluetooth]# pair 00:18:80:81:FE:81
Attempting to pair with 00:18:80:81:FE:81
[CHG] Device 00:18:80:81:FE:81 Connected: yes
[CHG] Device 00:18:80:81:FE:81 Paired: yes
Pairing successful
[CHG] Device 00:18:80:81:FE:81 ServicesResolved: yes
[Cordio]# menu gatt
[Cordio]# list-attributes
Primary Service
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020
    6e400000-b5a3-f393-e0a9-e50e24dcca9e
    Vendor specific
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
    6e400002-b5a3-f393-e0a9-e50e24dcca9e
    Nordic UART TX
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0021
    6e400001-b5a3-f393-e0a9-e50e24dcca9e
    Nordic UART Service
Descriptor
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0021/desc0023
    00002902-0000-1000-8000-00805f9b34fb
    Client Characteristic Configuration
Primary Service
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010
    00001801-0000-1000-8000-00805f9b34fb
    Generic Attribute Profile
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010/char0011
    00002a05-0000-1000-8000-00805f9b34fb
    Service Changed
Descriptor
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010/char0011/desc0013
    00002902-0000-1000-8000-00805f9b34fb
    Client Characteristic Configuration
[Cordio]# attribute-info 6e400002-b5a3-f393-e0a9-e50e24dcca9e
Characteristic - Nordic UART TX
    UUID: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
    Service: /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020
    Value:
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
    Flags: read
    Flags: write
[Cordio]# select-attribute 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[Cordio:/service0020/char0024]# write 0x55
Attempting to write /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
[Cordio:/service0020/char0024]# acquire-write
Failed to acquire write: org.bluez.Error.NotSupported
[Cordio:/service0020/char0024]# read
Attempting to read /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
[CHG] Attribute /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024 Value:
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
      
3

There are 3 best solutions below

0
On

It doesn't work with a 'write' flag, only 'write-without-response' is supported.

From documentation: For client it only works with characteristic that has WriteAcquired property which relies on write-without-response Flag.

0
On

Your log looks a little strange. According to the UART/Serial Port Emulation over BLE specification the characteristic ./service0020/char0024 aka UUID 6e400002-b5a3-f393-e0a9-e50e24dcca9e is the RX Characteristic which is write only.

In any case, the data from your log does not match the information documented in Nordics specification.

0
On

I am solved the problem,

Firstly, I thought the write command wasn't working because I couldn't get a response (raw datas), but it was working.

Because when the other UUID (6e400001-b5a3-f393-e0a9-e50e24dcca9e) is set to 'notify' (acquire-notify), the raw data started to come from the smart watch.

Thank you everyone for your answer.