start next hub int transfer after enumrateion

This commit is contained in:
sakumisu
2022-10-05 12:22:23 +08:00
parent 6c25035d7a
commit 0c77c8b457

View File

@@ -49,10 +49,8 @@ static int usbh_hub_devno_alloc(void)
return -EMFILE; return -EMFILE;
} }
static void usbh_hub_devno_free(struct usbh_hub *hub) static void usbh_hub_devno_free(uint8_t devno)
{ {
int devno = hub->index;
if (devno >= EXTHUB_FIRST_INDEX && devno < 32) { if (devno >= EXTHUB_FIRST_INDEX && devno < 32) {
g_devinuse &= ~(1 << devno); g_devinuse &= ~(1 << devno);
} }
@@ -239,7 +237,6 @@ static void hub_int_complete_callback(void *arg, int nbytes)
if (nbytes > 0) { if (nbytes > 0) {
usbh_hub_thread_wakeup(hub); usbh_hub_thread_wakeup(hub);
usbh_submit_urb(&hub->intin_urb);
} }
} }
@@ -251,7 +248,9 @@ static int usbh_hub_connect(struct usbh_hubport *hport, uint8_t intf)
int index; int index;
index = usbh_hub_devno_alloc(); index = usbh_hub_devno_alloc();
if (index > (CONFIG_USBHOST_MAX_EXTHUBS + EXTHUB_FIRST_INDEX)) { if (index > (CONFIG_USBHOST_MAX_EXTHUBS + EXTHUB_FIRST_INDEX - 1)) {
USB_LOG_ERR("No memory to alloc hub class\r\n");
usbh_hub_devno_free(index);
return -ENOMEM; return -ENOMEM;
} }
@@ -316,7 +315,7 @@ static int usbh_hub_disconnect(struct usbh_hubport *hport, uint8_t intf)
struct usbh_hub *hub = (struct usbh_hub *)hport->config.intf[intf].priv; struct usbh_hub *hub = (struct usbh_hub *)hport->config.intf[intf].priv;
if (hub) { if (hub) {
usbh_hub_devno_free(hub); usbh_hub_devno_free(hub->index);
if (hub->intin) { if (hub->intin) {
usbh_pipe_free(hub->intin); usbh_pipe_free(hub->intin);
@@ -517,6 +516,11 @@ static void usbh_hub_events(struct usbh_hub *hub)
} }
} }
} }
/* Start next hub int transfer */
if (!hub->is_roothub && hub->connected) {
usbh_submit_urb(&hub->intin_urb);
}
} }
static void usbh_hub_thread(void *argument) static void usbh_hub_thread(void *argument)