Make sure the device is attached before sending the report

This commit is contained in:
Kristian Sloth Lauszus
2018-06-30 16:52:39 +02:00
parent 11a8ffbaf5
commit b9b5eb2c76
5 changed files with 15 additions and 0 deletions

View File

@@ -7,6 +7,9 @@ uint8_t GenericHidOutBuffer[USB_GENERIC_HID_OUT_BUFFER_LENGTH];
static usb_status_t UsbReceiveData(void)
{
if (!UsbCompositeDevice.attach)
return kStatus_USB_Error; // The device is not attached
return USB_DeviceHidRecv(UsbCompositeDevice.genericHidHandle,
USB_GENERIC_HID_ENDPOINT_OUT_INDEX,
GenericHidInBuffer,