Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598737

[PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk

From Samuel Thibault <samuel.thibault@ens-lyon.org>
Newsgroups linux.kernel
Subject [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk
Date 2017-03-12 21:20 +0100
Message-ID <tki89-6tx-1@gated-at.bofh.it> (permalink)
Organization I am not organized

Show all headers | View raw


Some USB 2.0 devices erroneously report millisecond values in
bInterval. The generic config code manages to catch most of them,
but in some cases it's not completely enough.

The case at stake here is a USB 2.0 braille device, which wants to
announce 10ms and thus sets bInterval to 10, but with the USB 2.0
computation that yields to 64ms.  It happens that one can type fast
enough to reach this interval and get the device buffers overflown,
leading to problematic latencies.  The generic config code does not
catch this case because the 64ms is considered a sane enough value.

This change thus adds a USB_QUIRK_MS_INTR_BINTERVAL quirk to mark
devices which actually report milliseconds in bInterval, and marks
Vario Ultra devices as needing it.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -50,4 +50,10 @@
 /* device can't handle Link Power Management */
 #define USB_QUIRK_NO_LPM			BIT(10)
 
+/*
+ * Device reports its bInterval as milliseconds instead of the
+ * USB 2.0 calculation.
+ */
+#define USB_QUIRK_MS_INTR_BINTERVAL		BIT(11)
+
 #endif /* __LINUX_USB_QUIRKS_H */
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -280,6 +280,14 @@ static int usb_parse_endpoint(struct dev
 
 			/*
 			 * Adjust bInterval for quirked devices.
+			 */
+			/*
+			 * This quirk fixes bIntervals reported in ms.
+			 */
+			if (to_usb_device(ddev)->quirks &
+				USB_QUIRK_MS_INTR_BINTERVAL)
+				i = j = n;
+			/*
 			 * This quirk fixes bIntervals reported in
 			 * linear microframes.
 			 */
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -218,6 +218,14 @@ static const struct usb_device_id usb_qu
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Baum Vario Ultra */
+	{ USB_DEVICE(0x0904, 0x6101), .driver_info =
+			USB_QUIRK_MS_INTR_BINTERVAL },
+	{ USB_DEVICE(0x0904, 0x6102), .driver_info =
+			USB_QUIRK_MS_INTR_BINTERVAL },
+	{ USB_DEVICE(0x0904, 0x6103), .driver_info =
+			USB_QUIRK_MS_INTR_BINTERVAL },
+
 	{ }  /* terminating entry must be last */
 };
 

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Samuel Thibault <samuel.thibault@ens-lyon.org> - 2017-03-12 21:20 +0100
  Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Alan Stern <stern@rowland.harvard.edu> - 2017-03-12 22:20 +0100
    Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Samuel Thibault <samuel.thibault@ens-lyon.org> - 2017-03-12 22:50 +0100
    Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Dave Mielke <dave@mielke.cc> - 2017-03-12 23:00 +0100
      Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Alan Stern <stern@rowland.harvard.edu> - 2017-03-13 02:40 +0100
        Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Dave Mielke <dave@mielke.cc> - 2017-03-13 02:50 +0100
          Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Alan Stern <stern@rowland.harvard.edu> - 2017-03-13 02:50 +0100
            Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Samuel Thibault <samuel.thibault@ens-lyon.org> - 2017-03-13 08:10 +0100
              Re: [PATCH] usb-core: Add MS_INTR_BINTERVAL USB quirk Alan Stern <stern@rowland.harvard.edu> - 2017-03-14 02:50 +0100

csiph-web