Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: cdc-acm: add PPS support

This patch adds support for PPS to CDC devices. Changes to the DCD pin
are monitored and passed to the ldisc system, which is used by
pps-ldisc.

Signed-off-by: Dan Drown <dan-netdev@drown.org>
Link: https://lore.kernel.org/r/ZM8ExV6bAvJtIA1d@vps3.drown.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Drown and committed by
Greg Kroah-Hartman
3b563b90 d9216d3e

+11 -1
+11 -1
drivers/usb/class/cdc-acm.c
··· 28 28 #include <linux/serial.h> 29 29 #include <linux/tty_driver.h> 30 30 #include <linux/tty_flip.h> 31 + #include <linux/tty_ldisc.h> 31 32 #include <linux/module.h> 32 33 #include <linux/mutex.h> 33 34 #include <linux/uaccess.h> ··· 325 324 326 325 if (difference & USB_CDC_SERIAL_STATE_DSR) 327 326 acm->iocount.dsr++; 328 - if (difference & USB_CDC_SERIAL_STATE_DCD) 327 + if (difference & USB_CDC_SERIAL_STATE_DCD) { 328 + if (acm->port.tty) { 329 + struct tty_ldisc *ld = tty_ldisc_ref(acm->port.tty); 330 + if (ld) { 331 + if (ld->ops->dcd_change) 332 + ld->ops->dcd_change(acm->port.tty, newctrl & USB_CDC_SERIAL_STATE_DCD); 333 + tty_ldisc_deref(ld); 334 + } 335 + } 329 336 acm->iocount.dcd++; 337 + } 330 338 if (newctrl & USB_CDC_SERIAL_STATE_BREAK) { 331 339 acm->iocount.brk++; 332 340 tty_insert_flip_char(&acm->port, 0, TTY_BREAK);