/* This function will do USB_REQ_GET_STATUS request for the device instance to get hub port status. */
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port, rt_uint8_t *buffer)
/* This function will do USB_REQ_GET_STATUS request for the device instance to get hub port status. */
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port, rt_uint8_t *buffer)
{
    struct ureqest setup;
    int timeout = 100;
    int length = 4;
    RT_ASSERT(uhub != RT_NULL);
    if(uhub->is_roothub)
    {
        rt_usb_hcd_hub_control(uhub->hcd, port, RH_GET_PORT_STATUS, 
            (void*)buffer);
        return RT_EOK;
    }
    setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | 
        USB_REQ_TYPE_OTHER;
    setup.request = USB_REQ_GET_STATUS;
    setup.index = port;
    setup.length = 4;
    setup.value = 0;
    if(rt_usb_hcd_control_xfer(uhub->hcd, uhub->self, &setup, buffer, 
        length, timeout) == timeout) return RT_EOK;
    else return -RT_FALSE;        
}