ssu100.c (fa251f89903d73989e2f63e13d0eaed1e07ce0da) ssu100.c (0bca1b913affbd7e2fdaffee62a499659a466eb5)
1/*
2 * usb-serial driver for Quatech SSU-100
3 *
4 * based on ftdi_sio.c and the original serqt_usb.c from Quatech
5 *
6 */
7
8#include <linux/errno.h>

--- 402 unchanged lines hidden (view full) ---

411 (arg & TIOCM_DSR && (prev.dsr != cur.dsr)) ||
412 (arg & TIOCM_CD && (prev.dcd != cur.dcd)) ||
413 (arg & TIOCM_CTS && (prev.cts != cur.cts)))
414 return 0;
415 }
416 return 0;
417}
418
1/*
2 * usb-serial driver for Quatech SSU-100
3 *
4 * based on ftdi_sio.c and the original serqt_usb.c from Quatech
5 *
6 */
7
8#include <linux/errno.h>

--- 402 unchanged lines hidden (view full) ---

411 (arg & TIOCM_DSR && (prev.dsr != cur.dsr)) ||
412 (arg & TIOCM_CD && (prev.dcd != cur.dcd)) ||
413 (arg & TIOCM_CTS && (prev.cts != cur.cts)))
414 return 0;
415 }
416 return 0;
417}
418
419static int ssu100_get_icount(struct tty_struct *tty,
420 struct serial_icounter_struct *icount)
421{
422 struct usb_serial_port *port = tty->driver_data;
423 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
424 struct async_icount cnow = priv->icount;
425
426 icount->cts = cnow.cts;
427 icount->dsr = cnow.dsr;
428 icount->rng = cnow.rng;
429 icount->dcd = cnow.dcd;
430 icount->rx = cnow.rx;
431 icount->tx = cnow.tx;
432 icount->frame = cnow.frame;
433 icount->overrun = cnow.overrun;
434 icount->parity = cnow.parity;
435 icount->brk = cnow.brk;
436 icount->buf_overrun = cnow.buf_overrun;
437
438 return 0;
439}
440
441
442
419static int ssu100_ioctl(struct tty_struct *tty, struct file *file,
420 unsigned int cmd, unsigned long arg)
421{
422 struct usb_serial_port *port = tty->driver_data;
423 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
424 void __user *user_arg = (void __user *)arg;
425
426 dbg("%s cmd 0x%04x", __func__, cmd);
427
428 switch (cmd) {
429 case TIOCGSERIAL:
430 return get_serial_info(port,
431 (struct serial_struct __user *) arg);
432
433 case TIOCMIWAIT:
434 return wait_modem_info(port, arg);
435
443static int ssu100_ioctl(struct tty_struct *tty, struct file *file,
444 unsigned int cmd, unsigned long arg)
445{
446 struct usb_serial_port *port = tty->driver_data;
447 struct ssu100_port_private *priv = usb_get_serial_port_data(port);
448 void __user *user_arg = (void __user *)arg;
449
450 dbg("%s cmd 0x%04x", __func__, cmd);
451
452 switch (cmd) {
453 case TIOCGSERIAL:
454 return get_serial_info(port,
455 (struct serial_struct __user *) arg);
456
457 case TIOCMIWAIT:
458 return wait_modem_info(port, arg);
459
436 case TIOCGICOUNT:
437 {
438 struct serial_icounter_struct icount;
439 struct async_icount cnow = priv->icount;
440 memset(&icount, 0, sizeof(icount));
441 icount.cts = cnow.cts;
442 icount.dsr = cnow.dsr;
443 icount.rng = cnow.rng;
444 icount.dcd = cnow.dcd;
445 icount.rx = cnow.rx;
446 icount.tx = cnow.tx;
447 icount.frame = cnow.frame;
448 icount.overrun = cnow.overrun;
449 icount.parity = cnow.parity;
450 icount.brk = cnow.brk;
451 icount.buf_overrun = cnow.buf_overrun;
452 if (copy_to_user(user_arg, &icount, sizeof(icount)))
453 return -EFAULT;
454 return 0;
455 }
456
457 default:
458 break;
459 }
460
461 dbg("%s arg not supported", __func__);
462
463 return -ENOIOCTLCMD;
464}

--- 256 unchanged lines hidden (view full) ---

721 .open = ssu100_open,
722 .close = ssu100_close,
723 .attach = ssu100_attach,
724 .release = ssu100_release,
725 .dtr_rts = ssu100_dtr_rts,
726 .process_read_urb = ssu100_process_read_urb,
727 .tiocmget = ssu100_tiocmget,
728 .tiocmset = ssu100_tiocmset,
460 default:
461 break;
462 }
463
464 dbg("%s arg not supported", __func__);
465
466 return -ENOIOCTLCMD;
467}

--- 256 unchanged lines hidden (view full) ---

724 .open = ssu100_open,
725 .close = ssu100_close,
726 .attach = ssu100_attach,
727 .release = ssu100_release,
728 .dtr_rts = ssu100_dtr_rts,
729 .process_read_urb = ssu100_process_read_urb,
730 .tiocmget = ssu100_tiocmget,
731 .tiocmset = ssu100_tiocmset,
732 .get_icount = ssu100_get_icount,
729 .ioctl = ssu100_ioctl,
730 .set_termios = ssu100_set_termios,
731 .disconnect = usb_serial_generic_disconnect,
732};
733
734static int __init ssu100_init(void)
735{
736 int retval;

--- 38 unchanged lines hidden ---
733 .ioctl = ssu100_ioctl,
734 .set_termios = ssu100_set_termios,
735 .disconnect = usb_serial_generic_disconnect,
736};
737
738static int __init ssu100_init(void)
739{
740 int retval;

--- 38 unchanged lines hidden ---