diff options
Diffstat (limited to 'protocol/usb_hid')
6 files changed, 18 insertions, 19 deletions
diff --git a/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Arduino_Makefile_master b/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Arduino_Makefile_master deleted file mode 160000 -Subproject 94c560c854c7a1dfc35e9de9db05de1b202de6c diff --git a/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/RTClib b/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/RTClib deleted file mode 160000 -Subproject c30fcdf1f112de581de7b145a97630539e5cff4 diff --git a/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/generic_storage b/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/generic_storage deleted file mode 160000 -Subproject 77762338286535dabb9c94b87060e33e487ff0f diff --git a/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/xmem2 b/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/xmem2 deleted file mode 160000 -Subproject 77b033420485f7d3d35430c0e8d4d844aa89483 diff --git a/protocol/usb_hid/leonardo_led.h b/protocol/usb_hid/leonardo_led.h deleted file mode 100644 index 6f67a88f5b..0000000000 --- a/protocol/usb_hid/leonardo_led.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LEONARDO_LED_H -#define LEONARDO_LED_H - -// Leonardo "TX" LED for debug -#define LED_TX_INIT (DDRD |= (1<<5)) -#define LED_TX_ON (PORTD &= ~(1<<5)) -#define LED_TX_OFF (PORTD |= (1<<5)) -#define LED_TX_TOGGLE (PORTD ^= (1<<5)) - -#endif diff --git a/protocol/usb_hid/parser.cpp b/protocol/usb_hid/parser.cpp index 28151f9d59..1a152ff3f2 100644 --- a/protocol/usb_hid/parser.cpp +++ b/protocol/usb_hid/parser.cpp @@ -10,15 +10,24 @@ uint16_t usb_hid_time_stamp; void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) { - ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); - usb_hid_time_stamp = millis(); + bool is_error = false; + report_keyboard_t *report = (report_keyboard_t *)buf; + + dprintf("KBDReport: %02X %02X", report->mods, report->reserved); + for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { + if (IS_ERROR(report->keys[i])) { + is_error = true; + } + dprintf(" %02X", report->keys[i]); + } + dprint("\r\n"); - debug("KBDReport: "); - debug_hex(usb_hid_keyboard_report.mods); - debug(" --"); - for (uint8_t i = 0; i < 6; i++) { - debug(" "); - debug_hex(usb_hid_keyboard_report.keys[i]); + // ignore error and not send report to computer + if (is_error) { + dprint("Error usage! \r\n"); + return; } - debug("\r\n"); + + ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); + usb_hid_time_stamp = millis(); } |