diff options
| author | sakumisu <[email protected]> | 2022-12-03 19:39:27 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2022-12-03 19:39:27 +0800 |
| commit | 9b72a17a5b79fa5c41f8808729ecc0d4ac08d022 (patch) | |
| tree | f45624044721c7043249b061a2d50f64d3f783be | |
| parent | ed323a6fa4214b6a5090e82efa78ba015812c3d5 (diff) | |
Preventing resources from not being released
| -rw-r--r-- | class/hub/usbh_hub.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/class/hub/usbh_hub.c b/class/hub/usbh_hub.c index f07f328c..15d4fb63 100644 --- a/class/hub/usbh_hub.c +++ b/class/hub/usbh_hub.c @@ -484,6 +484,17 @@ static void usbh_hub_events(struct usbh_hub *hub) child = &hub->child[port]; + /* if last status is connected, free sources first, this does not happen normally, + but there may be hardware issues in some ips */ + if (child->connected) { + usbh_hport_deactivate_ep0(child); + for (uint8_t i = 0; i < child->config.config_desc.bNumInterfaces; i++) { + if (child->config.intf[i].class_driver && child->config.intf[i].class_driver->disconnect) { + CLASS_DISCONNECT(child, i); + } + } + } + memset(child, 0, sizeof(struct usbh_hubport)); child->parent = hub; child->connected = true; |
