mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
5a6a62bdb9
commit
797ef13716
|
@ -853,6 +853,27 @@ static int wait_serial_change(struct acm *acm, unsigned long arg)
|
||||||
return rv;
|
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,
|
static int acm_tty_ioctl(struct tty_struct *tty,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -869,6 +890,9 @@ static int acm_tty_ioctl(struct tty_struct *tty,
|
||||||
case TIOCMIWAIT:
|
case TIOCMIWAIT:
|
||||||
rv = wait_serial_change(acm, arg);
|
rv = wait_serial_change(acm, arg);
|
||||||
break;
|
break;
|
||||||
|
case TIOCGICOUNT:
|
||||||
|
rv = get_serial_usage(acm, (struct serial_icounter_struct __user *) arg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
Loading…
Reference in New Issue