Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264757
b: refs/heads/master
c: e3979a9
h: refs/heads/master
i:
  264755: 6fb63c3
v: v3
  • Loading branch information
David Herrmann authored and Jiri Kosina committed Sep 7, 2011
1 parent d236828 commit d9c1197
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0370d7cb30716b202b2412b9b2d4740fd3152d30
refs/heads/master: e3979a9189d744ffecae1bcd36ae0a8b6d22f65f
18 changes: 18 additions & 0 deletions trunk/drivers/hid/hid-wiimote.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct wiimote_state {
__u32 opt;

/* results of synchronous requests */
__u8 cmd_battery;
__u8 cmd_err;
};

Expand Down Expand Up @@ -83,6 +84,7 @@ enum wiiproto_reqs {
WIIPROTO_REQ_LED = 0x11,
WIIPROTO_REQ_DRM = 0x12,
WIIPROTO_REQ_IR1 = 0x13,
WIIPROTO_REQ_SREQ = 0x15,
WIIPROTO_REQ_WMEM = 0x16,
WIIPROTO_REQ_RMEM = 0x17,
WIIPROTO_REQ_IR2 = 0x1a,
Expand Down Expand Up @@ -354,6 +356,17 @@ static void wiiproto_req_drm(struct wiimote_data *wdata, __u8 drm)
wiimote_queue(wdata, cmd, sizeof(cmd));
}

static void wiiproto_req_status(struct wiimote_data *wdata)
{
__u8 cmd[2];

cmd[0] = WIIPROTO_REQ_SREQ;
cmd[1] = 0;

wiiproto_keep_rumble(wdata, &cmd[1]);
wiimote_queue(wdata, cmd, sizeof(cmd));
}

static void wiiproto_req_accel(struct wiimote_data *wdata, __u8 accel)
{
accel = !!accel;
Expand Down Expand Up @@ -805,6 +818,11 @@ static void handler_status(struct wiimote_data *wdata, const __u8 *payload)

/* on status reports the drm is reset so we need to resend the drm */
wiiproto_req_drm(wdata, WIIPROTO_REQ_NULL);

if (wiimote_cmd_pending(wdata, WIIPROTO_REQ_SREQ, 0)) {
wdata->state.cmd_battery = payload[5];
wiimote_cmd_complete(wdata);
}
}

static void handler_data(struct wiimote_data *wdata, const __u8 *payload)
Expand Down

0 comments on commit d9c1197

Please sign in to comment.