Re: What could cause pairing to fail when bluetoothctl is not running?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luiz Augusto von Dentz Wrote:
>have you tried
>just running bluetoothctl to see if that makes it work?

Yes that was the point of my title.  In 5.4 Linux I do not need bluetoothctl running, but in 5.10 I do.  This is a BLE GATT Client.  I do not save anything  involving credentials, there are none for me to save. I always remove the device on disconnect because there are too many devices.  Connections are short lived. There is nothing to do for pairing except to exchange public keys.

I cannot let bluetoothctl run because I have an embedded device, and scans by bluetoothctl add to the CPU load, and I cannot turn scan off because I need to know when a new BLE device advertises.  Devices are not advertising when there is nothing for me to do.  I have a filter, but bluetoothctl ignores the filter, but my application works fine with the filter.

So if this is a new requirement in 5.10 Linux, I need to add an agent to my application.

Looking at the agent documentation:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/agent-api.txt

Agent-api.txt says:
>It is not required by an application to register
>an agent. If an application does chooses to not
>register an agent, the default agent is used. This
>is on most cases a good idea. Only application
>like a pairing wizard should register their own
>agent.

Is this documentation obsolete as of 5.10?

When I run bluetoothctl, nothing happens in bluetoothctl during pairing (which is what I would expect). It just makes things work.  If I create an agent, it should be a trivial one with NoInputNoOutput set.  There is no pin.  There is nothing to do.

Right now I am trying to determine what exactly needs to be done.


<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div style="font-family:Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)"><br></div><hr tabindex="-1" style="display:inline-block; width:98%"><div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Luiz Augusto von Dentz &lt;luiz.dentz@xxxxxxxxx&gt;<br><b>Sent:</b> Tuesday, August 30, 2022 5:28 PM<br><b>To:</b> John Klug &lt;John.Klug@xxxxxxxxxxxxx&gt;<br><b>Cc:</b> Linux-Bluetooth MailingList &lt;linux-bluetooth@xxxxxxxxxxxxxxx&gt;<br><b>Subject:</b> Re: What could cause pairing to fail when bluetoothctl is not running?</font> <div>&nbsp;</div></div><div class="BodyFragment"><font size="2"><span style="font-size:11pt"><div class="PlainText">Hi John,<br><br>On Tue, Aug 30, 2022 at 3:22 PM John Klug &lt;John.Klug@xxxxxxxxxxxxx&gt; wrote:<br>&gt;<br>&gt; I am now looking at what is going on with a sniffer.&nbsp; For some reason in 5.10, the AuthReq always comes from the slave (BlueZ is the master, GATT client):<br>&gt;<br>&gt; 5.10 kernel which fails, leaving out empty PDU, L2CAP Fragments, etc.&nbsp; This sequence is reproducible.<br>&gt;<br>&gt; Sent slave CONNECT_IND<br>&gt; Rcvd Security Request: AuthReq: Bonding, SecureConnection<br>&gt; Sent Pairing Failed: Pairing not Supported<br>&gt; Sent Pairing Failed: Pairing not Supported<br>&gt; Rcvd Exchange MTU Response ...<br>&gt; Sent Pairing Request: AuthReq: No Bonding, SecureConnection | Initiator Key(s): &lt;none&gt; | Responder key(s) IRK<br>&gt; Sent Control Opcode LL_LENGTH_RSP<br>&gt; Rcvd Pairing Response: AuthReq: No Bonding, SecureConnection | Initiator Key(s): &lt;none&gt; | Responder key(s)<br>&gt; Sent Pairing Public Key<br>&gt; Sent Read By Type Request, Sever Supported Features, Handles: ...<br>&gt; Recvd Pairing Public Key<br>&gt; Rcvd Pairing Confirm<br>&gt; Rcvd Error Response - Attribute Not Found, Handle: 0x0001 (Unknown)<br>&gt; Sent Pairing Random<br>&gt; Sent Read by Group Type Request, Gatt ...<br>&gt; Rcvd Pairing Random<br>&gt; Send Pairing Failed: Numeric Comparison Failed<br>&gt;<br>&gt; The 5.4 kernel always works, but BlueZ/Linux sends the first AuthReq:<br>&gt;<br>&gt; Sent Slave CONNECT_IND<br>&gt; Sent Pairing Request: AuthReq: No Bonding, SecureConnection | Initiator Key(s): &lt;none&gt; | Responder key(s)<br>&gt; Rcvd Pairing Response: AuthReq: No Bonding, SecureConnection | Initiator Key(s): &lt;none&gt; | Responder key(s)<br>&gt; Sent Read By Type Request, Sever Supported Features, Handles: ...<br>&gt; Rcvd Pairing Response: AuthReq: No Bonding, SecureConnection | Initiator Key(s): &lt;none&gt; | Responder<br>&gt; Sent Read by Group Type Request, Gatt ..<br>&gt; Rcvd Pairing Confirm<br>&gt; Rcvd Read by Group Type Response, Attribute ..<br>&gt; Sent Pairing Random<br>&gt; Sent Read by Group Type Request, Gatt ..<br>&gt; Rcvd Pairing Random<br>&gt; Sent Pairing DHKey Check<br>&gt;<br>&gt; Should the program be sending a Pair using the Device API?&nbsp; Is there something else to cause the public key exchange?&nbsp; In the 5.4 case, the &quot;Paired&quot; property is always being set by the Device API.<br><br>Either way you need a pairing agent in case the device for some reason<br>removes its link key and then you need to repair, besides the agent<br>also does authorization when the device is not trusted, have you tried<br>just running bluetoothctl to see if that makes it work?<br><br>-- <br>Luiz Augusto von Dentz<br></div></span></font></div></body></html>



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux