HID: wiimote: add Nunchuk support
[deliverable/linux.git] / drivers / hid / hid-wiimote-core.c
index 90ea5a2565d41a37f37f816142e1fa2a6a7e95cd..dedf3c84e243f59162adc5e4e79e257a962bf32e 100644 (file)
@@ -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",
 };
 
This page took 0.038148 seconds and 5 git commands to generate.