Commit fd92b7de authored by Yuyang Du's avatar Yuyang Du Committed by Greg Kroah-Hartman

usb: usbip tool: Fix refresh_imported_device_list()

The commit 0775a9cb ("usbip: vhci extension: modifications
to vhci driver") introduced multiple controllers, but the status
of the ports are only extracted from the first status file, fix it.
Reviewed-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: default avatarYuyang Du <yuyang.du@intel.com>
Acked-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aa3ecb91
......@@ -108,18 +108,33 @@ static int parse_status(const char *value)
return 0;
}
#define MAX_STATUS_NAME 16
static int refresh_imported_device_list(void)
{
const char *attr_status;
char status[MAX_STATUS_NAME+1] = "status";
int i, ret;
for (i = 0; i < vhci_driver->ncontrollers; i++) {
if (i > 0)
snprintf(status, sizeof(status), "status.%d", i);
attr_status = udev_device_get_sysattr_value(vhci_driver->hc_device,
"status");
status);
if (!attr_status) {
err("udev_device_get_sysattr_value failed");
return -1;
}
return parse_status(attr_status);
dbg("controller %d", i);
ret = parse_status(attr_status);
if (ret != 0)
return ret;
}
return 0;
}
static int get_nports(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment