On Tue, 5 Oct 2010, James wrote: > On 10/05/10 10:34, Alan Stern wrote: > > On Mon, 4 Oct 2010, James wrote: > > > >> The patch works. > > Here is a slightly revised version. This patch will print a warning > > message in the system log to let you know that the device is out of > > spec, but will allow it to be used anyway. > > > > If this version works okay with your device, I'll submit it for > > inclusion in the -stable kernel series. > > > > Alan Stern > > > > > > > > Index: usb-2.6/drivers/usb/core/hub.c > > =================================================================== > > --- usb-2.6.orig/drivers/usb/core/hub.c > > +++ usb-2.6/drivers/usb/core/hub.c > > @@ -2882,13 +2882,16 @@ hub_port_init (struct usb_hub *hub, stru > > else > > i = udev->descriptor.bMaxPacketSize0; > > if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { > > - if (udev->speed != USB_SPEED_FULL || > > + if (udev->speed == USB_SPEED_LOW || > > !(i == 8 || i == 16 || i == 32 || i == 64)) { > > - dev_err(&udev->dev, "ep0 maxpacket = %d\n", i); > > + dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i); > > retval = -EMSGSIZE; > > goto fail; > > } > > - dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); > > + if (udev->speed == USB_SPEED_FULL) > > + dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); > > + else > > + dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i); > > udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); > > usb_ep0_reinit(udev); > > } > > > > -- > usb 1-2: new high speed USB device using ehci_hcd and address 7 > usb 1-2: Using ep0 maxpacket: 32 > usb 1-2: New USB device found, idVendor=1fdd, idProduct=0001 > usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 > scsi5 : usb-storage 1-2:1.0 > scsi 5:0:0:0: Direct-Access RCA VR5220 1.00 PQ: 0 ANSI: 2 > sd 5:0:0:0: [sdb] 999424 512-byte logical blocks: (511 MB/488 MiB) > sd 5:0:0:0: [sdb] Write Protect is off > sd 5:0:0:0: [sdb] Mode Sense: 00 00 00 00 > sd 5:0:0:0: [sdb] Assuming drive cache: write through > sd 5:0:0:0: [sdb] Assuming drive cache: write through > sdb: > sd 5:0:0:0: [sdb] Assuming drive cache: write through > sd 5:0:0:0: [sdb] Attached SCSI removable disk > > I'm wondering if the message should be more informative about it > violating the USB Spec, like "Violating section 5.5.3 of the USB-2.0 > specification by using ep0 maxpacket: %d\n". No, that's not necessary. We accept several other configuration values that violate the spec; in each case there's a warning message but it's not as detailed as you suggest. > I think there no needs to be an 'if' to not have a message for devices > in spec. There _is_ such an "if". If the device is in spec then the patch gives a debugging message instead of a warning. If the kernel was build without CONFIG_USB_DEBUG then these debugging message never even get issued. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html