aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@arduino.cc>2015-10-30 13:00:33 +0100
committerCristian Maglie <c.maglie@arduino.cc>2015-10-30 13:00:33 +0100
commit0b69598cfb71066a29794d675c7828d87d21c8ae (patch)
tree49f8d91dd5c49bd3b460f32d0823e2dd75f90bb8
parent7d012c11b8318be19b13acd483fdea81ee3ce540 (diff)
[PUSB] Fixed return value for HID_::SendReport
-rw-r--r--libraries/HID/HID.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp
index 8adf1a9..21ede26 100644
--- a/libraries/HID/HID.cpp
+++ b/libraries/HID/HID.cpp
@@ -88,11 +88,11 @@ void HID_::AppendDescriptor(HIDSubDescriptor *node)
int HID_::SendReport(uint8_t id, const void* data, int len)
{
- auto ret = USB_Send(pluggedEndpoint, &id, 1);
- if(ret >= 0){
- ret += USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
- }
- return ret;
+ auto ret = USB_Send(pluggedEndpoint, &id, 1);
+ if (ret < 0) return ret;
+ auto ret2 = USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
+ if (ret2 < 0) return ret2;
+ return ret + ret2;
}
bool HID_::setup(USBSetup& setup)