Skip to content

Commit 0b69598

Browse files
committed
[PUSB] Fixed return value for HID_::SendReport
1 parent 7d012c1 commit 0b69598

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libraries/HID/HID.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ void HID_::AppendDescriptor(HIDSubDescriptor *node)
8888

8989
int HID_::SendReport(uint8_t id, const void* data, int len)
9090
{
91-
auto ret = USB_Send(pluggedEndpoint, &id, 1);
92-
if(ret >= 0){
93-
ret += USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
94-
}
95-
return ret;
91+
auto ret = USB_Send(pluggedEndpoint, &id, 1);
92+
if (ret < 0) return ret;
93+
auto ret2 = USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
94+
if (ret2 < 0) return ret2;
95+
return ret + ret2;
9696
}
9797

9898
bool HID_::setup(USBSetup& setup)

0 commit comments

Comments
 (0)