Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: add quirk to avoid config and interface strings

Apparently the Configuration and Interface strings aren't used as
often as the Vendor, Product, and Serial strings. In at least one
device (a Saitek Cyborg Gold 3D joystick), attempts to read the
Configuration string cause the device to stop responding to Control
requests.

This patch (as1226) adds a quirks flag, telling the kernel not to
read a device's Configuration or Interface strings, together with a
new quirk for the offending joystick.

Reported-by: Melchior FRANZ <melchior.franz@gmail.com>
Tested-by: Melchior FRANZ <melchior.franz@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org> [2.6.28 and 2.6.29, nothing earlier]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
1662e3a7 8e0ee43b

+12 -2
+2 -1
drivers/usb/core/message.c
··· 1719 1719 } 1720 1720 kfree(new_interfaces); 1721 1721 1722 - if (cp->string == NULL) 1722 + if (cp->string == NULL && 1723 + !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) 1723 1724 cp->string = usb_cache_string(dev, cp->desc.iConfiguration); 1724 1725 1725 1726 /* Now that all the interfaces are set up, register them
+4
drivers/usb/core/quirks.c
··· 54 54 { USB_DEVICE(0x0638, 0x0a13), .driver_info = 55 55 USB_QUIRK_STRING_FETCH_255 }, 56 56 57 + /* Saitek Cyborg Gold Joystick */ 58 + { USB_DEVICE(0x06a3, 0x0006), .driver_info = 59 + USB_QUIRK_CONFIG_INTF_STRINGS }, 60 + 57 61 /* M-Systems Flash Disk Pioneers */ 58 62 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, 59 63
+3 -1
drivers/usb/core/sysfs.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/string.h> 15 15 #include <linux/usb.h> 16 + #include <linux/usb/quirks.h> 16 17 #include "usb.h" 17 18 18 19 /* Active configuration fields */ ··· 814 813 if (intf->sysfs_files_created || intf->unregistering) 815 814 return 0; 816 815 817 - if (alt->string == NULL) 816 + if (alt->string == NULL && 817 + !(udev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) 818 818 alt->string = usb_cache_string(udev, alt->desc.iInterface); 819 819 if (alt->string) 820 820 retval = device_create_file(&intf->dev, &dev_attr_interface);
+3
include/linux/usb/quirks.h
··· 16 16 /* device can't handle Set-Interface requests */ 17 17 #define USB_QUIRK_NO_SET_INTF 0x00000004 18 18 19 + /* device can't handle its Configuration or Interface strings */ 20 + #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 21 + 19 22 #endif /* __LINUX_USB_QUIRKS_H */