usb: usbip tool: Fix refresh_imported_device_list()
The commit 0775a9cbc6
("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: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
zero-colors
parent
aa3ecb9154
commit
fd92b7deb9
|
@ -108,18 +108,33 @@ static int parse_status(const char *value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX_STATUS_NAME 16
|
||||||
|
|
||||||
static int refresh_imported_device_list(void)
|
static int refresh_imported_device_list(void)
|
||||||
{
|
{
|
||||||
const char *attr_status;
|
const char *attr_status;
|
||||||
|
char status[MAX_STATUS_NAME+1] = "status";
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
attr_status = udev_device_get_sysattr_value(vhci_driver->hc_device,
|
for (i = 0; i < vhci_driver->ncontrollers; i++) {
|
||||||
"status");
|
if (i > 0)
|
||||||
if (!attr_status) {
|
snprintf(status, sizeof(status), "status.%d", i);
|
||||||
err("udev_device_get_sysattr_value failed");
|
|
||||||
return -1;
|
attr_status = udev_device_get_sysattr_value(vhci_driver->hc_device,
|
||||||
|
status);
|
||||||
|
if (!attr_status) {
|
||||||
|
err("udev_device_get_sysattr_value failed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbg("controller %d", i);
|
||||||
|
|
||||||
|
ret = parse_status(attr_status);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parse_status(attr_status);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_nports(void)
|
static int get_nports(void)
|
||||||
|
|
Loading…
Reference in New Issue