diff options
author | Yuyang Du <yuyang.du@intel.com> | 2017-05-22 06:20:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-13 04:48:24 -0400 |
commit | fd92b7deb98a4edd31ffcc2d64cee36103805ff5 (patch) | |
tree | 2a93c0178340fb019d323aca784bd88b72b3672d /tools/usb/usbip/libsrc | |
parent | aa3ecb9154acb99282f315fe6c34ce4b7eb4d67e (diff) |
usb: usbip tool: Fix refresh_imported_device_list()
The commit 0775a9cbc694e8c7 ("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>
Diffstat (limited to 'tools/usb/usbip/libsrc')
-rw-r--r-- | tools/usb/usbip/libsrc/vhci_driver.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index f6f3a19ba385..aa82c4b17797 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c | |||
@@ -108,18 +108,33 @@ static int parse_status(const char *value) | |||
108 | return 0; | 108 | return 0; |
109 | } | 109 | } |
110 | 110 | ||
111 | #define MAX_STATUS_NAME 16 | ||
112 | |||
111 | static int refresh_imported_device_list(void) | 113 | static int refresh_imported_device_list(void) |
112 | { | 114 | { |
113 | const char *attr_status; | 115 | const char *attr_status; |
116 | char status[MAX_STATUS_NAME+1] = "status"; | ||
117 | int i, ret; | ||
114 | 118 | ||
115 | attr_status = udev_device_get_sysattr_value(vhci_driver->hc_device, | 119 | for (i = 0; i < vhci_driver->ncontrollers; i++) { |
116 | "status"); | 120 | if (i > 0) |
117 | if (!attr_status) { | 121 | snprintf(status, sizeof(status), "status.%d", i); |
118 | err("udev_device_get_sysattr_value failed"); | 122 | |
119 | return -1; | 123 | attr_status = udev_device_get_sysattr_value(vhci_driver->hc_device, |
124 | status); | ||
125 | if (!attr_status) { | ||
126 | err("udev_device_get_sysattr_value failed"); | ||
127 | return -1; | ||
128 | } | ||
129 | |||
130 | dbg("controller %d", i); | ||
131 | |||
132 | ret = parse_status(attr_status); | ||
133 | if (ret != 0) | ||
134 | return ret; | ||
120 | } | 135 | } |
121 | 136 | ||
122 | return parse_status(attr_status); | 137 | return 0; |
123 | } | 138 | } |
124 | 139 | ||
125 | static int get_nports(void) | 140 | static int get_nports(void) |