Fix for mechanical keyboards sending > 8 byte packets

USG_1.0
Robert Fisk 7 years ago
parent 3e68c42e45
commit c34e0eec59

@ -65,6 +65,7 @@
#define HID_MIN_POLL 10 #define HID_MIN_POLL 10
#define HID_MAX_REPORT_SIZE 8 #define HID_MAX_REPORT_SIZE 8
#define HID_REPORT_BUFFER_SIZE 64
#define HID_MAX_USAGE 10 #define HID_MAX_USAGE 10
#define HID_MAX_NBR_REPORT_FMT 10 #define HID_MAX_NBR_REPORT_FMT 10
//#define HID_QUEUE_SIZE 10 //#define HID_QUEUE_SIZE 10
@ -234,7 +235,7 @@ typedef struct _HID_Process
uint8_t Protocol; uint8_t Protocol;
HID_DescTypeDef HID_Desc; HID_DescTypeDef HID_Desc;
TransactionCompleteCallbackTypeDef ReportCallback; TransactionCompleteCallbackTypeDef ReportCallback;
uint8_t Data[HID_MAX_REPORT_SIZE]; uint8_t Data[HID_REPORT_BUFFER_SIZE];
} }
HID_HandleTypeDef; HID_HandleTypeDef;

@ -173,15 +173,8 @@ static USBH_StatusTypeDef USBH_HID_InterfaceInit (USBH_HandleTypeDef *phost)
HID_Handle->poll = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bInterval; HID_Handle->poll = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bInterval;
HID_Handle->Protocol = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol; HID_Handle->Protocol = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol;
if (HID_Handle->poll < HID_MIN_POLL) if (HID_Handle->poll < HID_MIN_POLL) HID_Handle->poll = HID_MIN_POLL;
{ if (HID_Handle->length > HID_REPORT_BUFFER_SIZE) return USBH_FAIL; //Some mechanical keyboards need to send > 8 byte packets
HID_Handle->poll = HID_MIN_POLL;
}
if (HID_Handle->length > HID_MAX_REPORT_SIZE)
{
return USBH_FAIL;
}
/* Check fo available number of endpoints */ /* Check fo available number of endpoints */
/* Find the number of EPs in the Interface Descriptor */ /* Find the number of EPs in the Interface Descriptor */

Loading…
Cancel
Save