]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/protocol/usb_hid/parser.cpp
5e9a3efb90c3b06497710bac813888f5482a6278
[max/tmk_keyboard.git] / tmk_core / protocol / usb_hid / parser.cpp
1 #include "parser.h"
2 #include "usb_hid.h"
3
4 #include "debug.h"
5
6
7 void KBDReportParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
8 {
9     dprintf("input %d:", hid->GetAddress());
10     for (uint8_t i = 0; i < len; i++) {
11         dprintf(" %02X", buf[i]);
12     }
13     dprint("\r\n");
14
15     // Rollover error
16     // Cherry: 0101010101010101
17     // https://geekhack.org/index.php?topic=69169.msg2638223#msg2638223
18     // Apple:  0000010101010101
19     // https://geekhack.org/index.php?topic=69169.msg2760969#msg2760969
20     if (buf[2] == 0x01) {
21        dprint("Rollover error: ignored\r\n");
22        return;
23     }
24
25     ::memcpy(&report, buf, sizeof(report_keyboard_t));
26     time_stamp = millis();
27 }