* [PATCH] staging: usbip: userspace: don't throw error when trying to read configuration specific attributes
@ 2014-03-04 19:27 Valentina Manea
0 siblings, 0 replies; only message in thread
From: Valentina Manea @ 2014-03-04 19:27 UTC (permalink / raw)
To: gregkh
Cc: tobias.polzer, dominik.paulus, ly80toro, shuah.kh, ihadzic,
linux-kernel, linux-usb, devel, firefly, andy.grover,
Valentina Manea
When a device has just been bound to usbip-host but the client hasn't
set a configuration on it, certain attributes will not exist. Don't
treat this as an error.
Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
---
drivers/staging/usbip/userspace/libsrc/usbip_common.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
index 8d675a9..ac32a36 100644
--- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c
+++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
@@ -127,10 +127,23 @@ int read_attr_value(struct udev_device *dev, const char *name,
goto err;
}
+ /* The client chooses the device configuration
+ * when attaching it so right after being bound
+ * to usbip-host on the server the device will
+ * have no configuration.
+ * Therefore, attributes such as bConfigurationValue
+ * and bNumInterfaces will not exist and sscanf will
+ * fail. Check for these cases and don't treat them
+ * as errors.
+ */
+
ret = sscanf(attr, format, &num);
if (ret < 1) {
- dbg("sscanf failed");
- goto err;
+ if (strcmp(name, "bConfigurationValue") &&
+ strcmp(name, "bNumInterfaces")) {
+ dbg("sscanf failed");
+ goto err;
+ }
}
err:
--
1.8.1.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-04 19:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-04 19:27 [PATCH] staging: usbip: userspace: don't throw error when trying to read configuration specific attributes Valentina Manea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®