Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305060
b: refs/heads/master
c: 74b89e8
h: refs/heads/master
v: v3
  • Loading branch information
David Herrmann authored and Jiri Kosina committed May 9, 2012
1 parent 1e8fd65 commit e9c83ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 692d30d63b80b174d0ed24bbffb7a1ea536d5fee
refs/heads/master: 74b89e8a3625c17c7452532dfb997ac4f1a38751
16 changes: 5 additions & 11 deletions trunk/drivers/hid/hid-wiimote-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,

/*
* Basic IR data is encoded into 3 bytes. The first two bytes are the
* upper 8 bit of the X/Y data, the 3rd byte contains the lower 2 bits
* lower 8 bit of the X/Y data, the 3rd byte contains the upper 2 bits
* of both.
* If data is packed, then the 3rd byte is put first and slightly
* reordered. This allows to interleave packed and non-packed data to
Expand All @@ -778,17 +778,11 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,
*/

if (packed) {
x = ir[1] << 2;
y = ir[2] << 2;

x |= ir[0] & 0x3;
y |= (ir[0] >> 2) & 0x3;
x = ir[1] | ((ir[0] & 0x03) << 8);
y = ir[2] | ((ir[0] & 0x0c) << 6);
} else {
x = ir[0] << 2;
y = ir[1] << 2;

x |= (ir[2] >> 4) & 0x3;
y |= (ir[2] >> 6) & 0x3;
x = ir[0] | ((ir[2] & 0x30) << 4);
y = ir[1] | ((ir[2] & 0xc0) << 2);
}

input_report_abs(wdata->ir, xid, x);
Expand Down

0 comments on commit e9c83ea

Please sign in to comment.