Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
631 views
in Technique[技术] by (71.8m points)

bluetooth - Attribute requires authentication before read/write

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...