autopair: Add more common PIN codes for audio devices
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(-)
plugins/autopair.c +14 -4
@@ -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 ;
Signature · 1 line
2.14.3
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(+)
plugins/autopair.c +12 -0
@@ -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
Signature · 1 line
2.14.3
Quoted 4 lines · Bastien Nocera
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
Quoted 9 lines · Bastien Nocera
Quoted 4 lines · Bastien Nocera
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
Hi Bastien,
Quoted 7 lines · On Monday, 25 March 2019 12:10:52 CET Bastien Nocera wrote:
Quoted 6 lines · Bastien Nocera
Quoted 4 lines · Bastien Nocera
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.
Quoted 8 lines
Quoted 3 lines
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.
Signature · 2 lines
pozdrawiam Szymon Janc