aboutsummaryrefslogtreecommitdiff
path: root/libraries/HID/HID.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/HID/HID.cpp')
-rw-r--r--libraries/HID/HID.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp
index 3a42699..8adf1a9 100644
--- a/libraries/HID/HID.cpp
+++ b/libraries/HID/HID.cpp
@@ -88,10 +88,11 @@ void HID_::AppendDescriptor(HIDSubDescriptor *node)
int HID_::SendReport(uint8_t id, const void* data, int len)
{
- int ret = 0;
- ret += USB_Send(pluggedEndpoint, &id, 1);
- ret += USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
- return ret;
+ auto ret = USB_Send(pluggedEndpoint, &id, 1);
+ if(ret >= 0){
+ ret += USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
+ }
+ return ret;
}
bool HID_::setup(USBSetup& setup)