Blame SOURCES/0002-autopair-Don-t-handle-the-iCade.patch

8866cd
From c16ae7041c7511d8d1ed8441f696716fa6a9117e Mon Sep 17 00:00:00 2001
8866cd
From: Bastien Nocera <hadess@hadess.net>
8866cd
Date: Tue, 19 Nov 2013 14:11:39 +0100
8866cd
Subject: [PATCH 2/5] autopair: Don't handle the iCade
8866cd
8866cd
We can't easily enter digits other than 1 through 4 (inclusive)
8866cd
so leave it up to the agent to figure out a good passcode
8866cd
for the iCade.
8866cd
8866cd
Note that we can not use the VID/PID of the device, as it is not
8866cd
yet known at that point.
8866cd
---
8866cd
 plugins/autopair.c | 12 +++++++++++-
8866cd
 1 file changed, 11 insertions(+), 1 deletion(-)
8866cd
8866cd
diff --git a/plugins/autopair.c b/plugins/autopair.c
8866cd
index 8c98c12..5d2f6f7 100644
8866cd
--- a/plugins/autopair.c
8866cd
+++ b/plugins/autopair.c
8866cd
@@ -57,13 +57,23 @@ static ssize_t autopair_pincb(struct btd_adapter *adapter,
8866cd
 {
8866cd
 	char addr[18];
8866cd
 	char pinstr[7];
8866cd
+	char name[25];
8866cd
 	uint32_t class;
8866cd
 
8866cd
 	ba2str(device_get_address(device), addr);
8866cd
 
8866cd
 	class = btd_device_get_class(device);
8866cd
 
8866cd
-	DBG("device %s 0x%x", addr, class);
8866cd
+	device_get_name(device, name, sizeof(name));
8866cd
+	name[sizeof(name) - 1] = 0;
8866cd
+
8866cd
+	DBG("device %s (%s) 0x%x", addr, name, class);
8866cd
+
8866cd
+	g_message ("vendor 0x%X product: 0x%X", btd_device_get_vendor (device), btd_device_get_product (device));
8866cd
+
8866cd
+	/* The iCade shouldn't use random PINs like normal keyboards */
8866cd
+	if (name != NULL && strstr(name, "iCade") != NULL)
8866cd
+		return 0;
8866cd
 
8866cd
 	/* This is a class-based pincode guesser. Ignore devices with an
8866cd
 	 * unknown class.
8866cd
-- 
8866cd
1.8.4.2
8866cd