2017-11-27 15:26:50

by Bastien Nocera

[permalink] [raw]
Subject: [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices

PIN codes "1111", and "1234" are fairly common PIN codes used for audio
devices such as speakers and headsets. This replaces similar quirks
already present in gnome-bluetooth's PIN database.
---
plugins/autopair.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/plugins/autopair.c b/plugins/autopair.c
index 6980b0a64..70e19930e 100644
--- a/plugins/autopair.c
+++ b/plugins/autopair.c
@@ -92,10 +92,20 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter,
case 0x06: /* Headphones */
case 0x07: /* Portable Audio */
case 0x0a: /* HiFi Audio Device */
- if (attempt > 1)
- return 0;
- memcpy(pinbuf, "0000", 4);
- return 4;
+ {
+ const char *pincodes[] = {
+ "0000",
+ "1234",
+ "1111"
+ };
+ const char *pincode;
+
+ if (attempt > G_N_ELEMENTS(pincodes))
+ return 0;
+ pincode = pincodes[attempt - 1];
+ memcpy(pinbuf, pincode, strlen(pincode));
+ return strlen(pincode);
+ }
}
break;

--
2.14.3



2017-11-27 15:28:22

by Bastien Nocera

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices

On Mon, 2017-11-27 at 16:26 +0100, Bastien Nocera wrote:
> PIN codes "1111", and "1234" are fairly common PIN codes used for
> audio
> devices such as speakers and headsets. This replaces similar quirks
> already present in gnome-bluetooth's PIN database.

V2 of this patch, I've tested it again, and it seems to work in my
tests. I've also added another special case for gaming input devices
and remote controls in a second patch.

Cheers

2017-11-27 15:26:51

by Bastien Nocera

[permalink] [raw]
Subject: [PATCH v2 2/2] autopair: Add pin codes to try for gaming input devices

As well as remote controls.
---
plugins/autopair.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/plugins/autopair.c b/plugins/autopair.c
index 70e19930e..043bd9b9d 100644
--- a/plugins/autopair.c
+++ b/plugins/autopair.c
@@ -111,6 +111,18 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter,

case 0x05: /* Peripheral */
switch ((class & 0xc0) >> 6) {
+ case 0x00:
+ switch ((class & 0x1e) >> 2) {
+ case 0x01: /* Joystick */
+ case 0x02: /* Gamepad */
+ case 0x03: /* Remote Control */
+ if (attempt > 1)
+ return 0;
+ memcpy(pinbuf, "0000", 4);
+ return 4;
+ }
+
+ break;
case 0x01: /* Keyboard */
case 0x03: /* Combo keyboard/pointing device */
/* For keyboards rejecting the first random code
--
2.14.3


2019-03-25 11:11:20

by Bastien Nocera

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices

On Mon, 2017-11-27 at 16:28 +0100, Bastien Nocera wrote:
> On Mon, 2017-11-27 at 16:26 +0100, Bastien Nocera wrote:
> > PIN codes "1111", and "1234" are fairly common PIN codes used for
> > audio
> > devices such as speakers and headsets. This replaces similar quirks
> > already present in gnome-bluetooth's PIN database.
>
> V2 of this patch, I've tested it again, and it seems to work in my
> tests. I've also added another special case for gaming input devices
> and remote controls in a second patch.

The 2 patches in this patchset still apply, and are still relevant.
Could those be reviewed and merged, please?

Cheers


2019-03-26 10:53:30

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices

Hi Bastien,

On Monday, 25 March 2019 12:10:52 CET Bastien Nocera wrote:
> On Mon, 2017-11-27 at 16:28 +0100, Bastien Nocera wrote:
> > On Mon, 2017-11-27 at 16:26 +0100, Bastien Nocera wrote:
> > > PIN codes "1111", and "1234" are fairly common PIN codes used for
> > > audio
> > > devices such as speakers and headsets. This replaces similar quirks
> > > already present in gnome-bluetooth's PIN database.
> >
> > V2 of this patch, I've tested it again, and it seems to work in my
> > tests. I've also added another special case for gaming input devices
> > and remote controls in a second patch.
>
> The 2 patches in this patchset still apply, and are still relevant.
> Could those be reviewed and merged, please?
>
> Cheers

I've must have miss those, sorry for that.
Both patches are now applied.


--
pozdrawiam
Szymon Janc