linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Florian Leeber <florian@ubports.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] plugins: Do not try to autopair with Nissan Connect devices
Date: Wed, 31 Aug 2022 13:18:00 -0700	[thread overview]
Message-ID: <CABBYNZJGc2Y3UULighw95un9mb8khLM2dfTOB3jRV8D3ksVDXg@mail.gmail.com> (raw)
In-Reply-To: <01070182f561c630-852e0333-6f04-448b-b064-46a2f000e860-000000@eu-central-1.amazonses.com>

Hi Florian,

On Wed, Aug 31, 2022 at 12:44 PM Florian Leeber <florian@ubports.com> 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).

>          /* This is a class-based pincode guesser. Ignore devices with an
>           * unknown class.
> --
> 2.17.1
>


-- 
Luiz Augusto von Dentz

  parent reply	other threads:[~2022-08-31 20:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 19:30 [PATCH] plugins: Do not try to autopair with Nissan Connect devices Florian Leeber
2022-08-31 19:42 ` bluez.test.bot
2022-08-31 20:18 ` Luiz Augusto von Dentz [this message]
2022-09-01 10:46   ` [PATCH] " Bastien Nocera
2022-09-01 18:10     ` Florian Leeber
2022-09-01 23:56       ` Luiz Augusto von Dentz
2022-09-02 18:50         ` Florian Leeber
2022-09-29 16:49 ` bluez.test.bot
2022-09-29 17:44 ` bluez.test.bot
2022-09-29 18:40 ` bluez.test.bot
2022-09-29 19:01 ` bluez.test.bot
2022-09-29 19:29 ` bluez.test.bot
2022-09-29 19:47 ` bluez.test.bot
2022-09-29 20:34 ` bluez.test.bot
2022-09-29 20:53 ` bluez.test.bot
2022-09-29 21:30 ` bluez.test.bot
2022-09-29 21:52 ` bluez.test.bot
2022-09-29 22:32 ` bluez.test.bot
2022-09-29 22:52 ` bluez.test.bot
2022-09-29 23:40 ` bluez.test.bot
2022-09-29 23:59 ` bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABBYNZJGc2Y3UULighw95un9mb8khLM2dfTOB3jRV8D3ksVDXg@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=florian@ubports.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).