[patch 05/16] usb: usb_generic_probe() obeys authorization

[email protected]
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
04-usb-generic-probe-obeys-authorization.patch (text/plain, 2 KB)
If called and the device is not authorized to be used, then we won't
choose a configuration (as they are not a concept that exists for an
unauthorized device). However, the device is added to the system.

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>

---
 drivers/usb/core/generic.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Index: linux.hg/drivers/usb/core/generic.c
===================================================================
--- linux.hg.orig/drivers/usb/core/generic.c	2007-07-09 14:16:36.000000000 -0700
+++ linux.hg/drivers/usb/core/generic.c	2007-07-09 15:09:27.000000000 -0700
@@ -160,17 +160,20 @@
 	/* Choose and set the configuration.  This registers the interfaces
 	 * with the driver core and lets interface drivers bind to them.
 	 */
-	c = choose_configuration(udev);
-	if (c >= 0) {
-		err = usb_set_configuration(udev, c);
-		if (err) {
-			dev_err(&udev->dev, "can't set config #%d, error %d\n",
+	if (udev->authorized == 0)
+		dev_err(&udev->dev, "Device is not authorized for usage\n");
+	else {
+		c = choose_configuration(udev);
+		if (c >= 0) {
+			err = usb_set_configuration(udev, c);
+			if (err) {
+				dev_err(&udev->dev, "can't set config #%d, error %d\n",
 					c, err);
-			/* This need not be fatal.  The user can try to
-			 * set other configurations. */
+				/* This need not be fatal.  The user can try to
+				 * set other configurations. */
+			}
 		}
 	}
-
 	/* USB device state == configured ... usable */
 	usb_notify_add_device(udev);
 

--

Inaky

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.