From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Cc: Bastien Nocera <hadess@hadess.net>
Subject: [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices
Date: Mon, 27 Nov 2017 16:26:50 +0100 [thread overview]
Message-ID: <20171127152651.18997-1-hadess@hadess.net> (raw)
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
next reply other threads:[~2017-11-27 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 15:26 Bastien Nocera [this message]
2017-11-27 15:26 ` [PATCH v2 2/2] autopair: Add pin codes to try for gaming input devices Bastien Nocera
2017-11-27 15:28 ` [PATCH v2 1/2] autopair: Add more common PIN codes for audio devices Bastien Nocera
2019-03-25 11:10 ` Bastien Nocera
2019-03-26 10:53 ` Szymon Janc
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=20171127152651.18997-1-hadess@hadess.net \
--to=hadess@hadess.net \
--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).