From 102bf3f76516ed74b373e00babbe7a6055a12828 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 8 Aug 2019 10:25:43 +0200 Subject: [PATCH 1/5] Fixed maybe-uninitialized warning See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/567958670 --- parsetools.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parsetools.h b/parsetools.h index 62892061..f7525369 100644 --- a/parsetools.h +++ b/parsetools.h @@ -30,6 +30,11 @@ e-mail : support@circuitsathome.com struct MultiValueBuffer { uint8_t valueSize; void *pValue; + +public: + + MultiValueBuffer() : valueSize(0), pValue(NULL) { + }; } __attribute__((packed)); class MultiByteValueParser { From 224276cb23c2a941694ae350f07249e22e80b532 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 8 Aug 2019 10:46:41 +0200 Subject: [PATCH 2/5] Disable misleading-indentation warning for now See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3dc25114..9793c378 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,7 +74,8 @@ env: install: - pip install -U platformio - - export PLATFORMIO_BUILD_FLAGS="$PLATFORMIO_BUILD_FLAGS -DDEBUG_USB_HOST -Wall -Werror" + # See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69 + - export PLATFORMIO_BUILD_FLAGS="$PLATFORMIO_BUILD_FLAGS -DDEBUG_USB_HOST -Wall -Werror -Wno-misleading-indentation" # # Libraries from PlatformIO Library Registry: From d182729ed81c13d247b57dc152a570f738f6cf47 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 8 Aug 2019 11:30:09 +0200 Subject: [PATCH 3/5] Run the Due build separatly --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9793c378..cc13e6c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,8 +74,7 @@ env: install: - pip install -U platformio - # See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69 - - export PLATFORMIO_BUILD_FLAGS="$PLATFORMIO_BUILD_FLAGS -DDEBUG_USB_HOST -Wall -Werror -Wno-misleading-indentation" + - export PLATFORMIO_BUILD_FLAGS="$PLATFORMIO_BUILD_FLAGS -DDEBUG_USB_HOST -Wall -Werror" # # Libraries from PlatformIO Library Registry: @@ -87,7 +86,8 @@ install: script: - if [[ -z "$SKIP_UNO" ]]; then UNO="--board=uno"; fi - - platformio ci --lib="." $UNO --board=due --board=genuino101 --board=teensy30 --board=teensy31 --board=teensy35 --board=teensy36 --board=teensylc --board=esp12e --board=nodemcu --board=esp32dev + - platformio ci --lib="." $UNO --board=genuino101 --board=teensy30 --board=teensy31 --board=teensy35 --board=teensy36 --board=teensylc --board=esp12e --board=nodemcu --board=esp32dev + - platformio ci --lib="." --board=due --project-option="build_flags=-Wno-misleading-indentation" # Workaround https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/569237654 and https://github.com/arduino/ArduinoCore-sam/issues/69 before_deploy: # Fix errors in the Doxygen Markdown parser and generate the docs From 912decede52032c5e999893a2c9102c1cb9568ff Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 8 Aug 2019 13:54:54 +0200 Subject: [PATCH 4/5] 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); From b62528d8133c132cb30bb7da0c38f9b85f72c53d Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sat, 31 Aug 2019 13:13:18 +0200 Subject: [PATCH 5/5] Just get the endpoint address directly from the epInfo struct --- PS4USB.h | 2 +- examples/HID/SRWS1/SRWS1.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/PS4USB.h b/PS4USB.h index 178ebece..9d9dbb40 100644 --- a/PS4USB.h +++ b/PS4USB.h @@ -109,7 +109,7 @@ protected: // The PS4 console actually set the four last bytes to a CRC32 checksum, but it seems like it is actually not needed - pUsb->outTransfer(bAddress, epInfo[ hidInterfaces[0].epIndex[epInterruptOutIndex] ].epAddr, sizeof(buf), buf); + pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, sizeof(buf), buf); }; /**@}*/ diff --git a/examples/HID/SRWS1/SRWS1.cpp b/examples/HID/SRWS1/SRWS1.cpp index 77396f84..43f9aa42 100644 --- a/examples/HID/SRWS1/SRWS1.cpp +++ b/examples/HID/SRWS1/SRWS1.cpp @@ -44,6 +44,5 @@ void SRWS1::setLeds(uint16_t leds) { buf[0] = 0x40; // Report ID buf[1] = leds & 0xFF; buf[2] = (leds >> 8) & 0x7F; - pUsb->outTransfer(bAddress, epInfo[ hidInterfaces[0].epIndex[epInterruptOutIndex] ].epAddr, sizeof(buf), buf); + pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, sizeof(buf), buf); } -