Linux USB
 help / color / mirror / Atom feed
* [PATCH] USB: cdc-acm: start bulk-IN polling when ALWAYS_POLL_CTRL is set
@ 2026-05-15 13:04 Dave Carey
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Carey @ 2026-05-15 13:04 UTC (permalink / raw)
  To: linux-usb; +Cc: gregkh, oneukum, guanwentao, Dave Carey

The INGENIC 17EF:6161 touchscreen composite device has a ~55-second
watchdog that resets the USB device if the bulk-IN endpoint on the CDC
data interface goes unread.  The existing ALWAYS_POLL_CTRL quirk keeps
the notification endpoint (ctrlurb / EP 0x82) polling continuously, but
that alone is insufficient: the firmware monitors bulk-IN activity, not
just notification-endpoint activity.

Add acm_submit_read_urbs() calls to the two ALWAYS_POLL_CTRL paths that
already restart the ctrlurb:

  1. acm_probe(): start bulk reads at probe time alongside the ctrlurb,
     so the watchdog is satisfied from first bind without requiring a
     userspace process to open /dev/ttyACMn.

  2. acm_port_shutdown(): restart bulk reads after port close alongside
     the ctrlurb restart, so the watchdog keeps running when the last
     TTY user closes the port.

acm_read_bulk_callback() already resubmits each URB unconditionally on
normal completion, so once submitted the reads remain active until an
explicit kill (disconnect, suspend).  acm_submit_read_urb() is a no-op
for URBs that are already in flight (read_urbs_free bit clear), so the
existing acm_port_activate() call remains correct and races are avoided.

Tested on Lenovo Yoga Book 9 14IAH10 (83KJ): without this patch the
device resets every ~55 s when no TTY is open; with it the device
remains stable indefinitely.

Signed-off-by: Dave Carey <carvsdriver@gmail.com>
Tested-by: Dave Carey <carvsdriver@gmail.com>
---
This follows commit f58752ebcb35 ("USB: CDC-ACM: add INGENIC 17EF:6161
quirk for Yoga Book 9 14IAH10"), which added ALWAYS_POLL_CTRL to keep
the ctrlurb active.  That commit addressed the notification-endpoint
watchdog (~20 s).  This patch addresses a second watchdog that fires
when bulk-IN data goes unread for ~55 s.

This patch is based on top of Wentao Guan's pending fix
("USB: cdc-acm: fix misplaced quirk defines and BIT(9) collision") which
moves VENDOR_CLASS_DATA_IFACE and ALWAYS_POLL_CTRL from inside
acm_ctrl_msg() to cdc-acm.h and reassigns them to BIT(10)/BIT(11) to
avoid the NO_UNION_12 collision.  The bulk-IN additions here are
independent of that renumbering and apply cleanly to either base, but
the combined tree is the correct target once Wentao's fix merges.

 drivers/usb/class/cdc-acm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -797,6 +797,9 @@ static void acm_port_shutdown(struct tty_port *port)
 			"ctrl polling restart failed after port close\n");
 		/* port_shutdown() cleared DTR/RTS; restore them */
 		acm_set_control(acm, USB_CDC_CTRL_DTR | USB_CDC_CTRL_RTS);
+		if (acm_submit_read_urbs(acm, GFP_KERNEL))
+			dev_dbg(&acm->control->dev,
+				"read urb restart failed after port close\n");
 	}
 }

@@ -1564,6 +1567,9 @@ static int acm_probe(struct usb_interface *intf,
 		if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL))
 			dev_warn(&intf->dev,
 				 "failed to start persistent ctrl polling\n");
+		if (acm_submit_read_urbs(acm, GFP_KERNEL))
+			dev_warn(&intf->dev,
+				 "failed to start persistent bulk read polling\n");
 	}

 	return 0;
--
2.47.0

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] USB: cdc-acm: start bulk-IN polling when ALWAYS_POLL_CTRL is set
@ 2026-05-15 14:19 Dave Carey
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Carey @ 2026-05-15 14:19 UTC (permalink / raw)
  To: linux-usb; +Cc: Dave Carey, gregkh, oneukum, guanwentao

