diff options
| -rw-r--r-- | drivers/hid/hid-wiimote.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c index 84c9eb9c8e0d..85a02e5f9fe8 100644 --- a/drivers/hid/hid-wiimote.c +++ b/drivers/hid/hid-wiimote.c | |||
| @@ -60,6 +60,8 @@ enum wiiproto_reqs { | |||
| 60 | WIIPROTO_REQ_NULL = 0x0, | 60 | WIIPROTO_REQ_NULL = 0x0, |
| 61 | WIIPROTO_REQ_LED = 0x11, | 61 | WIIPROTO_REQ_LED = 0x11, |
| 62 | WIIPROTO_REQ_DRM = 0x12, | 62 | WIIPROTO_REQ_DRM = 0x12, |
| 63 | WIIPROTO_REQ_STATUS = 0x20, | ||
| 64 | WIIPROTO_REQ_RETURN = 0x22, | ||
| 63 | WIIPROTO_REQ_DRM_K = 0x30, | 65 | WIIPROTO_REQ_DRM_K = 0x30, |
| 64 | }; | 66 | }; |
| 65 | 67 | ||
| @@ -313,6 +315,26 @@ static void handler_keys(struct wiimote_data *wdata, const __u8 *payload) | |||
| 313 | input_sync(wdata->input); | 315 | input_sync(wdata->input); |
| 314 | } | 316 | } |
| 315 | 317 | ||
| 318 | static void handler_status(struct wiimote_data *wdata, const __u8 *payload) | ||
| 319 | { | ||
| 320 | handler_keys(wdata, payload); | ||
| 321 | |||
| 322 | /* on status reports the drm is reset so we need to resend the drm */ | ||
| 323 | wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL); | ||
| 324 | } | ||
| 325 | |||
| 326 | static void handler_return(struct wiimote_data *wdata, const __u8 *payload) | ||
| 327 | { | ||
| 328 | __u8 err = payload[3]; | ||
| 329 | __u8 cmd = payload[2]; | ||
| 330 | |||
| 331 | handler_keys(wdata, payload); | ||
| 332 | |||
| 333 | if (err) | ||
| 334 | hid_warn(wdata->hdev, "Remote error %hhu on req %hhu\n", err, | ||
| 335 | cmd); | ||
| 336 | } | ||
| 337 | |||
| 316 | struct wiiproto_handler { | 338 | struct wiiproto_handler { |
| 317 | __u8 id; | 339 | __u8 id; |
| 318 | size_t size; | 340 | size_t size; |
| @@ -320,6 +342,8 @@ struct wiiproto_handler { | |||
| 320 | }; | 342 | }; |
| 321 | 343 | ||
| 322 | static struct wiiproto_handler handlers[] = { | 344 | static struct wiiproto_handler handlers[] = { |
| 345 | { .id = WIIPROTO_REQ_STATUS, .size = 6, .func = handler_status }, | ||
| 346 | { .id = WIIPROTO_REQ_RETURN, .size = 4, .func = handler_return }, | ||
| 323 | { .id = WIIPROTO_REQ_DRM_K, .size = 2, .func = handler_keys }, | 347 | { .id = WIIPROTO_REQ_DRM_K, .size = 2, .func = handler_keys }, |
| 324 | { .id = 0 } | 348 | { .id = 0 } |
| 325 | }; | 349 | }; |
