Re: [PATCH] plugins: Do not try to autopair with Nissan Connect devices

Luiz Augusto von Dentz
2022-08-31T20:18:16Z

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