32 uint16_t HIDUniversal::GetHidClassDescrLen(uint8_t type, uint8_t num) {
34 if(descrInfo[i].bDescrType == type) {
43 void HIDUniversal::Initialize() {
45 rptParsers[i].rptId = 0;
46 rptParsers[i].rptParser = NULL;
71 ZeroMemory(constBuffLen, prevBuf);
76 if(rptParsers[i].rptId == 0 && rptParsers[i].rptParser == NULL) {
77 rptParsers[i].rptId = id;
78 rptParsers[i].rptParser = prs;
87 return ((rptParsers[0].rptParser) ? rptParsers[0].rptParser : NULL);
90 if(rptParsers[i].rptId ==
id)
91 return rptParsers[i].rptParser;
99 uint8_t buf[constBufSize];
139 len = (buf[0] > constBufSize) ? constBufSize : buf[0];
145 goto FailGetDevDescr;
188 goto FailGetDevDescr;
199 goto FailSetDevTblEntry;
203 for(uint8_t i = 0; i < num_of_conf; i++) {
212 goto FailGetConfDescr;
230 goto FailSetConfDescr;
232 for(uint8_t i = 0; i < bNumIface; i++) {
250 #ifdef DEBUG_USB_HOST 256 #ifdef DEBUG_USB_HOST 262 #ifdef DEBUG_USB_HOST 268 #ifdef DEBUG_USB_HOST 275 #ifdef DEBUG_USB_HOST 279 #ifdef DEBUG_USB_HOST 287 HIDUniversal::HIDInterface* HIDUniversal::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
297 if(bNumEP > 1 && conf != bConfNum)
307 HIDInterface *piface = FindInterface(iface, alt, proto);
313 Notify(
PSTR(
"\r\n HIDUniversal::EndpointXtract(): Not adding HID interface because we already have "), 0x80);
315 Notify(
PSTR(
" interfaces and can't hold more. "), 0x80);
319 piface->bmInterface = iface;
320 piface->bmAltSet = alt;
321 piface->bmProtocol = proto;
331 Notify(
PSTR(
"\r\n HIDUniversal::EndpointXtract(): Not adding endpoint info because we already have "), 0x80);
333 Notify(
PSTR(
" endpoints and can't hold more. "), 0x80);
344 piface->epIndex[index] = bNumEP;
346 if(pollInterval < pep->bInterval)
364 bool HIDUniversal::BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2) {
365 for(uint8_t i = 0; i < len; i++)
366 if(buf1[i] != buf2[i])
371 void HIDUniversal::ZeroMemory(uint8_t len, uint8_t *buf) {
372 for(uint8_t i = 0; i < len; i++)
376 void HIDUniversal::SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest) {
377 for(uint8_t i = 0; i < len; i++)
387 if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0
L) {
388 qNextPollTime = (uint32_t)millis() + pollInterval;
390 uint8_t buf[constBuffLen];
392 for(uint8_t i = 0; i < bNumIface; i++) {
394 uint16_t read = (uint16_t)
epInfo[index].maxPktSize;
396 ZeroMemory(constBuffLen, buf);
402 USBTRACE3(
"(hiduniversal.h) Poll:", rcode, 0x81);
406 if(read > constBuffLen)
409 bool identical = BuffersIdentical(read, buf, prevBuf);
411 SaveBuffer(read, buf, prevBuf);
418 for(uint8_t i = 0; i < read; i++) {
419 D_PrintHex<uint8_t > (buf[i], 0x80);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
@@ -91,13 +91,13 @@ $(function() {
#define NotifyFailGetDevDescr(...)
HIDInterface hidInterfaces[maxHidInterfaces]
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
-
+
#define CP_MASK_COMPARE_CLASS
virtual uint8_t OnInitSuccessful()
virtual void FreeAddress(uint8_t addr)=0
-
+
uint16_t wDescriptorLength
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
@@ -134,7 +134,7 @@ $(function() {
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
static const uint8_t totalEndpoints
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
uint8_t bNumConfigurations
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
diff --git a/hiduniversal_8h_source.html b/hiduniversal_8h_source.html
index a577d381..40b51a45 100644
--- a/hiduniversal_8h_source.html
+++ b/hiduniversal_8h_source.html
@@ -74,10 +74,10 @@ $(function() {
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
HIDInterface hidInterfaces[maxHidInterfaces]
-
+
virtual uint8_t OnInitSuccessful()
-
+
HIDReportParser * GetReportParser(uint8_t id)
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
@@ -87,7 +87,7 @@ $(function() {
static const uint8_t maxHidInterfaces
static const uint8_t totalEndpoints
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
virtual uint8_t GetAddress()
diff --git a/usbhid_8h_source.html b/usbhid_8h_source.html
index 9b681a7d..8db0f384 100644
--- a/usbhid_8h_source.html
+++ b/usbhid_8h_source.html
@@ -63,7 +63,7 @@ $(function() {
usbhid.h