aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-02-22 21:29:51 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-15 10:34:03 -0300
commitdfe14a340f8135c28d41be20b03ce21d7aa7e3d9 (patch)
treedee7bba43a6cc70c07aa84c294eb54ce1f2d536f /plugins
parenta3b9f74c8213f4ae8600e52b1117178ff79b9b66 (diff)
downloadbluez-dfe14a340f8135c28d41be20b03ce21d7aa7e3d9.tar.gz
bluez-dfe14a340f8135c28d41be20b03ce21d7aa7e3d9.tar.xz
bluez-dfe14a340f8135c28d41be20b03ce21d7aa7e3d9.zip
wiimote: Detect Wii Remotes by device name
We currently detect Wii Remotes by DID information. However, not all Wii Remotes (especially 3rd party Wii Remotes) provide DID information. Moreover, they provide no way of identifying them aside from their device name. Hence, this adds an experimental name-detection for Wii Remotes.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wiimote.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/wiimote.c b/plugins/wiimote.c
index 1ae638bf..568bfd56 100644
--- a/plugins/wiimote.c
+++ b/plugins/wiimote.c
@@ -26,6 +26,7 @@
#endif
#include <bluetooth/bluetooth.h>
+#include <glib.h>
#include "plugin.h"
#include "adapter.h"
@@ -60,18 +61,20 @@ static ssize_t wii_pincb(struct btd_adapter *adapter, struct btd_device *device,
{
uint16_t vendor, product;
bdaddr_t sba, dba;
- char addr[18];
+ char addr[18], name[25];
adapter_get_address(adapter, &sba);
device_get_address(device, &dba, NULL);
ba2str(&dba, addr);
vendor = btd_device_get_vendor(device);
- if (vendor != 0x057e)
- return 0;
-
product = btd_device_get_product(device);
- if (product == 0x0306) {
+
+ device_get_name(device, name, sizeof(name));
+ name[sizeof(name) - 1] = 0;
+
+ if (g_str_equal(name, "Nintendo RVL-CNT-01") ||
+ (vendor == 0x057e && product == 0x0306)) {
DBG("Forcing fixed pin on detected wiimote %s", addr);
memcpy(pinbuf, &sba, 6);
return 6;