On Fri, 23 Mar 2012, Oliver Neukum wrote: > Hi, > > it turns out that there are a lot of broken HP printers. > The key to make them work well should be to disable polling > while printing in hp-lib. (It is switched on only by udev in the > first place) > > Nevertheless the harmful commands may come from user space, > so we need to do something about that. > > Given the number of affected devices I refrained from bloating the > quirks table and coded a heuristics. What do you think? Have you tested this? I'm doubtful about how well it will work in practice. Many mass-storage devices don't implement the class-specific reset properly. > diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c > index db51ba1..8a53a78 100644 > --- a/drivers/usb/storage/usb.c > +++ b/drivers/usb/storage/usb.c > @@ -585,6 +585,16 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, > msgs[msg], > utsname()->release); > } > + /* a collective workaround for buggy HP printer+storage combos */ > + if (id->idVendor == 0x03f0) > + if (dev->actconfig->desc.bNumInterfaces > 1) > + for (int i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { > + struct usb_interface *intf = config->interface[i]; > + if (intf->cur_altsetting->desc->bInterfaceClass == 7) { > + us->fflags |= USB_QUIRK_RESET_MORPHS; > + break; > + } > + } How about using symbolic constants instead of 0x03f0 and 7? And including a blank line between the declaration and the following executable statement? Also, why use udev->actconfig in one place and config in another? 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