From 99d62c4def5f62af66cf66b3e620de21f017db29 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 22 Sep 2016 22:03:46 +0200 Subject: [PATCH] stmhal/usb: Use real packet size (not maximum) in HID receive. --- stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c index 913b2ecc10..d136570234 100644 --- a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c +++ b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c @@ -1069,7 +1069,10 @@ uint8_t USBD_HID_ReceivePacket(USBD_HandleTypeDef *pdev) { } // Prepare Out endpoint to receive next packet - USBD_LL_PrepareReceive(pdev, hid_out_ep, HID_ClassData.RxBuffer, HID_DATA_FS_MAX_PACKET_SIZE); + uint16_t mps_out = + hid_desc[HID_DESC_OFFSET_MAX_PACKET_OUT_LO] + | (hid_desc[HID_DESC_OFFSET_MAX_PACKET_OUT_HI] << 8); + USBD_LL_PrepareReceive(pdev, hid_out_ep, HID_ClassData.RxBuffer, mps_out); return USBD_OK; }