@@ -130,6 +130,9 @@ USBD_ClassTypeDef USBD_COMPOSITE_HID = {
130130 USBD_HID_GetOtherSpeedCfgDesc ,
131131 USBD_HID_GetDeviceQualifierDesc ,
132132#endif /* USE_USBD_COMPOSITE */
133+ #if (USBD_SUPPORT_USER_STRING_DESC == 1U )
134+ NULL ,
135+ #endif /* USBD_SUPPORT_USER_STRING_DESC */
133136};
134137
135138#ifndef USE_USBD_COMPOSITE
@@ -1033,15 +1036,19 @@ static uint8_t *USBD_HID_GetOtherSpeedCfgDesc(uint16_t *length)
10331036static uint8_t USBD_HID_DataIn (USBD_HandleTypeDef * pdev ,
10341037 uint8_t epnum )
10351038{
1036-
1039+ uint8_t status = ( uint8_t ) USBD_OK ;
10371040 /* Ensure that the FIFO is empty before a new transfer, this condition could
10381041 be caused by a new transfer before the end of the previous transfer */
1039- if (epnum == (HID_KEYBOARD_EPIN_ADDR & 0x7F )) {
1040- ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> Keyboardstate = HID_IDLE ;
1041- } else if (epnum == (HID_MOUSE_EPIN_ADDR & 0x7F )) {
1042- ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> Mousestate = HID_IDLE ;
1042+ if (pdev -> pClassDataCmsit [pdev -> classId ] == NULL ) {
1043+ status = (uint8_t )USBD_FAIL ;
1044+ } else {
1045+ if (epnum == (HID_KEYBOARD_EPIN_ADDR & 0x7F )) {
1046+ ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> Keyboardstate = HID_IDLE ;
1047+ } else if (epnum == (HID_MOUSE_EPIN_ADDR & 0x7F )) {
1048+ ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> Mousestate = HID_IDLE ;
1049+ }
10431050 }
1044- return ( uint8_t ) USBD_OK ;
1051+ return status ;
10451052}
10461053
10471054#ifndef USE_USBD_COMPOSITE
0 commit comments