From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Nix <nix@esperi.org.uk>,
Paul Martin <pm@debian.org>,
Daniel Silverstone <dsilvers@debian.org>,
Oliver Neukum <oneukum@suse.de>,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable <stable@vger.kernel.org>
Subject: [PATCH] USB: cdc-acm: add quirk for control-line state requests
Date: Thu, 6 Nov 2014 18:08:33 +0100 [thread overview]
Message-ID: <1415293713-3051-1-git-send-email-johan@kernel.org> (raw)
In-Reply-To: <20141106170456.GC26196@localhost>
Add new quirk for devices that cannot handle control-line state
requests.
Note that we currently send these requests to all devices, regardless of
whether they claim to support it, but that errors are only logged if
support is claimed.
Since commit 0943d8ead30e ("USB: cdc-acm: use tty-port dtr_rts"), which
only changed the timings for these requests slightly, this has been
reported to cause occasional firmware crashes on Simtec Electronics
Entropy Key devices after re-enumeration. Enable the quirk for this
device.
Reported-by: Nix <nix@esperi.org.uk>
Tested-by: Nix <nix@esperi.org.uk>
Cc: stable <stable@vger.kernel.org> # v3.16
Signed-off-by: Johan Hovold <johan@kernel.org>
---
Greg,
I believe this should into v3.18 as it fixes a reported regression with
these devices.
Johan
drivers/usb/class/cdc-acm.c | 14 ++++++++++++--
drivers/usb/class/cdc-acm.h | 2 ++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 9d6495424b06..077d58ac3dcb 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -148,8 +148,15 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value,
/* devices aren't required to support these requests.
* the cdc acm descriptor tells whether they do...
*/
-#define acm_set_control(acm, control) \
- acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0)
+static inline int acm_set_control(struct acm *acm, int control)
+{
+ if (acm->quirks & QUIRK_CONTROL_LINE_STATE)
+ return -EOPNOTSUPP;
+
+ return acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE,
+ control, NULL, 0);
+}
+
#define acm_set_line(acm, line) \
acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line))
#define acm_send_break(acm, ms) \
@@ -1320,6 +1327,7 @@ made_compressed_probe:
tty_port_init(&acm->port);
acm->port.ops = &acm_port_ops;
init_usb_anchor(&acm->delayed);
+ acm->quirks = quirks;
buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
if (!buf) {
@@ -1687,6 +1695,8 @@ static const struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},
+ { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */
+ .driver_info = QUIRK_CONTROL_LINE_STATE, },
{ USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */
{ USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
},
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index fc75651afe1c..d3251ebd09e2 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -121,6 +121,7 @@ struct acm {
unsigned int throttle_req:1; /* throttle requested */
u8 bInterval;
struct usb_anchor delayed; /* writes queued for a device about to be woken */
+ unsigned long quirks;
};
#define CDC_DATA_INTERFACE_TYPE 0x0a
@@ -132,3 +133,4 @@ struct acm {
#define NOT_A_MODEM BIT(3)
#define NO_DATA_INTERFACE BIT(4)
#define IGNORE_DEVICE BIT(5)
+#define QUIRK_CONTROL_LINE_STATE BIT(6)
--
2.0.4
next prev parent reply other threads:[~2014-11-06 17:13 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-31 23:07 [3.16.1 REGRESSION]: Simtec Entropy Key (cdc-acm) broken in 3.16 Nix
2014-09-01 11:09 ` Oliver Neukum
2014-09-04 23:40 ` Nix
2014-09-05 7:59 ` Oliver Neukum
2014-09-05 15:17 ` Nix
2014-09-08 7:21 ` Oliver Neukum
2014-09-08 7:58 ` Nix
2014-10-11 19:05 ` [3.16.1 BISECTED " Nix
2014-10-11 19:51 ` Paul Martin
2014-10-11 22:24 ` Nix
2014-10-12 11:14 ` Paul Martin
2014-10-12 18:58 ` Johan Hovold
2014-10-12 21:36 ` Nix
2014-10-14 8:34 ` Johan Hovold
2014-10-14 14:44 ` Nix
2014-10-17 13:21 ` Nix
2014-10-19 13:45 ` Johan Hovold
2014-10-22 9:31 ` Nix
2014-10-22 10:14 ` Johan Hovold
2014-10-22 14:00 ` Nix
2014-10-22 15:36 ` Nix
2014-10-24 11:14 ` Johan Hovold
2014-10-24 15:08 ` Nix
2014-10-31 16:44 ` Nix
2014-11-05 11:56 ` Johan Hovold
2014-11-05 15:14 ` Nix
2014-11-05 15:46 ` Daniel Silverstone
2014-11-05 18:14 ` Johan Hovold
2014-11-06 13:49 ` Nix
2014-11-06 17:04 ` Johan Hovold
2014-11-06 17:08 ` Johan Hovold [this message]
2014-11-07 9:05 ` [PATCH] USB: cdc-acm: add quirk for control-line state requests Oliver Neukum
2014-11-07 9:16 ` Johan Hovold
2014-11-07 10:23 ` Oliver Neukum
2014-11-06 17:14 ` [3.16.1 BISECTED REGRESSION]: Simtec Entropy Key (cdc-acm) broken in 3.16 Nix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415293713-3051-1-git-send-email-johan@kernel.org \
--to=johan@kernel.org \
--cc=dsilvers@debian.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nix@esperi.org.uk \
--cc=oneukum@suse.de \
--cc=pm@debian.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).