From 912decede52032c5e999893a2c9102c1cb9568ff Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 8 Aug 2019 13:54:54 +0200 Subject: [PATCH] We need to make room for the control endpoint in the HIDInterface struct as well This is needed as the in and out endpoint are defined as follows: static const uint8_t epInterruptInIndex = 1; // InterruptIN endpoint index static const uint8_t epInterruptOutIndex = 2; // InterruptOUT endpoint index And maxEpPerInterface is set to 2. See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569260660 --- hiduniversal.h | 2 +- usbhid.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hiduniversal.h b/hiduniversal.h index 3aa4690a..757f6243 100644 --- a/hiduniversal.h +++ b/hiduniversal.h @@ -40,7 +40,7 @@ class HIDUniversal : public USBHID { uint8_t bmAltSet : 3; uint8_t bmProtocol : 2; }; - uint8_t epIndex[maxEpPerInterface]; + uint8_t epIndex[maxEpPerInterface + 1]; // We need to make room for the control endpoint as well }; uint8_t bConfNum; // configuration number diff --git a/usbhid.h b/usbhid.h index 791bed35..cf74f57d 100644 --- a/usbhid.h +++ b/usbhid.h @@ -151,7 +151,7 @@ protected: static const uint8_t maxHidInterfaces = 3; static const uint8_t maxEpPerInterface = 2; - static const uint8_t totalEndpoints = (maxHidInterfaces * maxEpPerInterface + 1); + static const uint8_t totalEndpoints = (maxHidInterfaces * maxEpPerInterface + 1); // We need to make room for the control endpoint void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr); void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);