From f848ef318f6a89b30f9c1edaed2413ffbc8d20ce Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 17 Aug 2011 11:43:23 +0200 Subject: [PATCH] --- yaml --- r: 263273 b: refs/heads/master c: 2cb5e4bc530471e9596cd32390bf70c8ada13d9a h: refs/heads/master i: 263271: f6db90c6200ce2219add3f10952a61968a8657ec v: v3 --- [refs] | 2 +- trunk/drivers/hid/hid-wiimote.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 9f7ca517d4fd..6101e5ef6dc7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 23a5a4a39eddbe515a832767a371cc54e82cc25e +refs/heads/master: 2cb5e4bc530471e9596cd32390bf70c8ada13d9a diff --git a/trunk/drivers/hid/hid-wiimote.c b/trunk/drivers/hid/hid-wiimote.c index 29edd55d4bb0..84c9eb9c8e0d 100644 --- a/trunk/drivers/hid/hid-wiimote.c +++ b/trunk/drivers/hid/hid-wiimote.c @@ -57,7 +57,9 @@ struct wiimote_data { #define WIIPROTO_FLAG_LED(num) (WIIPROTO_FLAG_LED1 << (num - 1)) enum wiiproto_reqs { + WIIPROTO_REQ_NULL = 0x0, WIIPROTO_REQ_LED = 0x11, + WIIPROTO_REQ_DRM = 0x12, WIIPROTO_REQ_DRM_K = 0x30, }; @@ -192,6 +194,30 @@ static void wiiproto_req_leds(struct wiimote_data *wdata, int leds) wiimote_queue(wdata, cmd, sizeof(cmd)); } +/* + * Check what peripherals of the wiimote are currently + * active and select a proper DRM that supports all of + * the requested data inputs. + */ +static __u8 select_drm(struct wiimote_data *wdata) +{ + return WIIPROTO_REQ_DRM_K; +} + +static void wiiproto_req_drm(struct wiimote_data *wdata, __u8 drm) +{ + __u8 cmd[3]; + + if (drm == WIIPROTO_REQ_NULL) + drm = select_drm(wdata); + + cmd[0] = WIIPROTO_REQ_DRM; + cmd[1] = 0; + cmd[2] = drm; + + wiimote_queue(wdata, cmd, sizeof(cmd)); +} + static enum led_brightness wiimote_leds_get(struct led_classdev *led_dev) { struct wiimote_data *wdata;