File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
components/drivers/usb/usbhost Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ rt_err_t rt_udisk_run(struct uhintf* intf)
186186{
187187 int i = 0 ;
188188 rt_err_t ret ;
189- char dname [4 ];
189+ char dname [8 ];
190190 char sname [8 ];
191191 rt_uint8_t max_lun , * sector , sense [18 ], inquiry [36 ];
192192 struct dfs_partition part [MAX_PARTITION_COUNT ];
Original file line number Diff line number Diff line change @@ -417,8 +417,13 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
417417
418418 if (reconnect )
419419 {
420- if (hub -> child [i ] != RT_NULL && hub -> child [i ]-> status != DEV_STATUS_IDLE )
420+ if (hub -> child [i ] != RT_NULL && hub -> child [i ]-> status != DEV_STATUS_IDLE )
421+ {
421422 rt_usbh_detach_instance (hub -> child [i ]);
423+
424+ /* Child device have been detach. Set hub->child[i] to NULL. */
425+ hub -> child [i ] = RT_NULL ;
426+ }
422427
423428 ret = rt_usbh_hub_port_debounce (hub , i + 1 );
424429 if (ret != RT_EOK ) continue ;
@@ -532,7 +537,12 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
532537 }
533538
534539 /* get hub ports number */
535- hub -> num_ports = hub -> hub_desc .num_ports ;
540+ /* If hub device supported ports over USB_HUB_PORT_NUM(Ex: 8 port hub). Set hub->num_ports to USB_HUB_PORT_NUM */
541+ if (hub -> hub_desc .num_ports > USB_HUB_PORT_NUM )
542+ hub -> num_ports = USB_HUB_PORT_NUM ;
543+ else
544+ hub -> num_ports = hub -> hub_desc .num_ports ;
545+
536546 hub -> hcd = device -> hcd ;
537547 hub -> self = device ;
538548
@@ -607,7 +617,6 @@ static rt_err_t rt_usbh_hub_disable(void* arg)
607617 }
608618
609619 if (hub != RT_NULL ) rt_free (hub );
610- if (intf != RT_NULL ) rt_free (intf );
611620
612621 return RT_EOK ;
613622}
You can’t perform that action at this time.
0 commit comments