Skip to content

Commit e9d7e85

Browse files
authored
Update USBCore.cpp
1 parent e4befd8 commit e9d7e85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/arduino/USBCore.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ bool SendDescriptor(USBSetup& setup)
468468

469469
if (t == 0x21) {
470470
InitControl(setup.wLength);
471-
USB_SendControl(TRANSFER_PGM, hidClassDescriptor, hidClassDescriptorSize, setup.wLength));
471+
int toSend = setup.wLength < sizeof(hidClassDescriptor) ? setup.wLength : sizeof(hidClassDescriptor);
472+
USB_SendControl(TRANSFER_PGM, hidClassDescriptor, toSend);
472473
return true;
473474
}
474475

0 commit comments

Comments
 (0)