diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2018-01-17 14:08:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-22 09:34:37 -0500 |
commit | ef824501f50846589f02173d73ce3fe6021a9d2a (patch) | |
tree | c2c42fd00cc2af729995a9d89d99860dbcb86c4c | |
parent | ef54cf0c600fb8f5737fb001a9e357edda1a1de8 (diff) |
usbip: list: don't list devices attached to vhci_hcd
usbip host lists devices attached to vhci_hcd on the same server
when user does attach over localhost or specifies the server as the
remote.
usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)
Fix it to check and not list devices that are attached to vhci_hcd.
Cc: stable@vger.kernel.org
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | tools/usb/usbip/src/usbip_list.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c index f1b38e866dd7..d65a9f444174 100644 --- a/tools/usb/usbip/src/usbip_list.c +++ b/tools/usb/usbip/src/usbip_list.c | |||
@@ -187,6 +187,7 @@ static int list_devices(bool parsable) | |||
187 | const char *busid; | 187 | const char *busid; |
188 | char product_name[128]; | 188 | char product_name[128]; |
189 | int ret = -1; | 189 | int ret = -1; |
190 | const char *devpath; | ||
190 | 191 | ||
191 | /* Create libudev context. */ | 192 | /* Create libudev context. */ |
192 | udev = udev_new(); | 193 | udev = udev_new(); |
@@ -209,6 +210,14 @@ static int list_devices(bool parsable) | |||
209 | path = udev_list_entry_get_name(dev_list_entry); | 210 | path = udev_list_entry_get_name(dev_list_entry); |
210 | dev = udev_device_new_from_syspath(udev, path); | 211 | dev = udev_device_new_from_syspath(udev, path); |
211 | 212 | ||
213 | /* Ignore devices attached to vhci_hcd */ | ||
214 | devpath = udev_device_get_devpath(dev); | ||
215 | if (strstr(devpath, USBIP_VHCI_DRV_NAME)) { | ||
216 | dbg("Skip the device %s already attached to %s\n", | ||
217 | devpath, USBIP_VHCI_DRV_NAME); | ||
218 | continue; | ||
219 | } | ||
220 | |||
212 | /* Get device information. */ | 221 | /* Get device information. */ |
213 | idVendor = udev_device_get_sysattr_value(dev, "idVendor"); | 222 | idVendor = udev_device_get_sysattr_value(dev, "idVendor"); |
214 | idProduct = udev_device_get_sysattr_value(dev, "idProduct"); | 223 | idProduct = udev_device_get_sysattr_value(dev, "idProduct"); |