Bluetooth Low Energy: listening for notifications/indications in linux

Try this…

Run gatttool -b <MAC Address> --interactive like you did before. You’ll get a prompt and then you type connect. You should see a CON in the prompt indicating that you’ve connected to the device. Then type char-read-uuid 2902. You should get a list of all CCC (Client Characteristic Configuration) attributes on the device. You can try setting them all to 0100 to get notifications, 0200 for indications, 0300 for both, or 0000 for everything off. Type help to see all the commands and their arguments.

EDIT:

The use of the --listen argument requires you to couple it with other commands to turn on the notifications and/or indications. So here’s an example that works in Bluez 4.101:

gatttool -b <MAC Address> --char-write-req --handle=0x0031 --value=0100 --listen

Obviously you need to change the handle to the handle of the CCC that you want to turn on notifications for. However, I still find it way easier to just use the interactive mode.

Leave a Comment