Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp107434ybb; Fri, 27 Mar 2020 17:12:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsYq4tYgWFT+ps+ZhqV4RmpGBqT5/78UFfCvaTWLQgPQJSmJK7y9cjlWybvOLvqljJglC7J X-Received: by 2002:a9d:7607:: with SMTP id k7mr976210otl.205.1585354358568; Fri, 27 Mar 2020 17:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585354358; cv=none; d=google.com; s=arc-20160816; b=xRi9BAAjVtJTU167Spcwp8vyluMg2N8gGwSoxXJx5YI2EiRVsNYt4+e0AOUOwff+jw U+s5j/pk6DKMsQnc6sGd1RJbzPiCBg0lHCGuzPKTBsd4Rb8NqevXoBkp99PeVVKezMYC ye7TXbil0iMPr02RArGLkclXEPHDyGoKXPeYwWtuoPSttAB9h+rvmyssrOMxAfB+YfBo 5gzXmciz46SodUeKQaOsBqTj8Whz6Zxkd1VPhiP/4ecRP6gE+mOLwe1kKpf5oPdr1d55 26HYksBvG+JSBINHIvDHnuy/4P03KxpWN18Ut10KU8R+3E4/7XzeNFl2sKKHPChCUZDl +JMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=8SKf147sx6Up652j5vl0kFkxoWFi/Cb8UYi+eKKoUfU=; b=cUKRWP7maAwhvMsP6//KW0p3lEBLyLH47Ewr0y+Fzel2V/LvzOQQSuUE5vqzx8L3/n oaH+p21mZc6eSj6/eC3qd8xZrXTuMw2GVNtjbXncqpx9o5LDYkc60arxlNd8AnCDDoJ2 vwUvorIiBpZ+HsFhH3k6tvzGHms7cWksuxpVePZ0HhmNKX4Chm2G2EL6q/z571DTPpCN dR2Rq+tFSMFQOkNG9D7M40Gdo3OBUjbr6HcaIz/T1VExeXjjR/xAYpz9Mi1bUqMq1xvE 7v23heq+aCweZG2SqtQHoqVrP2aBtmVCS4G8Ri0oIOvTijUExWNYTJ74A11JlGc/AouW tdCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kYIK8Ljp; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si3140379otn.291.2020.03.27.17.12.26; Fri, 27 Mar 2020 17:12:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kYIK8Ljp; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbgC1AMP (ORCPT + 99 others); Fri, 27 Mar 2020 20:12:15 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:36905 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727193AbgC1AMP (ORCPT ); Fri, 27 Mar 2020 20:12:15 -0400 Received: by mail-oi1-f195.google.com with SMTP id u20so5679970oic.4 for ; Fri, 27 Mar 2020 17:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=8SKf147sx6Up652j5vl0kFkxoWFi/Cb8UYi+eKKoUfU=; b=kYIK8LjpUahfNDPSTbiSCu5D3zrANEpLCCreZLcRCD6oJ76tKT50UwlXSTpZEcWOiK tjzbDD2ymLsIjsUKCJ+1LwYZEtR2ovNheRXyvlO8NOUdIE5xaTmfSgmD/xSXoS0wyl32 lEg6i0W5v+ya1Gyx9DhDDk0l+h0B1028rtcy0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8SKf147sx6Up652j5vl0kFkxoWFi/Cb8UYi+eKKoUfU=; b=UOgXYlb7MAlBr4vSZ3BQohkuAk1qeeIHDJBAg6DAFjWSwUXOtW5mzUO17jdynUPIp2 QiPqwbaGVX+OcSujoSkEFSM+Gu2Zn+IECyd8aCCJ902Dz+/4jCI3HD7CtcxFkB9faA5F Qz09upumARWFompC2EV+LFmDwlYaeH55OGN37HiSoOocjK6RsYTJ33KSDzGY9156zVIJ plziFQkryvqeLDX6OuBAltXJk0l7hMJlG5GgExYCvP4uw3X01C3GZpPSNdmyaxhhlz93 W6bK7vRu6FhPAFu/mbJhsDuBwNjq3r4SvntyghLyWNfb48sljxYM3mIFbFgVugfz8CvR zt2A== X-Gm-Message-State: ANhLgQ3QE/XYkz6vlbUX/yaneXlOenJNh10rImdswi8cELUqsLtaHY/s 0QyEBsjqjVv3PzTMr9IXItQbbKqS8BRCL9szBcQ6p4VAPzg= X-Received: by 2002:aca:dd55:: with SMTP id u82mr99769oig.27.1585354334867; Fri, 27 Mar 2020 17:12:14 -0700 (PDT) MIME-Version: 1.0 From: Sonny Sasaka Date: Fri, 27 Mar 2020 17:12:04 -0700 Message-ID: Subject: [PATCH] core/device: Handle Just-Works auto-accept To: BlueZ Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The kernel starts to always request confirmation to BlueZ daemon for Just-Works pairing. In this patch the daemon does auto-accept if the client has clearly indicated a pairing intent by calling the Pair() D-Bus API. --- src/device.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index 69f98e488..db14cc129 100644 --- a/src/device.c +++ b/src/device.c @@ -6168,12 +6168,22 @@ int device_confirm_passkey(struct btd_device *device, uint8_t type, auth->passkey = passkey; - if (confirm_hint) + if (confirm_hint) { + if (device->bonding != NULL) { + /* We know the client has indicated the intent to pair + * with the peer device, so we can auto-accept. */ + btd_adapter_confirm_reply(device->adapter, + &device->bdaddr, + type, TRUE); + return 0; + } + err = agent_request_authorization(auth->agent, device, confirm_cb, auth, NULL); - else + } else { err = agent_request_confirmation(auth->agent, device, passkey, confirm_cb, auth, NULL); + } if (err < 0) { if (err == -EINPROGRESS) { -- 2.17.1