-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHID.patch
More file actions
52 lines (48 loc) · 1.54 KB
/
HID.patch
File metadata and controls
52 lines (48 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/hardware/arduino/avr/libraries/HID/src/HID.cpp b/hardware/arduino/avr/libraries/HID/src/HID.cpp
index 21ede26..5ecffc1
--- a/hardware/arduino/avr/libraries/HID/src/HID.cpp
+++ b/hardware/arduino/avr/libraries/HID/src/HID.cpp
@@ -133,6 +133,15 @@ bool HID_::setup(USBSetup& setup)
}
if (request == HID_SET_REPORT)
{
+ if (setup.wLength == 2)
+ {
+ uint8_t data[2];
+ if (2 == USB_RecvControl(data, 2))
+ {
+ _keyboardLedsStatus = data[1];
+ return true;
+ }
+ }
//uint8_t reportID = setup.wValueL;
//uint16_t length = setup.wLength;
//uint8_t data[length];
@@ -146,6 +155,11 @@ bool HID_::setup(USBSetup& setup)
return false;
}
+uint8_t HID_::getKeyboardLedsStatus(void)
+{
+ return _keyboardLedsStatus;
+}
+
HID_::HID_(void) : PluggableUSBModule(1, 1, epType),
rootNode(NULL), descriptorSize(0),
protocol(HID_REPORT_PROTOCOL), idle(1)
diff --git a/hardware/arduino/avr/libraries/HID/src/HID.h b/hardware/arduino/avr/libraries/HID/src/HID.h
index 93c4bd5..e48e718
--- a/hardware/arduino/avr/libraries/HID/src/HID.h
+++ b/hardware/arduino/avr/libraries/HID/src/HID.h
@@ -95,6 +95,7 @@ public:
int begin(void);
int SendReport(uint8_t id, const void* data, int len);
void AppendDescriptor(HIDSubDescriptor* node);
+ uint8_t getKeyboardLedsStatus(void);
protected:
// Implementation of the PluggableUSBModule
@@ -111,6 +112,7 @@ private:
uint8_t protocol;
uint8_t idle;
+ uint8_t _keyboardLedsStatus;
};
// Replacement for global singleton.