[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YASuqbvHyxvPzqhP@watson>
Date: Sun, 17 Jan 2021 15:39:53 -0600
From: Jeremy Figgins <kernel@...emyfiggins.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag
Certain devices such as Winbond Virtual Com Port,
which is used in some usb printers, will stop
responding after the usb_control_msg_send()
calls in usb_set_interface(). These devices work
fine without having usb_set_interface() called, so
this flag prevents that call.
The naming is designed to mirror the existing
USB_QUIRK_NO_SET_INTF flag, but that flag is
not sufficient to make these devices work.
Signed-off-by: Jeremy Figgins <kernel@...emyfiggins.com>
---
drivers/usb/class/usblp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 134dc2005ce9..6e2d58813d7d 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -209,6 +209,7 @@ struct quirk_printer_struct {
#define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */
#define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */
#define USBLP_QUIRK_BAD_CLASS 0x4 /* descriptor uses vendor-specific Class or SubClass */
+#define USBLP_QUIRK_NO_SET_INTF 0x8 /* device can't handle Set-Interface requests */
static const struct quirk_printer_struct quirk_printers[] = {
{ 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */
@@ -227,6 +228,7 @@ static const struct quirk_printer_struct quirk_printers[] = {
{ 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@....de> */
{ 0x04f9, 0x000d, USBLP_QUIRK_BIDIR }, /* Brother Industries, Ltd HL-1440 Laser Printer */
{ 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt Printer M129C */
+ { 0x0416, 0x5011, USBLP_QUIRK_NO_SET_INTF }, /* Winbond Electronics Corp. Virtual Com Port */
{ 0, 0 }
};
@@ -1332,7 +1334,11 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
alts = usblp->protocol[protocol].alt_setting;
if (alts < 0)
return -EINVAL;
- r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
+ if (usblp->quirks & USBLP_QUIRK_NO_SET_INTF) {
+ r = 0;
+ } else {
+ r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
+ }
if (r < 0) {
printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",
alts, usblp->ifnum);
--
2.29.0
Powered by blists - more mailing lists