Hi, guys: In the current libusual system, if a device is listed in unusual_devs.h, it cannot be serviced by ub. Which is fine most of the time, because listed devices are largely obscure. Unfortunately, iPod is listed too, but I wish [to continue] to drive my iPod with ub. So, I would like to have something like the attached patch.
Architecturally, this is the best approach from those I tried. I can pack everything into libsusual, but it makes the decision unclear and there's a danger of making a device refused by either of storage backends. With the explicit flag like below, things are much safer. However, a certain uglification occurs... Phil, Matt, Alan, I'd like some feedback about this before I try to send it out. Thank you, -- Pete P.S. I have an SDDR-31 as well as iPod, so I marked it as bias-able too. diff -urp -X dontdiff linux-2.6.17-rc2/drivers/block/ub.c linux-2.6.17-rc2-lem/drivers/block/ub.c --- linux-2.6.17-rc2/drivers/block/ub.c 2006-04-23 21:05:39.000000000 -0700 +++ linux-2.6.17-rc2-lem/drivers/block/ub.c 2006-04-28 20:19:12.000000000 -0700 @@ -327,6 +327,7 @@ struct ub_dev { char name[12]; struct usb_device *dev; struct usb_interface *intf; + unsigned long us_flags; struct list_head luns; @@ -1900,7 +1897,9 @@ static int ub_sync_read_cap(struct ub_de } /* sd.c special-cases sector size of 0 to mean 512. Needed? Safe? */ - nsec = be32_to_cpu(*(__be32 *)p) + 1; + nsec = be32_to_cpu(*(__be32 *)p); + if (!(sc->us_flags & US_FL_FIX_CAPACITY)) + nsec++; bsize = be32_to_cpu(*(__be32 *)(p + 4)); switch (bsize) { case 512: shift = 0; break; @@ -2226,6 +2225,7 @@ static int ub_probe(struct usb_interface snprintf(sc->name, 12, DRV_NAME "(%d.%d)", sc->dev->bus->busnum, sc->dev->devnum); + sc->us_flags = USB_US_ORIG_FLAGS(dev_id->driver_info); /* XXX Verify that we can handle the device (from descriptors) */ if (ub_get_pipes(sc, sc->dev, intf) != 0) diff -urp -X dontdiff linux-2.6.17-rc2/drivers/usb/storage/libusual.c linux-2.6.17-rc2-lem/drivers/usb/storage/libusual.c --- linux-2.6.17-rc2/drivers/usb/storage/libusual.c 2006-03-27 07:45:23.000000000 -0800 +++ linux-2.6.17-rc2-lem/drivers/usb/storage/libusual.c 2006-04-28 19:09:24.000000000 -0700 @@ -44,6 +44,12 @@ static int usu_probe_thread(void *arg); { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } +#define UNUSUAL_DEV2(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ + vendorName, productName, useProtocol, useTransport, \ + initFunction, flags, useType) \ +{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ + .driver_info = (flags)|((useType)<<24) } + #define USUAL_DEV(useProto, useTrans, useType) \ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ .driver_info = ((useType)<<24) } @@ -54,6 +60,7 @@ struct usb_device_id storage_usb_ids [] }; #undef USUAL_DEV +#undef UNUSUAL_DEV2 #undef UNUSUAL_DEV MODULE_DEVICE_TABLE(usb, storage_usb_ids); diff -urp -X dontdiff linux-2.6.17-rc2/drivers/usb/storage/unusual_devs.h linux-2.6.17-rc2-lem/drivers/usb/storage/unusual_devs.h --- linux-2.6.17-rc2/drivers/usb/storage/unusual_devs.h 2006-04-23 21:06:19.000000000 -0700 +++ linux-2.6.17-rc2-lem/drivers/usb/storage/unusual_devs.h 2006-04-28 19:09:24.000000000 -0700 @@ -638,40 +638,40 @@ UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x * to change with firmware updates, I changed the range to maximum for all * iPod entries. */ -UNUSUAL_DEV( 0x05ac, 0x1202, 0x0000, 0x9999, +UNUSUAL_DEV2( 0x05ac, 0x1202, 0x0000, 0x9999, "Apple", "iPod", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), /* Reported by Avi Kivity <[EMAIL PROTECTED]> */ -UNUSUAL_DEV( 0x05ac, 0x1203, 0x0000, 0x9999, +UNUSUAL_DEV2( 0x05ac, 0x1203, 0x0000, 0x9999, "Apple", "iPod", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), -UNUSUAL_DEV( 0x05ac, 0x1204, 0x0000, 0x9999, +UNUSUAL_DEV2( 0x05ac, 0x1204, 0x0000, 0x9999, "Apple", "iPod", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), -UNUSUAL_DEV( 0x05ac, 0x1205, 0x0000, 0x9999, +UNUSUAL_DEV2( 0x05ac, 0x1205, 0x0000, 0x9999, "Apple", "iPod", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), /* * Reported by Tyson Vinson <[EMAIL PROTECTED]> * This particular productId is the iPod Nano */ -UNUSUAL_DEV( 0x05ac, 0x120a, 0x0000, 0x9999, +UNUSUAL_DEV2( 0x05ac, 0x120a, 0x0000, 0x9999, "Apple", "iPod", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), #ifdef CONFIG_USB_STORAGE_JUMPSHOT UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001, @@ -780,11 +780,11 @@ UNUSUAL_DEV( 0x0781, 0x0001, 0x0200, 0x US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN ), -UNUSUAL_DEV( 0x0781, 0x0002, 0x0009, 0x0009, +UNUSUAL_DEV2( 0x0781, 0x0002, 0x0009, 0x0009, "SanDisk Corporation", "ImageMate CompactFlash USB", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_CAPACITY ), + US_FL_FIX_CAPACITY, 0 ), #ifdef CONFIG_USB_STORAGE_USBAT UNUSUAL_DEV( 0x0781, 0x0005, 0x0005, 0x0005, @@ -1103,6 +1103,16 @@ UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_SINGLE_LUN ), +/* + * Pete Zaitcev <[EMAIL PROTECTED]>, bz#164688. + * The device blatantly ignores LUN and returns 1 in GetMaxLUN. + */ +UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0100, + "Unknown", + "Unknown", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_SINGLE_LUN ), + /* Submitted by Joris Struyve <[EMAIL PROTECTED]> */ UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff, "Medion", diff -urp -X dontdiff linux-2.6.17-rc2/drivers/usb/storage/usb.c linux-2.6.17-rc2-lem/drivers/usb/storage/usb.c --- linux-2.6.17-rc2/drivers/usb/storage/usb.c 2006-04-23 21:06:19.000000000 -0700 +++ linux-2.6.17-rc2-lem/drivers/usb/storage/usb.c 2006-04-28 19:09:24.000000000 -0700 @@ -128,6 +128,9 @@ static DECLARE_COMPLETION(threads_gone); { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \ .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } +#define UNUSUAL_DEV2(v,p,m0,m1,vn,pn,pt,tr,i,f,t) \ + UNUSUAL_DEV(v,p,m0,m1,vn,pn,pt,tr,i,f) + #define USUAL_DEV(useProto, useTrans, useType) \ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ .driver_info = (USB_US_TYPE_STOR<<24) } @@ -136,6 +139,7 @@ static struct usb_device_id storage_usb_ # include "unusual_devs.h" #undef UNUSUAL_DEV +#undef UNUSUAL_DEV2 #undef USUAL_DEV /* Terminating entry */ { } @@ -166,6 +170,9 @@ MODULE_DEVICE_TABLE (usb, storage_usb_id .initFunction = init_function, \ } +#define UNUSUAL_DEV2(v,p,m0,m1,vn,pn,pt,tr,i,f,t) \ + UNUSUAL_DEV(v,p,m0,m1,vn,pn,pt,tr,i,f) + #define USUAL_DEV(use_protocol, use_transport, use_type) \ { \ .useProtocol = use_protocol, \ @@ -175,6 +182,7 @@ MODULE_DEVICE_TABLE (usb, storage_usb_id static struct us_unusual_dev us_unusual_dev_list[] = { # include "unusual_devs.h" # undef UNUSUAL_DEV +# undef UNUSUAL_DEV2 # undef USUAL_DEV /* Terminating entry */ ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel