diff options
| author | tmk <hasu@tmk-kbd.com> | 2015-07-15 16:02:20 +0900 |
|---|---|---|
| committer | tmk <hasu@tmk-kbd.com> | 2015-07-15 16:02:20 +0900 |
| commit | 1efdd867c8f88ad779ad82e1b22df62bf6be8fe9 (patch) | |
| tree | 6ad07603ccc864eccba4eec5848ea49a114b1e5f /tmk_core/protocol/usb_hid | |
| parent | 6f5e8ce17e89005130cd0f9ecc6e346a77bb624b (diff) | |
| download | qmk_firmware-1efdd867c8f88ad779ad82e1b22df62bf6be8fe9.tar.gz qmk_firmware-1efdd867c8f88ad779ad82e1b22df62bf6be8fe9.zip | |
usb_usb: Ignore error usage(0x01-03) report
Diffstat (limited to 'tmk_core/protocol/usb_hid')
| -rw-r--r-- | tmk_core/protocol/usb_hid/parser.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp index 28151f9d5..1a152ff3f 100644 --- a/tmk_core/protocol/usb_hid/parser.cpp +++ b/tmk_core/protocol/usb_hid/parser.cpp | |||
| @@ -10,15 +10,24 @@ uint16_t usb_hid_time_stamp; | |||
| 10 | 10 | ||
| 11 | void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) | 11 | void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) |
| 12 | { | 12 | { |
| 13 | ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); | 13 | bool is_error = false; |
| 14 | usb_hid_time_stamp = millis(); | 14 | report_keyboard_t *report = (report_keyboard_t *)buf; |
| 15 | |||
| 16 | dprintf("KBDReport: %02X %02X", report->mods, report->reserved); | ||
| 17 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | ||
| 18 | if (IS_ERROR(report->keys[i])) { | ||
| 19 | is_error = true; | ||
| 20 | } | ||
| 21 | dprintf(" %02X", report->keys[i]); | ||
| 22 | } | ||
| 23 | dprint("\r\n"); | ||
| 15 | 24 | ||
| 16 | debug("KBDReport: "); | 25 | // ignore error and not send report to computer |
| 17 | debug_hex(usb_hid_keyboard_report.mods); | 26 | if (is_error) { |
| 18 | debug(" --"); | 27 | dprint("Error usage! \r\n"); |
| 19 | for (uint8_t i = 0; i < 6; i++) { | 28 | return; |
| 20 | debug(" "); | ||
| 21 | debug_hex(usb_hid_keyboard_report.keys[i]); | ||
| 22 | } | 29 | } |
| 23 | debug("\r\n"); | 30 | |
| 31 | ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); | ||
| 32 | usb_hid_time_stamp = millis(); | ||
| 24 | } | 33 | } |
