/* This function will rest hub port, it is invoked when sub device attached to the hub port. */
rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port)
/* This function will rest hub port, it is invoked when sub device attached to the hub port. */
rt_err_t rt_usb_hub_reset_port(uhubinst_t uhub, rt_uint16_t port)
{
    rt_err_t ret;
    rt_uint32_t pstatus;
    RT_ASSERT(uhub != RT_NULL);
    rt_thread_delay(50);
    ret = rt_usb_hub_set_port_feature(uhub, port, PORT_FEAT_RESET);
    if(ret != RT_EOK) return ret;
    while(1)
    {
        ret = rt_usb_hub_get_port_status(uhub, port, (rt_uint8_t*)&pstatus);
        if(!(pstatus & PORT_PRS)) break;
    }
    ret = rt_usb_hub_clear_port_feature(uhub, port, PORT_FEAT_C_RESET);    
    if(ret != RT_EOK) return ret;
    rt_thread_delay(50);    
    return RT_EOK;
}