]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
USB: cdc-acm: start bulk-IN polling when ALWAYS_POLL_CTRL is set
authorDave Carey <carvsdriver@gmail.com>
Fri, 15 May 2026 14:19:40 +0000 (10:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 May 2026 09:34:52 +0000 (11:34 +0200)
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>
Link: https://patch.msgid.link/20260515141940.751397-1-carvsdriver@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c

index 54059e4fc6ed72dc2dcff35fb59fc9c45ef13bde..0c6cdf5532060f1dfd0a4b9ade4e1a79cc8c8e03 100644 (file)
@@ -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;