add interface altsetting struct
This commit is contained in:
@@ -111,7 +111,6 @@ int usbh_cdc_acm_set_line_state(struct usbh_cdc_acm *cdc_acm_class, bool dtr, bo
|
||||
|
||||
static int usbh_cdc_acm_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||
{
|
||||
struct usbh_endpoint_cfg ep_cfg = { 0 };
|
||||
struct usb_endpoint_descriptor *ep_desc;
|
||||
int ret;
|
||||
|
||||
@@ -147,7 +146,7 @@ static int usbh_cdc_acm_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY
|
||||
ep_desc = &hport->config.intf[intf].ep[0].ep_desc;
|
||||
ep_desc = &hport->config.intf[intf].altsetting[0].ep[0].ep_desc;
|
||||
ep_cfg.ep_addr = ep_desc->bEndpointAddress;
|
||||
ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK;
|
||||
ep_cfg.ep_mps = ep_desc->wMaxPacketSize;
|
||||
@@ -156,25 +155,14 @@ static int usbh_cdc_acm_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||
usbh_pipe_alloc(&cdc_acm_class->intin, &ep_cfg);
|
||||
|
||||
#endif
|
||||
for (uint8_t i = 0; i < hport->config.intf[intf + 1].intf_desc.bNumEndpoints; i++) {
|
||||
ep_desc = &hport->config.intf[intf + 1].ep[i].ep_desc;
|
||||
for (uint8_t i = 0; i < hport->config.intf[intf + 1].altsetting[0].intf_desc.bNumEndpoints; i++) {
|
||||
ep_desc = &hport->config.intf[intf + 1].altsetting[0].ep[i].ep_desc;
|
||||
|
||||
ep_cfg.ep_addr = ep_desc->bEndpointAddress;
|
||||
ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK;
|
||||
ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK;
|
||||
ep_cfg.ep_interval = ep_desc->bInterval;
|
||||
ep_cfg.hport = hport;
|
||||
if (ep_desc->bEndpointAddress & 0x80) {
|
||||
usbh_pipe_alloc(&cdc_acm_class->bulkin, &ep_cfg);
|
||||
usbh_hport_activate_epx(&cdc_acm_class->bulkin, hport, ep_desc);
|
||||
} else {
|
||||
usbh_pipe_alloc(&cdc_acm_class->bulkout, &ep_cfg);
|
||||
usbh_hport_activate_epx(&cdc_acm_class->bulkout, hport, ep_desc);
|
||||
}
|
||||
|
||||
USB_LOG_INFO("Ep=%02x Attr=%02u Mps=%d Interval=%02u\r\n",
|
||||
ep_desc->bEndpointAddress,
|
||||
ep_desc->bmAttributes,
|
||||
ep_desc->wMaxPacketSize,
|
||||
ep_desc->bInterval);
|
||||
}
|
||||
|
||||
snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, cdc_acm_class->minor);
|
||||
@@ -191,7 +179,6 @@ static int usbh_cdc_acm_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
||||
struct usbh_cdc_acm *cdc_acm_class = (struct usbh_cdc_acm *)hport->config.intf[intf].priv;
|
||||
|
||||
if (cdc_acm_class) {
|
||||
|
||||
usbh_cdc_acm_devno_free(cdc_acm_class);
|
||||
|
||||
if (cdc_acm_class->bulkin) {
|
||||
|
||||
Reference in New Issue
Block a user