Skip to content

Commit ab25376

Browse files
committed
chore(usb): update after middleware update
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent c156262 commit ab25376

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎libraries/USBDevice/src/cdc/usbd_cdc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ USBD_ClassTypeDef USBD_CDC = {
159159
USBD_CDC_GetOtherSpeedCfgDesc,
160160
USBD_CDC_GetDeviceQualifierDescriptor,
161161
#endif /* USE_USBD_COMPOSITE */
162+
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
163+
NULL,
164+
#endif /* USBD_SUPPORT_USER_STRING_DESC */
162165
};
163166

164167
#ifndef USE_USBD_COMPOSITE

‎libraries/USBDevice/src/hid/usbd_hid_composite.c‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
10331036
static 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

Comments
 (0)