diff options
-rw-r--r-- | drivers/hid/hid-wiimote.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c index 29edd55d4bb0..84c9eb9c8e0d 100644 --- a/drivers/hid/hid-wiimote.c +++ b/drivers/hid/hid-wiimote.c | |||
@@ -57,7 +57,9 @@ struct wiimote_data { | |||
57 | #define WIIPROTO_FLAG_LED(num) (WIIPROTO_FLAG_LED1 << (num - 1)) | 57 | #define WIIPROTO_FLAG_LED(num) (WIIPROTO_FLAG_LED1 << (num - 1)) |
58 | 58 | ||
59 | enum wiiproto_reqs { | 59 | enum wiiproto_reqs { |
60 | WIIPROTO_REQ_NULL = 0x0, | ||
60 | WIIPROTO_REQ_LED = 0x11, | 61 | WIIPROTO_REQ_LED = 0x11, |
62 | WIIPROTO_REQ_DRM = 0x12, | ||
61 | WIIPROTO_REQ_DRM_K = 0x30, | 63 | WIIPROTO_REQ_DRM_K = 0x30, |
62 | }; | 64 | }; |
63 | 65 | ||
@@ -192,6 +194,30 @@ static void wiiproto_req_leds(struct wiimote_data *wdata, int leds) | |||
192 | wiimote_queue(wdata, cmd, sizeof(cmd)); | 194 | wiimote_queue(wdata, cmd, sizeof(cmd)); |
193 | } | 195 | } |
194 | 196 | ||
197 | /* | ||
198 | * Check what peripherals of the wiimote are currently | ||
199 | * active and select a proper DRM that supports all of | ||
200 | * the requested data inputs. | ||
201 | */ | ||
202 | static __u8 select_drm(struct wiimote_data *wdata) | ||
203 | { | ||
204 | return WIIPROTO_REQ_DRM_K; | ||
205 | } | ||
206 | |||
207 | static void wiiproto_req_drm(struct wiimote_data *wdata, __u8 drm) | ||
208 | { | ||
209 | __u8 cmd[3]; | ||
210 | |||
211 | if (drm == WIIPROTO_REQ_NULL) | ||
212 | drm = select_drm(wdata); | ||
213 | |||
214 | cmd[0] = WIIPROTO_REQ_DRM; | ||
215 | cmd[1] = 0; | ||
216 | cmd[2] = drm; | ||
217 | |||
218 | wiimote_queue(wdata, cmd, sizeof(cmd)); | ||
219 | } | ||
220 | |||
195 | static enum led_brightness wiimote_leds_get(struct led_classdev *led_dev) | 221 | static enum led_brightness wiimote_leds_get(struct led_classdev *led_dev) |
196 | { | 222 | { |
197 | struct wiimote_data *wdata; | 223 | struct wiimote_data *wdata; |