1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-22 13:19:48 +01:00

[PHID] send data if report ID was sent successful

If the first sending was not successful it is better to abort. Then we get a return value of -1 (instead of -2 if the 2nd call will also fail) and we do not need to block even longer, with another timeout.
This commit is contained in:
Nico 2015-10-27 08:06:21 +01:00 committed by Cristian Maglie
parent cf4d7e1ffb
commit 741d5dff9e

View File

@ -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)