3

I am using a Linux computer with bluez version 4.101. I am communicating with a BLE device in slave mode. I am trying to read data from the BLE device. But when I do that the read fails with the following error: "Attribute requires authentication before read/write". I can read data from many other characteristics but I fail on this one. The commands I am using are

-gatttool -b 11:22:33:44:55:66 --char-read

What do I need to do to read this data?

Note: I can read this data from my iPhone. But I need to pair, so maybe it is a pairing issue.

Pete
  • 3,842
  • 3
  • 31
  • 42
StRiDeR
  • 170
  • 2
  • 10

1 Answers1

6

Try using --sec-level=medium or --sec-level=high with gatttool. I'm not sure how those work, but essentially you don't have the right level of security to read that attribute. Pairing ups your security level, and that's why it works on your iPhone.

You may also want to try -I for an interactive prompt with gatttool.

Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
  • 1
    I'm using these parameters but gatttool is never triggering any pairing process with my BLE device, and therefore I continue to have the same error saying I'm not authenticated. I tested both on a Raspberry Pi and an ubuntu VM, with the same results, using BlueZ 5.24 (latest) and 5.11 - the device is an iPhone running a virtual peripheral within LightBlue software. clues? – Eric Castro Oct 06 '14 at 10:37
  • I'm not sure there is any sort of pairing process like regular Bluetooth... Try reading https://developer.bluetooth.org/TechnologyOverview/Pages/LE-Security.aspx I have only used "Just Works" and have no idea how the rest work. – Tim Tisdall Oct 06 '14 at 13:14
  • To help with @EricCastro 's problem above, I also had to have bluetoothd running in order to get gatttool --sec-level=medium to have any effect. – Ryan Nowakowski Jul 15 '15 at 20:09
  • In my case I still had problem. --sec-level=low did the job. – Tõnu Samuel Mar 30 '16 at 00:46