/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call.  */
int usb_get_status(struct usb_host_virt_dev *dev, s32 type, s32 target, void *data)
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call.  */
int usb_get_status(struct usb_host_virt_dev *dev, s32 type, s32 target, void *data)
{
    s32 ret = 0;
    u16 *status = malloc(sizeof(*status));
    if (!status)
    {
        __err("ERR:　usb_get_status, malloc failed");
        return -ENOMEM;
    }
    memset(status, 0, sizeof(*status));
    ret = usb_control_msg(dev,
                          usb_rcvctrlpipe(dev, 0),
                          USB_REQ_GET_STATUS, USB_DIR_IN | type,
                          0,
                          target,
                          status,
                          sizeof(*status), USB_CTRL_GET_TIMEOUT);
    *(u16 *)data = *status;
    if (status)
    {
        free(status);
        status = NULL;
    }
    else
    {
        __err("ERR: parameter is NULL, can't free");
    }
    return ret;
}