Skip to content

Commit 9143220

Browse files
committed
update tinyusb to commit 07976ad26d4fbcad0694aa3a08294af7fd5f759f
1 parent ee35022 commit 9143220

File tree

8 files changed

+314
-212
lines changed

8 files changed

+314
-212
lines changed

src/arduino/ports/rp2040/tusb_config_rp2040.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ extern int serial1_printf(const char *__restrict __format, ...);
100100
// Number of hub devices
101101
#define CFG_TUH_HUB 1
102102

103-
// max device support (excluding hub device)
104-
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports
103+
// max device support (excluding hub device): 1 hub typically has 4 ports
104+
#define CFG_TUH_DEVICE_MAX (3*CFG_TUH_HUB + 1)
105105

106106
// Enable tuh_edpt_xfer() API
107107
//#define CFG_TUH_API_EDPT_XFER 1
@@ -110,7 +110,8 @@ extern int serial1_printf(const char *__restrict __format, ...);
110110
#define CFG_TUH_MSC 1
111111

112112
// Number of HIDs
113-
#define CFG_TUH_HID 4
113+
// typical keyboard + mouse device can have 3,4 HID interfaces
114+
#define CFG_TUH_HID (3*CFG_TUH_DEVICE_MAX)
114115

115116
// Number of CDC interfaces
116117
#define CFG_TUH_CDC 1

src/class/cdc/cdc_host.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,25 @@ uint8_t tuh_cdc_itf_get_index(uint8_t daddr, uint8_t itf_num)
127127
return TUSB_INDEX_INVALID_8;
128128
}
129129

130-
bool tuh_cdc_itf_get_info(uint8_t idx, tuh_cdc_itf_info_t* info)
130+
bool tuh_cdc_itf_get_info(uint8_t idx, tuh_itf_info_t* info)
131131
{
132132
cdch_interface_t* p_cdc = get_itf(idx);
133133
TU_VERIFY(p_cdc && info);
134134

135-
info->daddr = p_cdc->daddr;
136-
info->bInterfaceNumber = p_cdc->bInterfaceNumber;
137-
info->bInterfaceSubClass = p_cdc->bInterfaceSubClass;
138-
info->bInterfaceProtocol = p_cdc->bInterfaceProtocol;
135+
info->daddr = p_cdc->daddr;
136+
137+
// re-construct descriptor
138+
tusb_desc_interface_t* desc = &info->desc;
139+
desc->bLength = sizeof(tusb_desc_interface_t);
140+
desc->bDescriptorType = TUSB_DESC_INTERFACE;
141+
142+
desc->bInterfaceNumber = p_cdc->bInterfaceNumber;
143+
desc->bAlternateSetting = 0;
144+
desc->bNumEndpoints = 2u + (p_cdc->ep_notif ? 1u : 0u);
145+
desc->bInterfaceClass = TUSB_CLASS_CDC;
146+
desc->bInterfaceSubClass = p_cdc->bInterfaceSubClass;
147+
desc->bInterfaceProtocol = p_cdc->bInterfaceProtocol;
148+
desc->iInterface = 0; // not used yet
139149

140150
return true;
141151
}

src/class/cdc/cdc_host.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,13 @@
7171
// Application API
7272
//--------------------------------------------------------------------+
7373

74-
typedef struct
75-
{
76-
uint8_t daddr;
77-
uint8_t bInterfaceNumber;
78-
uint8_t bInterfaceSubClass;
79-
uint8_t bInterfaceProtocol;
80-
} tuh_cdc_itf_info_t;
81-
8274
// Get Interface index from device address + interface number
8375
// return TUSB_INDEX_INVALID_8 (0xFF) if not found
8476
uint8_t tuh_cdc_itf_get_index(uint8_t daddr, uint8_t itf_num);
8577

8678
// Get Interface information
8779
// return true if index is correct and interface is currently mounted
88-
bool tuh_cdc_itf_get_info(uint8_t idx, tuh_cdc_itf_info_t* info);
80+
bool tuh_cdc_itf_get_info(uint8_t idx, tuh_itf_info_t* info);
8981

9082
// Check if a interface is mounted
9183
bool tuh_cdc_mounted(uint8_t idx);

0 commit comments

Comments
 (0)