The recent BlueZ 5.46 release has a new feature to "let an application get a dedicated file descriptor to read/write data from/to a GATT characteristic". Looking at bluetoothctl command help, It looks like this should work using the new acquire-write or acquire-notify commands, but so far I am not able to get these to work. An example trying to connect Fedora 26 with bluez.x86_64 version 5.46-1.fc26 with the --experimental flag on the bluetoothd service to an HM-10 Bluetooth Low Energy module:
bluetoothctl -v
5.46
sudo bluetoothctl
[bluetooth]# scan on
Discovery started
[CHG] Controller 28:B2:BD:07:04:49 Discovering: yes
[NEW] Device D4:36:39:DE:61:6B KeyDuino
[bluetooth]# scan off
[bluetooth]# connect D4:36:39:DE:61:6B
Attempting to connect to D4:36:39:DE:61:6B
[CHG] Device D4:36:39:DE:61:6B Connected: yes
...
[KeyDuino]# select-attribute 0000ffe1-0000-1000-8000-00805f9b34fb
[KeyDuino:/service0010/char0011]# acquire-write
Failed to acquire write: org.freedesktop.DBus.Error.UnknownMethod
[KeyDuino:/service0010/char0011]# acquire-notify
Failed to acquire notify: org.freedesktop.DBus.Error.UnknownMethod
I keep getting the Failed to acquire write: org.freedesktop.DBus.Error.UnknownMethod error message when I try to use the new commands. How can I get a file descriptor for a BLE characteristic?
The connection is otherwise working using the notify and write commands:
[KeyDuino:/service0010/char0011]# notify on
[CHG] Attribute /org/bluez/hci0/dev_D4_36_39_DE_61_6B/service0010/char0011 Notifying: yes
Notify started
[CHG] Attribute /org/bluez/hci0/dev_D4_36_39_DE_61_6B/service0010/char0011 Value: 0x33
[CHG] Attribute /org/bluez/hci0/dev_D4_36_39_DE_61_6B/service0010/char0011 Value: 0x32
[CHG] Attribute /org/bluez/hci0/dev_D4_36_39_DE_61_6B/service0010/char0011 Value: 0x31
[KeyDuino:/service0010/char0011]# write 0x30 0x31 0x32
Attempting to write /org/bluez/hci0/dev_D4_36_39_DE_61_6B/service0010/char0011