Q:

GATTTool fails to read/write characteristics

I'm trying to use bluez's gatttool to write to some demo characteristics on a BLE custom board. Specifically I'm hoping to write to a characteristic and read the value back out. Here's what I'm doing (where 0x25 is the handle for the characteristic):
bluepy$ gatttool -b EC:24:B8:23:1C:39 -I
[   ][EC:24:B8:23:1C:39][LE]> connect
[CON][EC:24:B8:23:1C:39][LE]> char-read-hnd 0x0025 
[CON][EC:24:B8:23:1C:39][LE]> Characteristic value/descriptor: 01
[CON][EC:24:B8:23:1C:39][LE]> char-write-cmd 0x25 0x02
[CON][EC:24:B8:23:1C:39][LE]> char-read-hnd 0x0025
[CON][EC:24:B8:23:1C:39][LE]> Characteristic value/descriptor: 00

Does anyone know why the characteristic value read is 00 rather than 02 (second argument of char-write-cmd)?
Any help will be appreciated.

A:

While there are rules and standards for BLE, the underlying device can simply ignore those and do their own thing.  So, it's possible that it's listing the attribute as read-write and appearing to accept new values, but then just dropping the values.  It shouldn't be doing that, but there's no reason it can't.
However, you should make sure that it's actually sending the right data and the issue is with the device...  As mentioned in the comments gatttool can be a little messed up with interpreting inputs (newer versions are better than older ones), so try 02 or 2 instead of 0x02.  You could also try using btmon to check that gatttool is actually sending the value you're intending.

