+ Shuah Khan

On 03/23/2017 03:46 AM, Yuyang Du wrote:
This field is read from the newly added ncontroller sysfs.

Signed-off-by: Yuyang Du <[email protected]>
---
 tools/usb/usbip/libsrc/vhci_driver.c | 18 +++++++++++++++++-
 tools/usb/usbip/libsrc/vhci_driver.h |  1 +
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index 4228b98..d335f04 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -134,6 +134,20 @@ static int get_nports(void)
        return strtoul(attr_nports, NULL, 10);
 }

+static int get_ncontrollers(void)
+{
+       const char *attr_ncontrollers;
+
+       attr_ncontrollers = 
udev_device_get_sysattr_value(vhci_driver->hc_device,
+                                                         "ncontrollers");
+       if (!attr_ncontrollers) {
+               err("udev_device_get_sysattr_value ncontrollers failed");
+               return -1;
+       }
+
+       return strtoul(attr_ncontrollers, NULL, 10);
+}
+

Why not just scandir()?

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to