HID: wiimote: fix nunchuck button parser
Subsystems (2)
PATCH 1/1 HID: wiimote: fix nunchuck button parser
The buttons of the Wii Remote Nunchuck extension are actually active low. Fix the parser to forward the inverted values. The comment in the function always said "0 == pressed" but the implementation was wrong from the beginning.
Reported-by Victor Quicksilver <[email protected]>
Signed-off-by David Herrmann <[email protected]>
--- drivers/hid/hid-wiimote-ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-wiimote-ext.c +4 -4
@@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload)if (ext->motionp) {input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_Z ], !!(payload[5 ] &0x04 )); + wiiext_keymap[WIIEXT_KEY_Z ], !(payload[5 ] &0x04 ));input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_C ], !!(payload[5 ] &0x08 )); + wiiext_keymap[WIIEXT_KEY_C ], !(payload[5 ] &0x08 )); }else {input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_Z ], !!(payload[5 ] &0x01 )); + wiiext_keymap[WIIEXT_KEY_Z ], !(payload[5 ] &0x01 ));input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_C ], !!(payload[5 ] &0x02 )); + wiiext_keymap[WIIEXT_KEY_C ], !(payload[5 ] &0x02 )); }input_sync (ext->input);
Signature · 1 line
1.8.1.3
Jiri Kosina
AppliedQuoted 25 lines · David Herrmann
The buttons of the Wii Remote Nunchuck extension are actually active low. Fix the parser to forward the inverted values. The comment in the function always said "0 == pressed" but the implementation was wrong from the beginning.
Reported-by Victor Quicksilver <[email protected]>Signed-off-by David Herrmann <[email protected]>--- drivers/hid/hid-wiimote-ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/hid/hid-wiimote-ext.c +2
-2@@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload)if (ext->motionp) {input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_Z ], !!(payload[5 ] &0x04 )); + wiiext_keymap[WIIEXT_KEY_Z ], !(payload[5 ] &0x04 ));input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_C ], !!(payload[5 ] &0x08 )); + wiiext_keymap[WIIEXT_KEY_C ], !(payload[5 ] &0x08 ));
drivers/hid/hid-wiimote-ext.c static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload) · line 416
Quoted 10 lines
drivers/hid/hid-wiimote-ext.c +2
-2}else {input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_Z ], !!(payload[5 ] &0x01 )); + wiiext_keymap[WIIEXT_KEY_Z ], !(payload[5 ] &0x01 ));input_report_key (ext->input, - wiiext_keymap[WIIEXT_KEY_C ], !!(payload[5 ] &0x02 )); + wiiext_keymap[WIIEXT_KEY_C ], !(payload[5 ] &0x02 )); }input_sync (ext->input);
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs