Make sure the composite device is attached before setting the kStatus_USB_Success flag

This commit is contained in:
Kristian Sloth Lauszus
2018-06-30 16:48:25 +02:00
parent 9938f14d20
commit 11a8ffbaf5
5 changed files with 16 additions and 4 deletions

View File

@@ -48,7 +48,9 @@ usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, voi
switch (event) { switch (event) {
// This report is received when the report has been sent // This report is received when the report has been sent
case kUSB_DeviceHidEventSendResponse: case kUSB_DeviceHidEventSendResponse:
error = kStatus_USB_Success; if (UsbCompositeDevice.attach) {
error = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceHidEventRecvResponse: case kUSB_DeviceHidEventRecvResponse:
case kUSB_DeviceHidEventGetReport: case kUSB_DeviceHidEventGetReport:

View File

@@ -18,7 +18,11 @@ usb_status_t UsbGenericHidCallback(class_handle_t handle, uint32_t event, void *
usb_status_t error = kStatus_USB_Error; usb_status_t error = kStatus_USB_Error;
switch (event) { switch (event) {
// This report is received when the report has been sent
case kUSB_DeviceHidEventSendResponse: case kUSB_DeviceHidEventSendResponse:
if (UsbCompositeDevice.attach) {
error = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceHidEventRecvResponse: case kUSB_DeviceHidEventRecvResponse:
UsbProtocolHandler(); UsbProtocolHandler();

View File

@@ -42,7 +42,9 @@ usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, voi
switch (event) { switch (event) {
// This report is received when the report has been sent // This report is received when the report has been sent
case kUSB_DeviceHidEventSendResponse: case kUSB_DeviceHidEventSendResponse:
error = kStatus_USB_Success; if (UsbCompositeDevice.attach) {
error = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceHidEventRecvResponse: case kUSB_DeviceHidEventRecvResponse:
case kUSB_DeviceHidEventGetReport: case kUSB_DeviceHidEventGetReport:

View File

@@ -42,7 +42,9 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
switch (event) { switch (event) {
// This report is received when the report has been sent // This report is received when the report has been sent
case kUSB_DeviceHidEventSendResponse: case kUSB_DeviceHidEventSendResponse:
error = kStatus_USB_Success; if (UsbCompositeDevice.attach) {
error = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceHidEventRecvResponse: case kUSB_DeviceHidEventRecvResponse:
case kUSB_DeviceHidEventGetReport: case kUSB_DeviceHidEventGetReport:

View File

@@ -42,7 +42,9 @@ usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, vo
switch (event) { switch (event) {
// This report is received when the report has been sent // This report is received when the report has been sent
case kUSB_DeviceHidEventSendResponse: case kUSB_DeviceHidEventSendResponse:
error = kStatus_USB_Success; if (UsbCompositeDevice.attach) {
error = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceHidEventRecvResponse: case kUSB_DeviceHidEventRecvResponse:
case kUSB_DeviceHidEventGetReport: case kUSB_DeviceHidEventGetReport: