blob: e9126a34e4c477a80993d86ae14cb804025d4c7f [file] [log] [blame]
From 36358d4a7b3471f5a124a95fec9ed0e4871299e0 Mon Sep 17 00:00:00 2001
From: Scott James Remnant <scott@netsplit.com>
Date: Wed, 18 Apr 2012 15:53:55 -0700
Subject: [PATCH 14/14] autopair: use 0000 as PIN for dumb devices
Android tries 0000 for a set of audio devices, so follow suit and
do the same even though most audio devices support SSP these days.
BUG=chromium-os:25211
TEST=verified with audio devices after 'hciconfig hci0 sspmode 0'
---
plugins/autopair.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/plugins/autopair.c b/plugins/autopair.c
index 05de3ff..5b773c5 100644
--- a/plugins/autopair.c
+++ b/plugins/autopair.c
@@ -150,10 +150,24 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter,
}
switch ((class & 0x1f00) >> 8) {
- case 0x05:
+ case 0x04: // Audio/Video
+ switch ((class & 0xfc) >> 2) {
+ case 0x01: // Wearable Headset Device
+ case 0x02: // Hands-free Device
+ case 0x06: // Headphones
+ case 0x07: // Portable Audio
+ case 0x0a: // HiFi Audio Device
+ if (autopair_attempt(device)) {
+ memcpy(pinbuf, "0000", 4);
+ return 4;
+ }
+ break;
+ }
+ break;
+ case 0x05: // Peripheral
switch ((class & 0xc0) >> 6) {
- case 0x01:
- case 0x03:
+ case 0x01: // Keyboard
+ case 0x03: // Combo keyboard/pointing device
if (autopair_attempt(device)) {
char pinstr[7];
srand(time(NULL));
@@ -164,6 +178,12 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter,
return 6;
}
break;
+ case 0x02: // Pointing device
+ if (autopair_attempt(device)) {
+ memcpy(pinbuf, "0000", 4);
+ return 4;
+ }
+ break;
}
break;
}
--
1.7.7.3