Alan Stern wrote:
In general the idea looks okay to me, but I would change the details in
storage/usb.c. Check for US_FL_IGNORE_DEVICE in the get_device_info() routine, and make that routine return int instead of void. If the flag is
present you can simply return -ENODEV.  Then in storage_probe(), you check
the return code and jump to BadDevice if it's nonzero, just like with all
the following subroutine calls.

Thanks, that is a bit cleaner.

Matt?


diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index 543244d..f01a3f8 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1074,7 +1074,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xff
                 "Optio S/S4",
                 US_SC_DEVICE, US_PR_DEVICE, NULL,
                 US_FL_FIX_INQUIRY ),
-               
+
+/* This is a virtual windows driver CD, which the zd1211rw driver 
automatically 
+ * converts into a WLAN device. */
+UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
+                "ZyXEL",
+                "G-220F USB-WLAN Install",
+                US_SC_DEVICE, US_PR_DEVICE, NULL,
+                US_FL_IGNORE_DEVICE ),
+
 #ifdef CONFIG_USB_STORAGE_ISD200
 UNUSUAL_DEV(  0x0bf6, 0xa001, 0x0100, 0x0110,
                "ATI",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index e232c7c..04cd0e6 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -479,7 +479,7 @@ static struct us_unusual_dev *find_unusu
 }
 
 /* Get the unusual_devs entries and the string descriptors */
-static void get_device_info(struct us_data *us, const struct usb_device_id *id)
+static int get_device_info(struct us_data *us, const struct usb_device_id *id)
 {
        struct usb_device *dev = us->pusb_dev;
        struct usb_interface_descriptor *idesc =
@@ -496,6 +496,11 @@ static void get_device_info(struct us_da
                        unusual_dev->useTransport;
        us->flags = USB_US_ORIG_FLAGS(id->driver_info);
 
+       if (us->flags & US_FL_IGNORE_DEVICE) {
+               printk(KERN_INFO USB_STORAGE "device ignored\n");
+               return -ENODEV;
+       }
+
        /*
         * This flag is only needed when we're in high-speed, so let's
         * disable it if we're in full-speed
@@ -535,6 +540,8 @@ static void get_device_info(struct us_da
                                idesc->bInterfaceProtocol,
                                msgs[msg]);
        }
+
+       return 0;
 }
 
 /* Get the transport settings */
@@ -961,7 +968,9 @@ static int storage_probe(struct usb_inte
         * of the match from the usb_device_id table, so we can find the
         * corresponding entry in the private table.
         */
-       get_device_info(us, id);
+       result = get_device_info(us, id);
+       if (result)
+               goto BadDevice;
 
        /* Get the transport, protocol, and pipe settings */
        result = get_transport(us);
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 608487a..4cf3bf1 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -43,6 +43,8 @@ #define US_DO_ALL_FLAGS                                       
        \
                /* Need delay after Command phase */            \
        US_FLAG(NO_WP_DETECT,   0x00000200)                     \
                /* Don't check for write-protect */             \
+       US_FLAG(IGNORE_DEVICE,  0x00000400)                     \
+               /* Don't claim device */
 
 #define US_FLAG(name, value)   US_FL_##name = value ,
 enum { US_DO_ALL_FLAGS };
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to