summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wiimote-core.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-05-05 23:12:59 +0200
committerJiri Kosina <jkosina@suse.cz>2013-06-03 11:07:03 +0200
commitb6ee67b37c02790ba9bd170ee1fe0d2cd2941001 (patch)
treed0e40e6d68175340473c789f43f663a36270cb85 /drivers/hid/hid-wiimote-core.c
parentf1d4bed45b553dda2be402e427d8d708c4dca85d (diff)
downloadlinux-b6ee67b37c02790ba9bd170ee1fe0d2cd2941001.tar.bz2
HID: wiimote: add Nunchuk support
This moves the nunchuk parser over to an extension module. This allows to make use of hotplugged Nunchuks instead of the old static parser. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-wiimote-core.c')
-rw-r--r--drivers/hid/hid-wiimote-core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
index 90ea5a2565d4..dedf3c84e243 100644
--- a/drivers/hid/hid-wiimote-core.c
+++ b/drivers/hid/hid-wiimote-core.c
@@ -444,6 +444,8 @@ static __u8 wiimote_cmd_read_ext(struct wiimote_data *wdata, __u8 *rmem)
rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff)
return WIIMOTE_EXT_NONE;
+ if (rmem[4] == 0x00 && rmem[5] == 0x00)
+ return WIIMOTE_EXT_NUNCHUK;
if (rmem[4] == 0x04 && rmem[5] == 0x02)
return WIIMOTE_EXT_BALANCE_BOARD;
@@ -478,6 +480,9 @@ static bool wiimote_cmd_map_mp(struct wiimote_data *wdata, __u8 exttype)
/* map MP with correct pass-through mode */
switch (exttype) {
+ case WIIMOTE_EXT_NUNCHUK:
+ wmem = 0x05;
+ break;
default:
wmem = 0x04;
break;
@@ -1034,6 +1039,7 @@ out_release:
static const char *wiimote_exttype_names[WIIMOTE_EXT_NUM] = {
[WIIMOTE_EXT_NONE] = "None",
[WIIMOTE_EXT_UNKNOWN] = "Unknown",
+ [WIIMOTE_EXT_NUNCHUK] = "Nintendo Wii Nunchuk",
[WIIMOTE_EXT_BALANCE_BOARD] = "Nintendo Wii Balance Board",
};