Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp528030rwe; Thu, 1 Sep 2022 03:52:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VhvcA4uUk//bHj5sZbBnBWkzqCDH+R/NxU+fA6zOXrQiEhLywsgHEwV1aB1oInW7sRTuj X-Received: by 2002:a17:90b:1bc2:b0:1fe:1ad3:4a81 with SMTP id oa2-20020a17090b1bc200b001fe1ad34a81mr7805947pjb.61.1662029567297; Thu, 01 Sep 2022 03:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662029567; cv=none; d=google.com; s=arc-20160816; b=MEaOzjfubs8JOOHC1Dre7Eolvlp7L22NDRtDuDsQPTEf317XYS5NJSoCfk9jj1zJNT plsRfn+J06S+OWXD+V3QiSBiCXLw8yykI+zuJGemeG6Jl8nIjKIqNWjwhI+cYdqGKk0X srMFaOeWdf5gs4gQdG6Qmq5A2PBfnfo/Z/V7oIxEqsJ185gZQaLEEufLtP4EZ9696dR/ omS/LssjxAvQ5nYMIjZ7QGbY49t/3uYsq0fddVhdN8xefl28mkvRpKEjSuA5rZyMXm/4 n73eUdOREGYQyJe9eLcEgjr3R5EYG4ATiEYzEIoBhBbMdX9KW2fyfUKhpdUUcyWn6YBG tdnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=lOo6RCKEyJ/oSw8rYCvET0UF8wxqfIEDnvYDjFAkKV4=; b=FA/jYbbSXqHZJ9APjzNDxBjgT3GGA6sAYBJSO/7UuYSznDeuijvMQXe0XaxdTpqv+A Wxa57cOTF14nBgFgx/GrZzmYVv/1U/cxOXXQNwTmrkunNB58fdX7Pa659aOO1SlgIJ/e u/Kx9f5jJiudSc5DF9sQ06KFyzZLvzVLTIPr5UHVDeXQRvCFEkVUi81W6T90pUHbTwB7 wZ3mADwUokSnFwWLQlFQOnes5EAJIZ1ZOtz9VEhqyH+q1Ji0xd/U0/8YvZmP+XXo6sZ+ ypNujPJIsxCnLHQrPPfo6yShKnOG9FGKC1ydCE8yMyqwlXwqGWPYk+gx5Gu8J9nTf0fq oP2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a056a00230f00b00536c90581f9si17727759pfh.150.2022.09.01.03.52.35; Thu, 01 Sep 2022 03:52:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233640AbiIAKqn convert rfc822-to-8bit (ORCPT + 99 others); Thu, 1 Sep 2022 06:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233486AbiIAKqm (ORCPT ); Thu, 1 Sep 2022 06:46:42 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C86CF8259 for ; Thu, 1 Sep 2022 03:46:41 -0700 (PDT) Received: (Authenticated sender: hadess@hadess.net) by mail.gandi.net (Postfix) with ESMTPSA id DD0B12000D; Thu, 1 Sep 2022 10:46:38 +0000 (UTC) Message-ID: <1ef5e51d2103b6f02826777ebf5415f74018e317.camel@hadess.net> Subject: Re: [PATCH] plugins: Do not try to autopair with Nissan Connect devices From: Bastien Nocera To: Luiz Augusto von Dentz , Florian Leeber Cc: "linux-bluetooth@vger.kernel.org" Date: Thu, 01 Sep 2022 12:46:33 +0200 In-Reply-To: References: <01070182f561c630-852e0333-6f04-448b-b064-46a2f000e860-000000@eu-central-1.amazonses.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Wed, 2022-08-31 at 13:18 -0700, Luiz Augusto von Dentz wrote: > Hi Florian, > > On Wed, Aug 31, 2022 at 12:44 PM Florian Leeber > wrote: > > > > It seems that Nissan Connect carkits a) do not use 0000 but 1234 as > > default code > > but also b) the autopair plugin is not allowed to make a second > > attempt > > to pair. > > Let´s try to not use the autopairing at all for those devices. > > --- > >   plugins/autopair.c | 3 +++ > >   1 file changed, 3 insertions(+) > > > > diff --git a/plugins/autopair.c b/plugins/autopair.c > > index 0b09e89..6bf07e3 100644 > > --- a/plugins/autopair.c > > +++ b/plugins/autopair.c > > @@ -66,6 +66,9 @@ static ssize_t autopair_pincb(struct btd_adapter > > *adapter, > >          /* The iCade shouldn't use random PINs like normal > > keyboards */ > >          if (strstr(name, "iCade") != NULL) > >                  return 0; > > +       /* Nissan Connect carkits use PIN 1234 but refuse a retry > > */ > > +       if (strstr(name, "NISSAN CONNECT") != NULL) > > +               return 0; > > Well this is already starting to grow which imo defeats the purpose > of > hardcoding directly on the code so perhaps we could have a section > e.g. [Autopair] where one can enter device names that shall not use > defaults PINs, or may an entry where one can add its own specific PIN > sequence for a given device name including none: > > [Autopair] > PIN=0000,1234 > # The iCade shouldn't use random PINs like normal keyboards > iCade= > # Nissan Connect carkits use PIN 1234 but it refuses retries > NISSAN CONNECT=1234 > > With this the logic is check if there is an entry for the device name > and then use as PIN otherwise use the PIN entry (if not defined use > the current settings as default). FWIW, gnome-bluetooth has its own database on top of bluez, which we prefer to the code in bluez. I'd be happy getting rid of it. Loads of devices that need pairing despite their class and Bluetooth version, and devices that need special handling like the Navman GPS that expects a non-numerical PIN. The database: https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/blob/master/lib/pin-code-database.xml The code to parse it: https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/blob/master/lib/pin.c