The INGENIC 17EF:6161 touchscreen composite device has a ~55-second
watchdog that resets the USB device if the bulk-IN endpoint on the CDC
data interface goes unread.  The existing ALWAYS_POLL_CTRL quirk keeps
the notification endpoint (ctrlurb / EP 0x82) polling continuously, but
that alone is insufficient: the firmware monitors bulk-IN activity, not
just notification-endpoint activity.

Add acm_submit_read_urbs() calls to the two ALWAYS_POLL_CTRL paths that
already restart the ctrlurb:

  1. acm_probe(): start bulk reads at probe time alongside the ctrlurb,
     so the watchdog is satisfied from first bind without requiring a
     userspace process to open /dev/ttyACMn.

  2. acm_port_shutdown(): restart bulk reads after port close alongside
     the ctrlurb restart, so the watchdog keeps running when the last
     TTY user closes the port.

acm_read_bulk_callback() already resubmits each URB unconditionally on
normal completion, so once submitted the reads remain active until an
explicit kill (disconnect, suspend).  acm_submit_read_urb() is a no-op
for URBs that are already in flight (read_urbs_free bit clear), so the
existing acm_port_activate() call remains correct and races are avoided.

Tested on Lenovo Yoga Book 9 14IAH10 (83KJ): without this patch the
device resets every ~55 s when no TTY is open; with it the device
remains stable indefinitely.

Signed-off-by: Dave Carey <carvsdriver@gmail.com>
Tested-by: Dave Carey <carvsdriver@gmail.com>
---
This follows commit f58752ebcb35 ("USB: CDC-ACM: add INGENIC 17EF:6161
quirk for Yoga Book 9 14IAH10"), which added ALWAYS_POLL_CTRL to keep
the ctrlurb active.  That commit addressed the notification-endpoint
watchdog (~20 s).  This patch addresses a second watchdog that fires
when bulk-IN data goes unread for ~55 s.

This patch is based on top of Wentao Guan's pending fix
("USB: cdc-acm: fix misplaced quirk defines and BIT(9) collision") which
moves VENDOR_CLASS_DATA_IFACE and ALWAYS_POLL_CTRL from inside
acm_ctrl_msg() to cdc-acm.h and reassigns them to BIT(10)/BIT(11) to
avoid the NO_UNION_12 collision.  The bulk-IN additions here are
independent of that renumbering and apply cleanly to either base, but
the combined tree is the correct target once Wentao's fix merges.

 drivers/usb/class/cdc-acm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 54059e4..0c6cdf5 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -799,6 +799,9 @@ static void acm_port_shutdown(struct tty_port *port)
 				"ctrl polling restart failed after port close\n");
 		/* port_shutdown() cleared DTR/RTS; restore them */
 		acm_set_control(acm, USB_CDC_CTRL_DTR | USB_CDC_CTRL_RTS);
+		if (acm_submit_read_urbs(acm, GFP_KERNEL))
+			dev_dbg(&acm->control->dev,
+				"read urb restart failed after port close\n");
 	}
 }
 
@@ -1566,6 +1569,9 @@ skip_countries:
 		if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL))
 			dev_warn(&intf->dev,
 				 "failed to start persistent ctrl polling\n");
+		if (acm_submit_read_urbs(acm, GFP_KERNEL))
+			dev_warn(&intf->dev,
+				 "failed to start persistent bulk read polling\n");
 	}
 
 	return 0;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-15 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CALPvROTsnvWJZVmW6L_gdF5_Pv4ic3gKbAKYyyC_-n0mffmnAg@mail.gmail.com>
2026-05-15  5:58 ` [PATCH] USB: cdc-acm: start bulk-IN polling when ALWAYS_POLL_CTRL is set Greg KH
2026-05-15 13:04 Dave Carey
  -- strict thread matches above, loose matches on Subject: below --
2026-05-15 14:19 Dave Carey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox