1 From ee2b70a486671016ca33e48fe25c99474465e1c4 Mon Sep 17 00:00:00 2001
2 From: David Herrmann <dh.herrmann@googlemail.com>
3 Date: Thu, 29 Dec 2011 17:35:30 +0100
4 Subject: [PATCH 2/2] Detect Wii Remotes by device name
6 We currently detect Wii Remotes by DID information. However, not all Wii Remotes
7 (especially 3rd party Wii Remotes) provide DID information. Moreover, they
8 provide no way of identifying them aside from their device name. Hence, this
9 adds an experimental name-detection for Wii Remotes.
11 plugins/wiimote.c | 13 ++++++++-----
12 1 files changed, 8 insertions(+), 5 deletions(-)
14 diff --git a/plugins/wiimote.c b/plugins/wiimote.c
15 index 1ae638b..568bfd5 100644
16 --- a/plugins/wiimote.c
17 +++ b/plugins/wiimote.c
21 #include <bluetooth/bluetooth.h>
26 @@ -60,18 +61,20 @@ static ssize_t wii_pincb(struct btd_adapter *adapter, struct btd_device *device,
28 uint16_t vendor, product;
31 + char addr[18], name[25];
33 adapter_get_address(adapter, &sba);
34 device_get_address(device, &dba, NULL);
37 vendor = btd_device_get_vendor(device);
38 - if (vendor != 0x057e)
41 product = btd_device_get_product(device);
42 - if (product == 0x0306) {
44 + device_get_name(device, name, sizeof(name));
45 + name[sizeof(name) - 1] = 0;
47 + if (g_str_equal(name, "Nintendo RVL-CNT-01") ||
48 + (vendor == 0x057e && product == 0x0306)) {
49 DBG("Forcing fixed pin on detected wiimote %s", addr);
50 memcpy(pinbuf, &sba, 6);