summaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2013-11-20 11:35:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-03 10:23:46 -0800
commit797ef13716ce05d26c5be12893ca75b2b003f25f (patch)
treebd444783d6364f9dd02a5a59c0e7c139b4da6ef1 /drivers/usb/class
parent5a6a62bdb9257aa74ab0ad2b2c8a33b0f9b17ce4 (diff)
cdc-acm: add TIOCGICOUNT
Simple straightforward implementation. Just returning the statistics gathered for TIOCMIWAIT Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/cdc-acm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 7c0051710a0..92e28ecda83 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -853,6 +853,27 @@ static int wait_serial_change(struct acm *acm, unsigned long arg)
return rv;
}
+static int get_serial_usage(struct acm *acm,
+ struct serial_icounter_struct __user *count)
+{
+ struct serial_icounter_struct icount;
+ int rv = 0;
+
+ memset(&icount, 0, sizeof(icount));
+ icount.dsr = acm->iocount.dsr;
+ icount.rng = acm->iocount.rng;
+ icount.dcd = acm->iocount.dcd;
+ icount.frame = acm->iocount.frame;
+ icount.overrun = acm->iocount.overrun;
+ icount.parity = acm->iocount.parity;
+ icount.brk = acm->iocount.brk;
+
+ if (copy_to_user(count, &icount, sizeof(icount)) > 0)
+ rv = -EFAULT;
+
+ return rv;
+}
+
static int acm_tty_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
@@ -869,6 +890,9 @@ static int acm_tty_ioctl(struct tty_struct *tty,
case TIOCMIWAIT:
rv = wait_serial_change(acm, arg);
break;
+ case TIOCGICOUNT:
+ rv = get_serial_usage(acm, (struct serial_icounter_struct __user *) arg);
+ break;
}
return rv;