cp210x.c (46557bef3f3834ac33031c7be27d39d90d507442) | cp210x.c (d94c7bd4c1361cab58a21d530078c5673863dcc2) |
---|---|
1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 36 unchanged lines hidden (view full) --- 45static int cp210x_tiocmget(struct tty_struct *, struct file *); 46static int cp210x_tiocmset(struct tty_struct *, struct file *, 47 unsigned int, unsigned int); 48static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, 49 unsigned int, unsigned int); 50static void cp210x_break_ctl(struct tty_struct *, int); 51static int cp210x_startup(struct usb_serial *); 52static void cp210x_disconnect(struct usb_serial *); | 1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 36 unchanged lines hidden (view full) --- 45static int cp210x_tiocmget(struct tty_struct *, struct file *); 46static int cp210x_tiocmset(struct tty_struct *, struct file *, 47 unsigned int, unsigned int); 48static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, 49 unsigned int, unsigned int); 50static void cp210x_break_ctl(struct tty_struct *, int); 51static int cp210x_startup(struct usb_serial *); 52static void cp210x_disconnect(struct usb_serial *); |
53static void cp210x_dtr_rts(struct usb_serial_port *p, int on); 54static int cp210x_carrier_raised(struct usb_serial_port *p); |
|
53 54static int debug; 55 56static struct usb_device_id id_table [] = { 57 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ 58 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 59 { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ 60 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ --- 77 unchanged lines hidden (view full) --- 138 .open = cp210x_open, 139 .close = cp210x_close, 140 .break_ctl = cp210x_break_ctl, 141 .set_termios = cp210x_set_termios, 142 .tiocmget = cp210x_tiocmget, 143 .tiocmset = cp210x_tiocmset, 144 .attach = cp210x_startup, 145 .disconnect = cp210x_disconnect, | 55 56static int debug; 57 58static struct usb_device_id id_table [] = { 59 { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ 60 { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ 61 { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ 62 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ --- 77 unchanged lines hidden (view full) --- 140 .open = cp210x_open, 141 .close = cp210x_close, 142 .break_ctl = cp210x_break_ctl, 143 .set_termios = cp210x_set_termios, 144 .tiocmget = cp210x_tiocmget, 145 .tiocmset = cp210x_tiocmset, 146 .attach = cp210x_startup, 147 .disconnect = cp210x_disconnect, |
148 .dtr_rts = cp210x_dtr_rts, 149 .carrier_raised = cp210x_carrier_raised |
|
146}; 147 148/* Config request types */ 149#define REQTYPE_HOST_TO_DEVICE 0x41 150#define REQTYPE_DEVICE_TO_HOST 0xc1 151 152/* Config request codes */ 153#define CP210X_IFC_ENABLE 0x00 --- 587 unchanged lines hidden (view full) --- 741 control |= CONTROL_WRITE_DTR; 742 } 743 744 dbg("%s - control = 0x%.4x", __func__, control); 745 746 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 747} 748 | 150}; 151 152/* Config request types */ 153#define REQTYPE_HOST_TO_DEVICE 0x41 154#define REQTYPE_DEVICE_TO_HOST 0xc1 155 156/* Config request codes */ 157#define CP210X_IFC_ENABLE 0x00 --- 587 unchanged lines hidden (view full) --- 745 control |= CONTROL_WRITE_DTR; 746 } 747 748 dbg("%s - control = 0x%.4x", __func__, control); 749 750 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 751} 752 |
753static void cp210x_dtr_rts(struct usb_serial_port *p, int on) 754{ 755 if (on) 756 cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); 757 else 758 cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); 759} 760 |
|
749static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 750{ 751 struct usb_serial_port *port = tty->driver_data; 752 unsigned int control; 753 int result; 754 755 dbg("%s - port %d", __func__, port->number); 756 --- 6 unchanged lines hidden (view full) --- 763 |((control & CONTROL_RING)? TIOCM_RI : 0) 764 |((control & CONTROL_DCD) ? TIOCM_CD : 0); 765 766 dbg("%s - control = 0x%.2x", __func__, control); 767 768 return result; 769} 770 | 761static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) 762{ 763 struct usb_serial_port *port = tty->driver_data; 764 unsigned int control; 765 int result; 766 767 dbg("%s - port %d", __func__, port->number); 768 --- 6 unchanged lines hidden (view full) --- 775 |((control & CONTROL_RING)? TIOCM_RI : 0) 776 |((control & CONTROL_DCD) ? TIOCM_CD : 0); 777 778 dbg("%s - control = 0x%.2x", __func__, control); 779 780 return result; 781} 782 |
783static int cp210x_carrier_raised(struct usb_serial_port *p) 784{ 785 unsigned int control; 786 cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); 787 if (control & CONTROL_DCD) 788 return 1; 789 return 0; 790} 791 |
|
771static void cp210x_break_ctl (struct tty_struct *tty, int break_state) 772{ 773 struct usb_serial_port *port = tty->driver_data; 774 unsigned int state; 775 776 dbg("%s - port %d", __func__, port->number); 777 if (break_state == 0) 778 state = BREAK_OFF; --- 61 unchanged lines hidden --- | 792static void cp210x_break_ctl (struct tty_struct *tty, int break_state) 793{ 794 struct usb_serial_port *port = tty->driver_data; 795 unsigned int state; 796 797 dbg("%s - port %d", __func__, port->number); 798 if (break_state == 0) 799 state = BREAK_OFF; --- 61 unchanged lines hidden --- |