* [PATCH] autopair: Add more common PIN codes for audio devices
@ 2017-11-03 10:55 Bastien Nocera
0 siblings, 0 replies; only message in thread
From: Bastien Nocera @ 2017-11-03 10:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: 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.
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-03 10:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 10:55 [PATCH] autopair: Add more common PIN codes for audio devices Bastien Nocera
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).