@@ -58,6 +58,9 @@ esp_err_t arduino_usb_event_handler_register_with(esp_event_base_t event_base, i
58
58
// max size is 64 and we need one byte for the report ID
59
59
static const uint8_t HID_VENDOR_REPORT_SIZE = 63 ;
60
60
61
+ static uint8_t feature[HID_VENDOR_REPORT_SIZE];
62
+ static xQueueHandle rx_queue = NULL ;
63
+
61
64
static const uint8_t report_descriptor[] = {
62
65
TUD_HID_REPORT_DESC_GENERIC_INOUT_FEATURE (HID_VENDOR_REPORT_SIZE, HID_REPORT_ID (HID_REPORT_ID_VENDOR))
63
66
};
@@ -68,9 +71,6 @@ USBHIDVendor::USBHIDVendor(): hid(){
68
71
initialized = true ;
69
72
hid.addDevice (this , sizeof (report_descriptor));
70
73
memset (feature, 0 , HID_VENDOR_REPORT_SIZE);
71
- } else {
72
- isr_log_e (" Only one instance of USBHIDVendor is allowed!" );
73
- abort ();
74
74
}
75
75
}
76
76
@@ -112,7 +112,9 @@ void USBHIDVendor::onEvent(arduino_usb_hid_vendor_event_t event, esp_event_handl
112
112
}
113
113
114
114
uint16_t USBHIDVendor::_onGetFeature (uint8_t report_id, uint8_t * buffer, uint16_t len){
115
- log_v (" len: %u" , len);
115
+ if (report_id != HID_REPORT_ID_VENDOR){
116
+ return 0 ;
117
+ }
116
118
memcpy (buffer, feature, len);
117
119
arduino_usb_hid_vendor_event_data_t p = {0 };
118
120
p.buffer = feature;
@@ -122,7 +124,9 @@ uint16_t USBHIDVendor::_onGetFeature(uint8_t report_id, uint8_t* buffer, uint16_
122
124
}
123
125
124
126
void USBHIDVendor::_onSetFeature (uint8_t report_id, const uint8_t * buffer, uint16_t len){
125
- log_v (" len: %u" , len);
127
+ if (report_id != HID_REPORT_ID_VENDOR){
128
+ return ;
129
+ }
126
130
memcpy (feature, buffer, len);
127
131
arduino_usb_hid_vendor_event_data_t p = {0 };
128
132
p.buffer = feature;
@@ -131,7 +135,9 @@ void USBHIDVendor::_onSetFeature(uint8_t report_id, const uint8_t* buffer, uint1
131
135
}
132
136
133
137
void USBHIDVendor::_onOutput (uint8_t report_id, const uint8_t * buffer, uint16_t len){
134
- log_v (" len: %u" , len);
138
+ if (report_id != HID_REPORT_ID_VENDOR){
139
+ return ;
140
+ }
135
141
for (uint32_t i=0 ; i<len; i++){
136
142
if (rx_queue == NULL || !xQueueSend (rx_queue, buffer+i, 0 )){
137
143
len = i+1 ;
0 commit comments