Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomHID: support different report descriptor sizes, fixes #15 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Class/CompositeBuilder/Src/usbd_composite_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ static void USBD_CMPSIT_CUSTOMHIDDesc(USBD_HandleTypeDef *pdev, uint32_t pConf,
pDesc->bCountryCode = 0x00U;
pDesc->bNumDescriptors = 0x01U;
pDesc->bDescriptorType = 0x22U;
pDesc->wItemLength = USBD_CUSTOM_HID_REPORT_DESC_SIZE;
pDesc->wItemLength = ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->wReportDescrLen;
*Sze += (uint32_t)sizeof(USBD_DescTypeDef);

/* Descriptor of Custom HID endpoints */
Expand Down
1 change: 1 addition & 0 deletions Class/CustomHID/Inc/usbd_customhid.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef enum
typedef struct _USBD_CUSTOM_HID_Itf
{
uint8_t *pReport;
uint16_t wReportDescrLen;
int8_t (* Init)(void);
int8_t (* DeInit)(void);
int8_t (* OutEvent)(uint8_t event_idx, uint8_t state);
Expand Down
1 change: 1 addition & 0 deletions Class/CustomHID/Src/usbd_customhid_if_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ __ALIGN_BEGIN static uint8_t TEMPLATE_CUSTOM_HID_ReportDesc[USBD_CUSTOM_HID_REPO
USBD_CUSTOM_HID_ItfTypeDef USBD_CustomHID_template_fops =
{
TEMPLATE_CUSTOM_HID_ReportDesc,
USBD_CUSTOM_HID_REPORT_DESC_SIZE,
TEMPLATE_CUSTOM_HID_Init,
TEMPLATE_CUSTOM_HID_DeInit,
TEMPLATE_CUSTOM_HID_OutEvent,
Expand Down