diff options
| author | Ha Thach <[email protected]> | 2023-03-22 10:37:06 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-22 10:37:06 +0700 |
| commit | 07976ad26d4fbcad0694aa3a08294af7fd5f759f (patch) | |
| tree | 582a8f1274c33bbdd5b7da28994f897d842495b1 /src/class/cdc/cdc_host.c | |
| parent | ec9c666107c0be0f8dc7c2a15e3bdea8c44a50b4 (diff) | |
| parent | f27486e19abcc020c93c0c938c71e3692c21b9f5 (diff) | |
Merge pull request #1968 from hathach/refactor-hid-host
Refactor hid host
Diffstat (limited to 'src/class/cdc/cdc_host.c')
| -rw-r--r-- | src/class/cdc/cdc_host.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index d34662cb7..fee314823 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -127,15 +127,25 @@ uint8_t tuh_cdc_itf_get_index(uint8_t daddr, uint8_t itf_num) return TUSB_INDEX_INVALID_8; } -bool tuh_cdc_itf_get_info(uint8_t idx, tuh_cdc_itf_info_t* info) +bool tuh_cdc_itf_get_info(uint8_t idx, tuh_itf_info_t* info) { cdch_interface_t* p_cdc = get_itf(idx); TU_VERIFY(p_cdc && info); - info->daddr = p_cdc->daddr; - info->bInterfaceNumber = p_cdc->bInterfaceNumber; - info->bInterfaceSubClass = p_cdc->bInterfaceSubClass; - info->bInterfaceProtocol = p_cdc->bInterfaceProtocol; + info->daddr = p_cdc->daddr; + + // re-construct descriptor + tusb_desc_interface_t* desc = &info->desc; + desc->bLength = sizeof(tusb_desc_interface_t); + desc->bDescriptorType = TUSB_DESC_INTERFACE; + + desc->bInterfaceNumber = p_cdc->bInterfaceNumber; + desc->bAlternateSetting = 0; + desc->bNumEndpoints = 2u + (p_cdc->ep_notif ? 1u : 0u); + desc->bInterfaceClass = TUSB_CLASS_CDC; + desc->bInterfaceSubClass = p_cdc->bInterfaceSubClass; + desc->bInterfaceProtocol = p_cdc->bInterfaceProtocol; + desc->iInterface = 0; // not used yet return true; } |
