From: Alan Cox Date: Tue, 22 Jul 2008 10:11:23 +0000 (+0100) Subject: ftdi_sio: Coding style X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=464cbb24698ddb7bf24b2b73204e3dc121886211;p=openwrt%2Fstaging%2Fblogic.git ftdi_sio: Coding style Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index abbb447e5375..838717250145 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -12,7 +12,8 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * See http://ftdi-usb-sio.sourceforge.net for upto date testing info * and extra documentation @@ -25,7 +26,8 @@ /* Bill Ryder - bryder@sgi.com - wrote the FTDI_SIO implementation */ /* Thanx to FTDI for so kindly providing details of the protocol required */ /* to talk to the device */ -/* Thanx to gkh and the rest of the usb dev group for all code I have assimilated :-) */ +/* Thanx to gkh and the rest of the usb dev group for all code I have + assimilated :-) */ #include #include @@ -36,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,17 +57,22 @@ static __u16 product; struct ftdi_private { ftdi_chip_type_t chip_type; - /* type of the device, either SIO or FT8U232AM */ + /* type of device, either SIO or FT8U232AM */ int baud_base; /* baud base clock for divisor setting */ - int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */ + int custom_divisor; /* custom_divisor kludge, this is for + baud_base (different from what goes to the + chip!) */ __u16 last_set_data_urb_value ; - /* the last data state set - needed for doing a break */ - int write_offset; /* This is the offset in the usb data block to write the serial data - - * it is different between devices + /* the last data state set - needed for doing + * a break + */ + int write_offset; /* This is the offset in the usb data block to + * write the serial data - it varies between + * devices */ int flags; /* some ASYNC_xxxx flags are supported */ unsigned long last_dtr_rts; /* saved modem control outputs */ - wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ + wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ char prev_status, diff_status; /* Used for TIOCMIWAIT */ __u8 rx_flags; /* receive state flags (throttling) */ spinlock_t rx_lock; /* spinlock for receive state */ @@ -76,8 +83,10 @@ struct ftdi_private { __u16 interface; /* FT2232C port interface (0 for FT232/245) */ - speed_t force_baud; /* if non-zero, force the baud rate to this value */ - int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ + speed_t force_baud; /* if non-zero, force the baud rate to + this value */ + int force_rtscts; /* if non-zero, force RTS-CTS to always + be enabled */ spinlock_t tx_lock; /* spinlock for transmit state */ unsigned long tx_bytes; @@ -88,13 +97,14 @@ struct ftdi_private { /* struct ftdi_sio_quirk is used by devices requiring special attention. */ struct ftdi_sio_quirk { int (*probe)(struct usb_serial *); - void (*port_probe)(struct ftdi_private *); /* Special settings for probed ports. */ + /* Special settings for probed ports. */ + void (*port_probe)(struct ftdi_private *); }; -static int ftdi_jtag_probe (struct usb_serial *serial); -static int ftdi_mtxorb_hack_setup (struct usb_serial *serial); -static void ftdi_USB_UIRT_setup (struct ftdi_private *priv); -static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv); +static int ftdi_jtag_probe(struct usb_serial *serial); +static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); +static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); +static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); static struct ftdi_sio_quirk ftdi_jtag_quirk = { .probe = ftdi_jtag_probe, @@ -174,270 +184,270 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0100_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0101_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0102_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0103_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0104_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0105_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0106_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0107_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0108_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0109_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0110_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0111_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0112_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0113_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0114_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0115_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0116_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0117_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0118_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0119_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0120_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0121_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0122_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0123_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0124_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0125_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0126_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0127_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0103_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0104_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0105_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0106_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0107_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0108_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0109_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0110_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0111_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0112_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0113_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0114_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0115_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0116_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0117_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0118_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0119_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0120_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0121_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0122_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0123_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0128_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0129_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012C_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0130_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0131_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0132_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0133_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0134_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0135_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0136_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0137_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0138_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0139_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0140_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0141_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0142_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0143_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0144_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0145_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0146_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0147_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0148_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0149_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0150_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0151_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0152_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0153_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0130_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0131_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0132_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0133_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0134_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0135_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0136_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0137_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0138_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0139_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0140_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0141_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0142_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0143_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0144_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0145_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0146_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0147_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0148_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0149_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0154_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0155_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0156_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0157_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0158_PID), + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID), .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0159_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0160_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0161_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0162_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0163_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0164_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0165_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0166_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0167_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0168_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0169_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0170_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0171_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0172_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0173_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0174_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0175_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0176_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0177_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0178_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0179_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0180_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0181_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0182_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0183_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0184_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0185_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0186_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0187_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0188_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0189_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0190_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0191_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0192_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0193_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0194_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0195_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0196_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0197_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0198_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0199_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019A_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019B_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019C_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019D_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019E_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019F_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AD_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AF_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BD_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BF_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CD_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CF_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DD_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DF_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01ED_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EF_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F0_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F1_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F2_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F3_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F4_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F5_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F6_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F7_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F8_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F9_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FA_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FB_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FC_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FD_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FE_PID) }, - { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0160_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0161_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0162_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0163_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0164_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0165_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0166_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0167_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0168_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0169_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0170_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0171_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0172_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0173_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0174_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0175_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0176_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0177_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0178_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0179_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0180_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0181_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0182_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0183_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0184_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0185_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0186_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0187_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0188_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0189_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0190_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0191_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0192_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0193_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0194_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0195_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0196_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0197_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0198_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0199_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019A_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019B_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019C_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019D_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019E_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019F_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AD_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BD_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CD_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DD_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01ED_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EF_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F0_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F1_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F2_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F3_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F4_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F5_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F6_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F7_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F8_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F9_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FA_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FB_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FC_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, @@ -642,7 +652,7 @@ static struct usb_device_id id_table_combined [] = { { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE (usb, id_table_combined); +MODULE_DEVICE_TABLE(usb, id_table_combined); static struct usb_driver ftdi_driver = { .name = "ftdi_sio", @@ -678,30 +688,37 @@ static const char *ftdi_chip_name[] = { | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP) /* function prototypes for a FTDI serial converter */ -static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); -static void ftdi_shutdown (struct usb_serial *serial); -static int ftdi_sio_port_probe (struct usb_serial_port *port); -static int ftdi_sio_port_remove (struct usb_serial_port *port); -static int ftdi_open (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); -static void ftdi_close (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); -static int ftdi_write (struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); -static int ftdi_write_room (struct tty_struct *tty); -static int ftdi_chars_in_buffer (struct tty_struct *tty); -static void ftdi_write_bulk_callback (struct urb *urb); -static void ftdi_read_bulk_callback (struct urb *urb); -static void ftdi_process_read (struct work_struct *work); -static void ftdi_set_termios (struct tty_struct *tty, struct usb_serial_port *port, struct ktermios * old); -static int ftdi_tiocmget (struct tty_struct *tty, struct file *file); -static int ftdi_tiocmset (struct tty_struct *tty, struct file * file, unsigned int set, unsigned int clear); -static int ftdi_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg); -static void ftdi_break_ctl (struct tty_struct *tty, int break_state ); -static void ftdi_throttle (struct tty_struct *tty); -static void ftdi_unthrottle (struct tty_struct *tty); - -static unsigned short int ftdi_232am_baud_base_to_divisor (int baud, int base); -static unsigned short int ftdi_232am_baud_to_divisor (int baud); -static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base); -static __u32 ftdi_232bm_baud_to_divisor (int baud); +static int ftdi_sio_probe(struct usb_serial *serial, + const struct usb_device_id *id); +static void ftdi_shutdown(struct usb_serial *serial); +static int ftdi_sio_port_probe(struct usb_serial_port *port); +static int ftdi_sio_port_remove(struct usb_serial_port *port); +static int ftdi_open(struct tty_struct *tty, + struct usb_serial_port *port, struct file *filp); +static void ftdi_close(struct tty_struct *tty, + struct usb_serial_port *port, struct file *filp); +static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, + const unsigned char *buf, int count); +static int ftdi_write_room(struct tty_struct *tty); +static int ftdi_chars_in_buffer(struct tty_struct *tty); +static void ftdi_write_bulk_callback(struct urb *urb); +static void ftdi_read_bulk_callback(struct urb *urb); +static void ftdi_process_read(struct work_struct *work); +static void ftdi_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old); +static int ftdi_tiocmget(struct tty_struct *tty, struct file *file); +static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, + unsigned int set, unsigned int clear); +static int ftdi_ioctl(struct tty_struct *tty, struct file *file, + unsigned int cmd, unsigned long arg); +static void ftdi_break_ctl(struct tty_struct *tty, int break_state); +static void ftdi_throttle(struct tty_struct *tty); +static void ftdi_unthrottle(struct tty_struct *tty); + +static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); +static unsigned short int ftdi_232am_baud_to_divisor(int baud); +static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base); +static __u32 ftdi_232bm_baud_to_divisor(int baud); static struct usb_serial_driver ftdi_sio_device = { .driver = { @@ -752,44 +769,54 @@ static struct usb_serial_driver ftdi_sio_device = { static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base) { unsigned short int divisor; - int divisor3 = base / 2 / baud; // divisor shifted 3 bits to the left - if ((divisor3 & 0x7) == 7) divisor3 ++; // round x.7/8 up to x+1 + /* divisor shifted 3 bits to the left */ + int divisor3 = base / 2 / baud; + if ((divisor3 & 0x7) == 7) + divisor3++; /* round x.7/8 up to x+1 */ divisor = divisor3 >> 3; divisor3 &= 0x7; - if (divisor3 == 1) divisor |= 0xc000; else // 0.125 - if (divisor3 >= 4) divisor |= 0x4000; else // 0.5 - if (divisor3 != 0) divisor |= 0x8000; // 0.25 - if (divisor == 1) divisor = 0; /* special case for maximum baud rate */ + if (divisor3 == 1) + divisor |= 0xc000; + else if (divisor3 >= 4) + divisor |= 0x4000; + else if (divisor3 != 0) + divisor |= 0x8000; + else if (divisor == 1) + divisor = 0; /* special case for maximum baud rate */ return divisor; } static unsigned short int ftdi_232am_baud_to_divisor(int baud) { - return(ftdi_232am_baud_base_to_divisor(baud, 48000000)); + return ftdi_232am_baud_base_to_divisor(baud, 48000000); } static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base) { static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; __u32 divisor; - int divisor3 = base / 2 / baud; // divisor shifted 3 bits to the left + /* divisor shifted 3 bits to the left */ + int divisor3 = base / 2 / baud; divisor = divisor3 >> 3; divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; /* Deal with special cases for highest baud rates. */ - if (divisor == 1) divisor = 0; else // 1.0 - if (divisor == 0x4001) divisor = 1; // 1.5 + if (divisor == 1) + divisor = 0; + else if (divisor == 0x4001) + divisor = 1; return divisor; } static __u32 ftdi_232bm_baud_to_divisor(int baud) { - return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); + return ftdi_232bm_baud_base_to_divisor(baud, 48000000); } #define set_mctrl(port, set) update_mctrl((port), (set), 0) #define clear_mctrl(port, clear) update_mctrl((port), 0, (clear)) -static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int clear) +static int update_mctrl(struct usb_serial_port *port, unsigned int set, + unsigned int clear) { struct ftdi_private *priv = usb_get_serial_port_data(port); char *buf; @@ -843,7 +870,8 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned } -static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *port) +static __u32 get_ftdi_divisor(struct tty_struct *tty, + struct usb_serial_port *port) { /* get_ftdi_divisor */ struct ftdi_private *priv = usb_get_serial_port_data(port); __u32 div_value = 0; @@ -851,48 +879,56 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *po int baud; /* - * The logic involved in setting the baudrate can be cleanly split in 3 steps. - * Obtaining the actual baud rate is a little tricky since unix traditionally - * somehow ignored the possibility to set non-standard baud rates. + * The logic involved in setting the baudrate can be cleanly split into + * 3 steps. * 1. Standard baud rates are set in tty->termios->c_cflag - * 2. If these are not enough, you can set any speed using alt_speed as follows: + * 2. If these are not enough, you can set any speed using alt_speed as + * follows: * - set tty->termios->c_cflag speed to B38400 * - set your real speed in tty->alt_speed; it gets ignored when * alt_speed==0, (or) - * - call TIOCSSERIAL ioctl with (struct serial_struct) set as follows: - * flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP], this just - * sets alt_speed to (HI: 57600, VHI: 115200, SHI: 230400, WARP: 460800) + * - call TIOCSSERIAL ioctl with (struct serial_struct) set as + * follows: + * flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP], + * this just sets alt_speed to (HI: 57600, VHI: 115200, + * SHI: 230400, WARP: 460800) * ** Steps 1, 2 are done courtesy of tty_get_baud_rate * 3. You can also set baud rate by setting custom divisor as follows * - set tty->termios->c_cflag speed to B38400 - * - call TIOCSSERIAL ioctl with (struct serial_struct) set as follows: + * - call TIOCSSERIAL ioctl with (struct serial_struct) set as + * follows: * o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST * o custom_divisor set to baud_base / your_new_baudrate - * ** Step 3 is done courtesy of code borrowed from serial.c - I should really - * spend some time and separate+move this common code to serial.c, it is - * replicated in nearly every serial driver you see. + * ** Step 3 is done courtesy of code borrowed from serial.c + * I should really spend some time and separate + move this common + * code to serial.c, it is replicated in nearly every serial driver + * you see. */ - /* 1. Get the baud rate from the tty settings, this observes alt_speed hack */ + /* 1. Get the baud rate from the tty settings, this observes + alt_speed hack */ baud = tty_get_baud_rate(tty); dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud); - /* 2. Observe async-compatible custom_divisor hack, update baudrate if needed */ + /* 2. Observe async-compatible custom_divisor hack, update baudrate + if needed */ if (baud == 38400 && ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && (priv->custom_divisor)) { baud = priv->baud_base / priv->custom_divisor; - dbg("%s - custom divisor %d sets baud rate to %d", __func__, priv->custom_divisor, baud); + dbg("%s - custom divisor %d sets baud rate to %d", + __func__, priv->custom_divisor, baud); } /* 3. Convert baudrate to device-specific divisor */ - if (!baud) baud = 9600; - switch(priv->chip_type) { + if (!baud) + baud = 9600; + switch (priv->chip_type) { case SIO: /* SIO chip */ - switch(baud) { + switch (baud) { case 300: div_value = ftdi_sio_b300; break; case 600: div_value = ftdi_sio_b600; break; case 1200: div_value = ftdi_sio_b1200; break; @@ -905,7 +941,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *po case 115200: div_value = ftdi_sio_b115200; break; } /* baud */ if (div_value == 0) { - dbg("%s - Baudrate (%d) requested is not supported", __func__, baud); + dbg("%s - Baudrate (%d) requested is not supported", + __func__, baud); div_value = ftdi_sio_b9600; baud = 9600; div_okay = 0; @@ -915,7 +952,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *po if (baud <= 3000000) { div_value = ftdi_232am_baud_to_divisor(baud); } else { - dbg("%s - Baud rate too high!", __func__); + dbg("%s - Baud rate too high!", __func__); baud = 9600; div_value = ftdi_232am_baud_to_divisor(9600); div_okay = 0; @@ -927,7 +964,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *po if (baud <= 3000000) { div_value = ftdi_232bm_baud_to_divisor(baud); } else { - dbg("%s - Baud rate too high!", __func__); + dbg("%s - Baud rate too high!", __func__); div_value = ftdi_232bm_baud_to_divisor(9600); div_okay = 0; baud = 9600; @@ -942,14 +979,14 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, struct usb_serial_port *po } tty_encode_baud_rate(tty, baud, baud); - return(div_value); + return div_value; } static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); char *buf; - __u16 urb_value; + __u16 urb_value; __u16 urb_index; __u32 urb_index_value; int rv; @@ -978,7 +1015,8 @@ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) -static int get_serial_info(struct usb_serial_port * port, struct serial_struct __user * retinfo) +static int get_serial_info(struct usb_serial_port *port, + struct serial_struct __user *retinfo) { struct ftdi_private *priv = usb_get_serial_port_data(port); struct serial_struct tmp; @@ -996,7 +1034,7 @@ static int get_serial_info(struct usb_serial_port * port, struct serial_struct _ static int set_serial_info(struct tty_struct *tty, - struct usb_serial_port * port, struct serial_struct __user * newinfo) + struct usb_serial_port *port, struct serial_struct __user *newinfo) { /* set_serial_info */ struct ftdi_private *priv = usb_get_serial_port_data(port); struct serial_struct new_serial; @@ -1004,7 +1042,7 @@ static int set_serial_info(struct tty_struct *tty, if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) return -EFAULT; - old_priv = * priv; + old_priv = *priv; /* Do error checking and permission checking */ @@ -1025,7 +1063,7 @@ static int set_serial_info(struct tty_struct *tty, /* Make the changes - these are privileged changes! */ priv->flags = ((priv->flags & ~ASYNC_FLAGS) | - (new_serial.flags & ASYNC_FLAGS)); + (new_serial.flags & ASYNC_FLAGS)); priv->custom_divisor = new_serial.custom_divisor; tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; @@ -1079,11 +1117,10 @@ static void ftdi_determine_type(struct usb_serial_port *port) priv->chip_type = FT2232C; /* Determine interface code. */ inter = serial->interface->altsetting->desc.bInterfaceNumber; - if (inter == 0) { + if (inter == 0) priv->interface = PIT_SIOA; - } else { + else priv->interface = PIT_SIOB; - } /* BM-type devices have a bug where bcdDevice gets set * to 0x200 when iSerialNumber is 0. */ if (version < 0x500) { @@ -1117,7 +1154,8 @@ static void ftdi_determine_type(struct usb_serial_port *port) * *************************************************************************** */ -static ssize_t show_latency_timer(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t show_latency_timer(struct device *dev, + struct device_attribute *attr, char *buf) { struct usb_serial_port *port = to_usb_serial_port(dev); struct ftdi_private *priv = usb_get_serial_port_data(port); @@ -1126,14 +1164,14 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a int rv = 0; - dbg("%s",__func__); + dbg("%s", __func__); rv = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), FTDI_SIO_GET_LATENCY_TIMER_REQUEST, FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 0, priv->interface, - (char*) &latency, 1, WDR_TIMEOUT); + (char *) &latency, 1, WDR_TIMEOUT); if (rv < 0) { dev_err(dev, "Unable to read latency timer: %i\n", rv); @@ -1143,8 +1181,9 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a } /* Write a new value of the latency timer, in units of milliseconds. */ -static ssize_t store_latency_timer(struct device *dev, struct device_attribute *attr, const char *valbuf, - size_t count) +static ssize_t store_latency_timer(struct device *dev, + struct device_attribute *attr, const char *valbuf, + size_t count) { struct usb_serial_port *port = to_usb_serial_port(dev); struct ftdi_private *priv = usb_get_serial_port_data(port); @@ -1172,8 +1211,8 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * /* Write an event character directly to the FTDI register. The ASCII value is in the low 8 bits, with the enable bit in the 9th bit. */ -static ssize_t store_event_char(struct device *dev, struct device_attribute *attr, const char *valbuf, - size_t count) +static ssize_t store_event_char(struct device *dev, + struct device_attribute *attr, const char *valbuf, size_t count) { struct usb_serial_port *port = to_usb_serial_port(dev); struct ftdi_private *priv = usb_get_serial_port_data(port); @@ -1199,7 +1238,8 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att return count; } -static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); +static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, + store_latency_timer); static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); static int create_sysfs_attrs(struct usb_serial_port *port) @@ -1207,7 +1247,7 @@ static int create_sysfs_attrs(struct usb_serial_port *port) struct ftdi_private *priv = usb_get_serial_port_data(port); int retval = 0; - dbg("%s",__func__); + dbg("%s", __func__); /* XXX I've no idea if the original SIO supports the event_char * sysfs parameter, so I'm playing it safe. */ @@ -1229,7 +1269,7 @@ static void remove_sysfs_attrs(struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); - dbg("%s",__func__); + dbg("%s", __func__); /* XXX see create_sysfs_attrs */ if (priv->chip_type != SIO) { @@ -1250,9 +1290,11 @@ static void remove_sysfs_attrs(struct usb_serial_port *port) */ /* Probe function to check for special devices */ -static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id) +static int ftdi_sio_probe(struct usb_serial *serial, + const struct usb_device_id *id) { - struct ftdi_sio_quirk *quirk = (struct ftdi_sio_quirk *)id->driver_info; + struct ftdi_sio_quirk *quirk = + (struct ftdi_sio_quirk *)id->driver_info; if (quirk && quirk->probe) { int ret = quirk->probe(serial); @@ -1271,17 +1313,18 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial); - dbg("%s",__func__); + dbg("%s", __func__); priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); - if (!priv){ - err("%s- kmalloc(%Zd) failed.", __func__, sizeof(struct ftdi_private)); + if (!priv) { + err("%s- kmalloc(%Zd) failed.", __func__, + sizeof(struct ftdi_private)); return -ENOMEM; } spin_lock_init(&priv->rx_lock); spin_lock_init(&priv->tx_lock); - init_waitqueue_head(&priv->delta_msr_wait); + init_waitqueue_head(&priv->delta_msr_wait); /* This will push the characters through immediately rather than queue a task to deliver them */ priv->flags = ASYNC_LOW_LATENCY; @@ -1291,9 +1334,9 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) /* Increase the size of read buffers */ kfree(port->bulk_in_buffer); - port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL); + port->bulk_in_buffer = kmalloc(BUFSZ, GFP_KERNEL); if (!port->bulk_in_buffer) { - kfree (priv); + kfree(priv); return -ENOMEM; } if (port->read_urb) { @@ -1306,7 +1349,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) /* Free port's existing write urb and transfer buffer. */ if (port->write_urb) { - usb_free_urb (port->write_urb); + usb_free_urb(port->write_urb); port->write_urb = NULL; } kfree(port->bulk_out_buffer); @@ -1314,7 +1357,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) usb_set_serial_port_data(port, priv); - ftdi_determine_type (port); + ftdi_determine_type(port); create_sysfs_attrs(port); return 0; } @@ -1322,9 +1365,9 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) /* Setup for the USB-UIRT device, which requires hardwired * baudrate (38400 gets mapped to 312500) */ /* Called from usbserial:serial_probe */ -static void ftdi_USB_UIRT_setup (struct ftdi_private *priv) +static void ftdi_USB_UIRT_setup(struct ftdi_private *priv) { - dbg("%s",__func__); + dbg("%s", __func__); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 77; @@ -1333,9 +1376,10 @@ static void ftdi_USB_UIRT_setup (struct ftdi_private *priv) /* Setup for the HE-TIRA1 device, which requires hardwired * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ -static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv) + +static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv) { - dbg("%s",__func__); + dbg("%s", __func__); priv->flags |= ASYNC_SPD_CUST; priv->custom_divisor = 240; @@ -1353,7 +1397,7 @@ static int ftdi_jtag_probe(struct usb_serial *serial) struct usb_device *udev = serial->dev; struct usb_interface *interface = serial->interface; - dbg("%s",__func__); + dbg("%s", __func__); if (interface == udev->actconfig->interface[0]) { info("Ignoring serial port reserved for JTAG"); @@ -1387,7 +1431,7 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) * calls __serial_close for each open of the port * shutdown is called then (ie ftdi_shutdown) */ -static void ftdi_shutdown (struct usb_serial *serial) +static void ftdi_shutdown(struct usb_serial *serial) { dbg("%s", __func__); } @@ -1401,7 +1445,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) remove_sysfs_attrs(port); /* all open ports are closed at this point - * (by usbserial.c:__serial_close, which calls ftdi_close) + * (by usbserial.c:__serial_close, which calls ftdi_close) */ if (priv) { @@ -1462,12 +1506,14 @@ static int ftdi_open(struct tty_struct *tty, /* Start reading from the device */ priv->rx_processed = 0; usb_fill_bulk_urb(port->read_urb, dev, - usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), - port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, - ftdi_read_bulk_callback, port); + usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), + port->read_urb->transfer_buffer, + port->read_urb->transfer_buffer_length, + ftdi_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - err("%s - failed submitting read urb, error %d", __func__, result); + err("%s - failed submitting read urb, error %d", + __func__, result); return result; @@ -1493,7 +1539,7 @@ static void ftdi_close(struct tty_struct *tty, dbg("%s", __func__); mutex_lock(&port->serial->disc_mutex); - if (c_cflag & HUPCL && !port->serial->disconnected){ + if (c_cflag & HUPCL && !port->serial->disconnected) { /* Disable flow control */ if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), @@ -1553,7 +1599,7 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, spin_unlock_irqrestore(&priv->tx_lock, flags); data_offset = priv->write_offset; - dbg("data_offset set to %d",data_offset); + dbg("data_offset set to %d", data_offset); /* Determine total transfer size */ transfer_size = count; @@ -1564,7 +1610,7 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, (PKTSZ - data_offset))); } - buffer = kmalloc (transfer_size, GFP_ATOMIC); + buffer = kmalloc(transfer_size, GFP_ATOMIC); if (!buffer) { err("%s ran out of kernel memory for urb ...", __func__); count = -ENOMEM; @@ -1580,20 +1626,20 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, /* Copy data */ if (data_offset > 0) { - /* Original sio requires control byte at start of each packet. */ + /* Original sio requires control byte at start of + each packet. */ int user_pktsz = PKTSZ - data_offset; int todo = count; unsigned char *first_byte = buffer; const unsigned char *current_position = buf; while (todo > 0) { - if (user_pktsz > todo) { + if (user_pktsz > todo) user_pktsz = todo; - } /* Write the control byte at the front of the packet*/ *first_byte = 1 | ((user_pktsz) << 2); /* Copy data for packet */ - memcpy (first_byte + data_offset, + memcpy(first_byte + data_offset, current_position, user_pktsz); first_byte += user_pktsz + data_offset; current_position += user_pktsz; @@ -1602,20 +1648,23 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, } else { /* No control byte required. */ /* Copy in the data to send */ - memcpy (buffer, buf, count); + memcpy(buffer, buf, count); } - usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, buffer); + usb_serial_debug_data(debug, &port->dev, __func__, + transfer_size, buffer); /* fill the buffer and send it */ usb_fill_bulk_urb(urb, port->serial->dev, - usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), - buffer, transfer_size, - ftdi_write_bulk_callback, port); + usb_sndbulkpipe(port->serial->dev, + port->bulk_out_endpointAddress), + buffer, transfer_size, + ftdi_write_bulk_callback, port); status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { - err("%s - failed submitting write urb, error %d", __func__, status); + err("%s - failed submitting write urb, error %d", + __func__, status); count = status; goto error; } else { @@ -1634,7 +1683,7 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, error: usb_free_urb(urb); error_no_urb: - kfree (buffer); + kfree(buffer); error_no_buffer: spin_lock_irqsave(&priv->tx_lock, flags); priv->tx_outstanding_urbs--; @@ -1645,7 +1694,7 @@ error_no_buffer: /* This function may get called when the device is closed */ -static void ftdi_write_bulk_callback (struct urb *urb) +static void ftdi_write_bulk_callback(struct urb *urb) { unsigned long flags; struct usb_serial_port *port = urb->context; @@ -1655,7 +1704,7 @@ static void ftdi_write_bulk_callback (struct urb *urb) int status = urb->status; /* free up the transfer buffer, as usb_free_urb() does not do this */ - kfree (urb->transfer_buffer); + kfree(urb->transfer_buffer); dbg("%s - port %d", __func__, port->number); @@ -1738,9 +1787,11 @@ static void ftdi_read_bulk_callback(struct urb *urb) int status = urb->status; if (urb->number_of_packets > 0) { - err("%s transfer_buffer_length %d actual_length %d number of packets %d",__func__, - urb->transfer_buffer_length, urb->actual_length, urb->number_of_packets ); - err("%s transfer_flags %x ", __func__,urb->transfer_flags ); + err("%s transfer_buffer_length %d actual_length %d number of packets %d", + __func__, + urb->transfer_buffer_length, + urb->actual_length, urb->number_of_packets); + err("%s transfer_flags %x ", __func__, urb->transfer_flags); } dbg("%s - port %d", __func__, port->number); @@ -1750,7 +1801,7 @@ static void ftdi_read_bulk_callback(struct urb *urb) tty = port->port.tty; if (!tty) { - dbg("%s - bad tty pointer - exiting",__func__); + dbg("%s - bad tty pointer - exiting", __func__); return; } @@ -1760,14 +1811,13 @@ static void ftdi_read_bulk_callback(struct urb *urb) return; } - if (urb != port->read_urb) { + if (urb != port->read_urb) err("%s - Not my urb!", __func__); - } if (status) { - /* This will happen at close every time so it is a dbg not an err */ - dbg("(this is ok on close) nonzero read bulk status received: " - "%d", status); + /* This will happen at close every time so it is a dbg not an + err */ + dbg("(this is ok on close) nonzero read bulk status received: %d", status); return; } @@ -1783,7 +1833,7 @@ static void ftdi_read_bulk_callback(struct urb *urb) } /* ftdi_read_bulk_callback */ -static void ftdi_process_read (struct work_struct *work) +static void ftdi_process_read(struct work_struct *work) { /* ftdi_process_read */ struct ftdi_private *priv = container_of(work, struct ftdi_private, rx_work.work); @@ -1806,7 +1856,7 @@ static void ftdi_process_read (struct work_struct *work) tty = port->port.tty; if (!tty) { - dbg("%s - bad tty pointer - exiting",__func__); + dbg("%s - bad tty pointer - exiting", __func__); return; } @@ -1830,11 +1880,11 @@ static void ftdi_process_read (struct work_struct *work) urb->actual_length - priv->rx_processed); } else { /* The first two bytes of every read packet are status */ - if (urb->actual_length > 2) { - usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); - } else { - dbg("Status only: %03oo %03oo",data[0],data[1]); - } + if (urb->actual_length > 2) + usb_serial_debug_data(debug, &port->dev, __func__, + urb->actual_length, data); + else + dbg("Status only: %03oo %03oo", data[0], data[1]); } @@ -1844,16 +1894,19 @@ static void ftdi_process_read (struct work_struct *work) /* if CD is dropped and the line is not CLOCAL then we should hangup */ need_flip = 0; - for (packet_offset = priv->rx_processed; packet_offset < urb->actual_length; packet_offset += PKTSZ) { + for (packet_offset = priv->rx_processed; + packet_offset < urb->actual_length; packet_offset += PKTSZ) { int length; - /* Compare new line status to the old one, signal if different */ - /* N.B. packet may be processed more than once, but differences - * are only processed once. */ + /* Compare new line status to the old one, signal if different/ + N.B. packet may be processed more than once, but differences + are only processed once. */ if (priv != NULL) { - char new_status = data[packet_offset+0] & FTDI_STATUS_B0_MASK; + char new_status = data[packet_offset + 0] & + FTDI_STATUS_B0_MASK; if (new_status != priv->prev_status) { - priv->diff_status |= new_status ^ priv->prev_status; + priv->diff_status |= + new_status ^ priv->prev_status; wake_up_interruptible(&priv->delta_msr_wait); priv->prev_status = new_status; } @@ -1870,30 +1923,31 @@ static void ftdi_process_read (struct work_struct *work) break; } if (tty_buffer_request_room(tty, length) < length) { - /* break out & wait for throttling/unthrottling to happen */ + /* break out & wait for throttling/unthrottling to + happen */ dbg("%s - receive room low", __func__); break; } /* Handle errors and break */ error_flag = TTY_NORMAL; - /* Although the device uses a bitmask and hence can have multiple */ - /* errors on a packet - the order here sets the priority the */ - /* error is returned to the tty layer */ + /* Although the device uses a bitmask and hence can have + multiple errors on a packet - the order here sets the + priority the error is returned to the tty layer */ - if ( data[packet_offset+1] & FTDI_RS_OE ) { + if (data[packet_offset+1] & FTDI_RS_OE) { error_flag = TTY_OVERRUN; dbg("OVERRRUN error"); } - if ( data[packet_offset+1] & FTDI_RS_BI ) { + if (data[packet_offset+1] & FTDI_RS_BI) { error_flag = TTY_BREAK; dbg("BREAK received"); } - if ( data[packet_offset+1] & FTDI_RS_PE ) { + if (data[packet_offset+1] & FTDI_RS_PE) { error_flag = TTY_PARITY; dbg("PARITY error"); } - if ( data[packet_offset+1] & FTDI_RS_FE ) { + if (data[packet_offset+1] & FTDI_RS_FE) { error_flag = TTY_FRAME; dbg("FRAMING error"); } @@ -1902,7 +1956,8 @@ static void ftdi_process_read (struct work_struct *work) /* Note that the error flag is duplicated for every character received since we don't know which character it applied to */ - tty_insert_flip_char(tty, data[packet_offset+i], error_flag); + tty_insert_flip_char(tty, + data[packet_offset + i], error_flag); } need_flip = 1; } @@ -1910,19 +1965,19 @@ static void ftdi_process_read (struct work_struct *work) #ifdef NOT_CORRECT_BUT_KEEPING_IT_FOR_NOW /* if a parity error is detected you get status packets forever until a character is sent without a parity error. - This doesn't work well since the application receives a never - ending stream of bad data - even though new data hasn't been sent. - Therefore I (bill) have taken this out. + This doesn't work well since the application receives a + never ending stream of bad data - even though new data + hasn't been sent. Therefore I (bill) have taken this out. However - this might make sense for framing errors and so on so I am leaving the code in for now. */ else { - if (error_flag != TTY_NORMAL){ + if (error_flag != TTY_NORMAL) { dbg("error_flag is not normal"); - /* In this case it is just status - if that is an error send a bad character */ - if(tty->flip.count >= TTY_FLIPBUF_SIZE) { + /* In this case it is just status - if that is + an error send a bad character */ + if (tty->flip.count >= TTY_FLIPBUF_SIZE) tty_flip_buffer_push(tty); - } tty_insert_flip_char(tty, 0xff, error_flag); need_flip = 1; } @@ -1931,9 +1986,8 @@ static void ftdi_process_read (struct work_struct *work) } /* "for(packet_offset=0..." */ /* Low latency */ - if (need_flip) { + if (need_flip) tty_flip_buffer_push(tty); - } if (packet_offset < urb->actual_length) { /* not completely processed - record progress */ @@ -1952,12 +2006,11 @@ static void ftdi_process_read (struct work_struct *work) } spin_unlock_irqrestore(&priv->rx_lock, flags); /* if the port is closed stop trying to read */ - if (port->port.count > 0){ + if (port->port.count > 0) /* delay processing of remainder */ schedule_delayed_work(&priv->rx_work, 1); - } else { + else dbg("%s - port is closed", __func__); - } return; } @@ -1965,19 +2018,20 @@ static void ftdi_process_read (struct work_struct *work) priv->rx_processed = 0; /* if the port is closed stop trying to read */ - if (port->port.count > 0){ + if (port->port.count > 0) { /* Continue trying to always read */ usb_fill_bulk_urb(port->read_urb, port->serial->dev, - usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), - port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, - ftdi_read_bulk_callback, port); + usb_rcvbulkpipe(port->serial->dev, + port->bulk_in_endpointAddress), + port->read_urb->transfer_buffer, + port->read_urb->transfer_buffer_length, + ftdi_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __func__, result); + err("%s - failed resubmitting read urb, error %d", + __func__, result); } - - return; } /* ftdi_process_read */ @@ -1992,22 +2046,23 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state) /* see drivers/char/tty_io.c to see it used */ /* last_set_data_urb_value NEVER has the break bit set in it */ - if (break_state) { + if (break_state) urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; - } else { + else urb_value = priv->last_set_data_urb_value; - } - - if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), - FTDI_SIO_SET_DATA_REQUEST, - FTDI_SIO_SET_DATA_REQUEST_TYPE, - urb_value , priv->interface, - buf, 0, WDR_TIMEOUT) < 0) { - err("%s FAILED to enable/disable break state (state was %d)", __func__,break_state); + if (usb_control_msg(port->serial->dev, + usb_sndctrlpipe(port->serial->dev, 0), + FTDI_SIO_SET_DATA_REQUEST, + FTDI_SIO_SET_DATA_REQUEST_TYPE, + urb_value , priv->interface, + buf, 0, WDR_TIMEOUT) < 0) { + err("%s FAILED to enable/disable break state (state was %d)", + __func__, break_state); } - dbg("%s break state is %d - urb is %d", __func__,break_state, urb_value); + dbg("%s break state is %d - urb is %d", __func__, + break_state, urb_value); } @@ -2027,14 +2082,15 @@ static void ftdi_set_termios(struct tty_struct *tty, __u16 urb_value; /* will hold the new flags */ char buf[1]; /* Perhaps I should dynamically alloc this? */ - // Added for xon/xoff support + /* Added for xon/xoff support */ unsigned int iflag = termios->c_iflag; unsigned char vstop; unsigned char vstart; dbg("%s", __func__); - /* Force baud rate if this device requires it, unless it is set to B0. */ + /* Force baud rate if this device requires it, unless it is set to + B0. */ if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { dbg("%s: forcing baud rate for this device", __func__); tty_encode_baud_rate(tty, priv->force_baud, @@ -2053,8 +2109,8 @@ static void ftdi_set_termios(struct tty_struct *tty, not - so just do the change regardless - should be able to compare old_termios and tty->termios */ /* NOTE These routines can get interrupted by - ftdi_sio_read_bulk_callback - need to examine what this - means - don't see any problems yet */ + ftdi_sio_read_bulk_callback - need to examine what this means - + don't see any problems yet */ /* Set number of data bits, parity, stop bits */ @@ -2078,8 +2134,8 @@ static void ftdi_set_termios(struct tty_struct *tty, } } - /* This is needed by the break command since it uses the same command - but is - * or'ed with this value */ + /* This is needed by the break command since it uses the same command + - but is or'ed with this value */ priv->last_set_data_urb_value = urb_value; if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), @@ -2091,7 +2147,7 @@ static void ftdi_set_termios(struct tty_struct *tty, } /* Now do the baudrate */ - if ((cflag & CBAUD) == B0 ) { + if ((cflag & CBAUD) == B0) { /* Disable flow control */ if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), FTDI_SIO_SET_FLOW_CTRL_REQUEST, @@ -2104,13 +2160,11 @@ static void ftdi_set_termios(struct tty_struct *tty, clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); } else { /* set the baudrate determined before */ - if (change_speed(tty, port)) { + if (change_speed(tty, port)) err("%s urb failed to set baudrate", __func__); - } /* Ensure RTS and DTR are raised when baudrate changed from 0 */ - if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) { + if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) set_mctrl(port, TIOCM_DTR | TIOCM_RTS); - } } /* Set flow control */ @@ -2130,18 +2184,22 @@ static void ftdi_set_termios(struct tty_struct *tty, /* * Xon/Xoff code * - * Check the IXOFF status in the iflag component of the termios structure - * if IXOFF is not set, the pre-xon/xoff code is executed. - */ + * Check the IXOFF status in the iflag component of the + * termios structure. If IXOFF is not set, the pre-xon/xoff + * code is executed. + */ if (iflag & IXOFF) { - dbg("%s request to enable xonxoff iflag=%04x",__func__,iflag); - // Try to enable the XON/XOFF on the ftdi_sio - // Set the vstart and vstop -- could have been done up above where - // a lot of other dereferencing is done but that would be very - // inefficient as vstart and vstop are not always needed + dbg("%s request to enable xonxoff iflag=%04x", + __func__, iflag); + /* Try to enable the XON/XOFF on the ftdi_sio + * Set the vstart and vstop -- could have been done up + * above where a lot of other dereferencing is done but + * that would be very inefficient as vstart and vstop + * are not always needed. + */ vstart = termios->c_cc[VSTART]; vstop = termios->c_cc[VSTOP]; - urb_value=(vstop << 8) | (vstart); + urb_value = (vstop << 8) | (vstart); if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), @@ -2153,8 +2211,9 @@ static void ftdi_set_termios(struct tty_struct *tty, err("urb failed to set to xon/xoff flow control"); } } else { - /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */ - /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */ + /* else clause to only run if cflag ! CRTSCTS and iflag + * ! XOFF. CHECKME Assuming XON/XOFF handled by tty + * stack - not by device */ dbg("%s Turning off hardware flow control", __func__); if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), @@ -2181,32 +2240,35 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file) switch (priv->chip_type) { case SIO: /* Request the status from the device */ - if ((ret = usb_control_msg(port->serial->dev, - usb_rcvctrlpipe(port->serial->dev, 0), - FTDI_SIO_GET_MODEM_STATUS_REQUEST, - FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, - 0, 0, - buf, 1, WDR_TIMEOUT)) < 0 ) { + ret = usb_control_msg(port->serial->dev, + usb_rcvctrlpipe(port->serial->dev, 0), + FTDI_SIO_GET_MODEM_STATUS_REQUEST, + FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, + 0, 0, + buf, 1, WDR_TIMEOUT); + if (ret < 0) { err("%s Could not get modem status of device - err: %d", __func__, ret); - return(ret); + return ret; } break; case FT8U232AM: case FT232BM: case FT2232C: case FT232RL: - /* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same - format as the data returned from the in point */ - if ((ret = usb_control_msg(port->serial->dev, - usb_rcvctrlpipe(port->serial->dev, 0), - FTDI_SIO_GET_MODEM_STATUS_REQUEST, - FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, - 0, priv->interface, - buf, 2, WDR_TIMEOUT)) < 0 ) { + /* the 8U232AM returns a two byte value (the sio is a 1 byte + value) - in the same format as the data returned from the in + point */ + ret = usb_control_msg(port->serial->dev, + usb_rcvctrlpipe(port->serial->dev, 0), + FTDI_SIO_GET_MODEM_STATUS_REQUEST, + FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, + 0, priv->interface, + buf, 2, WDR_TIMEOUT); + if (ret < 0) { err("%s Could not get modem status of device - err: %d", __func__, ret); - return(ret); + return ret; } break; default: @@ -2221,7 +2283,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file) priv->last_dtr_rts; } -static int ftdi_tiocmset(struct tty_struct *tty, struct file * file, +static int ftdi_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; @@ -2230,7 +2292,8 @@ static int ftdi_tiocmset(struct tty_struct *tty, struct file * file, } -static int ftdi_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) +static int ftdi_ioctl(struct tty_struct *tty, struct file *file, + unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; struct ftdi_private *priv = usb_get_serial_port_data(port); @@ -2241,10 +2304,12 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file * file, unsigned int c switch (cmd) { case TIOCGSERIAL: /* gets serial port data */ - return get_serial_info(port, (struct serial_struct __user *) arg); + return get_serial_info(port, + (struct serial_struct __user *) arg); case TIOCSSERIAL: /* sets serial port data */ - return set_serial_info(tty, port, (struct serial_struct __user *) arg); + return set_serial_info(tty, port, + (struct serial_struct __user *) arg); /* * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change @@ -2263,23 +2328,24 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file * file, unsigned int c else { char diff = priv->diff_status; - if (diff == 0) { + if (diff == 0) return -EIO; /* no change => error */ - } /* Consume all events */ priv->diff_status = 0; - /* Return 0 if caller wanted to know about these bits */ - if ( ((arg & TIOCM_RNG) && (diff & FTDI_RS0_RI)) || - ((arg & TIOCM_DSR) && (diff & FTDI_RS0_DSR)) || - ((arg & TIOCM_CD) && (diff & FTDI_RS0_RLSD)) || - ((arg & TIOCM_CTS) && (diff & FTDI_RS0_CTS)) ) { + /* Return 0 if caller wanted to know about + these bits */ + if (((arg & TIOCM_RNG) && (diff & FTDI_RS0_RI)) || + ((arg & TIOCM_DSR) && (diff & FTDI_RS0_DSR)) || + ((arg & TIOCM_CD) && (diff & FTDI_RS0_RLSD)) || + ((arg & TIOCM_CTS) && (diff & FTDI_RS0_CTS))) { return 0; } /* - * Otherwise caller can't care less about what happened, - * and so we continue to wait for more events. + * Otherwise caller can't care less about what + * happened,and so we continue to wait for more + * events. */ } } @@ -2287,8 +2353,8 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file * file, unsigned int c default: break; } - /* This is not necessarily an error - turns out the higher layers will do - * some ioctls itself (see comment above) + /* This is not necessarily an error - turns out the higher layers + * will do some ioctls themselves (see comment above) */ dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd); return -ENOIOCTLCMD; @@ -2326,7 +2392,7 @@ static void ftdi_unthrottle(struct tty_struct *tty) schedule_delayed_work(&priv->rx_work, 0); } -static int __init ftdi_init (void) +static int __init ftdi_init(void) { int retval; @@ -2356,13 +2422,13 @@ failed_sio_register: } -static void __exit ftdi_exit (void) +static void __exit ftdi_exit(void) { dbg("%s", __func__); - usb_deregister (&ftdi_driver); - usb_serial_deregister (&ftdi_sio_device); + usb_deregister(&ftdi_driver); + usb_serial_deregister(&ftdi_sio_device); } @@ -2370,8 +2436,8 @@ static void __exit ftdi_exit (void) module_init(ftdi_init); module_exit(ftdi_exit); -MODULE_AUTHOR( DRIVER_AUTHOR ); -MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); module_param(debug, bool, S_IRUGO | S_IWUSR); diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 8302eca893ea..a577ea44dcf9 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h @@ -1,20 +1,20 @@ /* - * Definitions for the FTDI USB Single Port Serial Converter - - * known as FTDI_SIO (Serial Input/Output application of the chipset) + * Definitions for the FTDI USB Single Port Serial Converter - + * known as FTDI_SIO (Serial Input/Output application of the chipset) * * The example I have is known as the USC-1000 which is available from * http://www.dse.co.nz - cat no XH4214 It looks similar to this: * http://www.dansdata.com/usbser.htm but I can't be sure There are other * USC-1000s which don't look like my device though so beware! * - * The device is based on the FTDI FT8U100AX chip. It has a DB25 on one side, + * The device is based on the FTDI FT8U100AX chip. It has a DB25 on one side, * USB on the other. * * Thanx to FTDI (http://www.ftdi.co.uk) for so kindly providing details * of the protocol required to talk to the device and ongoing assistence * during development. * - * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the + * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the * FTDI_SIO implementation. * * Philipp Gühring - pg@futureware.at - added the Device ID of the USB relais @@ -472,7 +472,7 @@ /* * DSS-20 Sync Station for Sony Ericsson P800 */ -#define FTDI_DSS20_PID 0xFC82 +#define FTDI_DSS20_PID 0xFC82 /* * Home Electronics (www.home-electro.com) USB gadgets @@ -884,7 +884,7 @@ /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_RESET - * wValue: Control Value + * wValue: Control Value * 0 = Reset SIO * 1 = Purge RX buffer * 2 = Purge TX buffer @@ -952,7 +952,7 @@ * 101 - add .625 to divisor * 110 - add .750 to divisor * 111 - add .875 to divisor - * Bits 15 to 0 of the 17-bit divisor are placed in the urb value. Bit 16 is + * Bits 15 to 0 of the 17-bit divisor are placed in the urb value. Bit 16 is * placed in bit 0 of the urb index. * * Note that there are a couple of special cases to support the highest baud @@ -971,8 +971,8 @@ typedef enum { } ftdi_chip_type_t; typedef enum { - ftdi_sio_b300 = 0, - ftdi_sio_b600 = 1, + ftdi_sio_b300 = 0, + ftdi_sio_b600 = 1, ftdi_sio_b1200 = 2, ftdi_sio_b2400 = 3, ftdi_sio_b4800 = 4, @@ -981,7 +981,7 @@ typedef enum { ftdi_sio_b38400 = 7, ftdi_sio_b57600 = 8, ftdi_sio_b115200 = 9 -} FTDI_SIO_baudrate_t ; +} FTDI_SIO_baudrate_t; /* * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values @@ -990,19 +990,19 @@ typedef enum { #define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA #define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 -#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 ) -#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 ) -#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 ) -#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 ) -#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 ) -#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11 ) -#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11 ) -#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11 ) +#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) +#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8) +#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8) +#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8) +#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8) +#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) +#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) +#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) #define FTDI_SIO_SET_BREAK (0x1 << 14) /* FTDI_SIO_SET_DATA */ /* - * BmRequestType: 0100 0000B + * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_SET_DATA * wValue: Data characteristics (see below) * wIndex: Port @@ -1035,7 +1035,7 @@ typedef enum { #define FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE 0x40 #define FTDI_SIO_SET_MODEM_CTRL_REQUEST FTDI_SIO_MODEM_CTRL -/* +/* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_MODEM_CTRL * wValue: ControlValue (see below) @@ -1049,11 +1049,11 @@ typedef enum { */ #define FTDI_SIO_SET_DTR_MASK 0x1 -#define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8)) -#define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8)) +#define FTDI_SIO_SET_DTR_HIGH (1 | (FTDI_SIO_SET_DTR_MASK << 8)) +#define FTDI_SIO_SET_DTR_LOW (0 | (FTDI_SIO_SET_DTR_MASK << 8)) #define FTDI_SIO_SET_RTS_MASK 0x2 -#define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 )) -#define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 )) +#define FTDI_SIO_SET_RTS_HIGH (2 | (FTDI_SIO_SET_RTS_MASK << 8)) +#define FTDI_SIO_SET_RTS_LOW (0 | (FTDI_SIO_SET_RTS_MASK << 8)) /* * ControlValue @@ -1076,7 +1076,7 @@ typedef enum { /* FTDI_SIO_SET_FLOW_CTRL */ #define FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE 0x40 #define FTDI_SIO_SET_FLOW_CTRL_REQUEST FTDI_SIO_SET_FLOW_CTRL -#define FTDI_SIO_DISABLE_FLOW_CTRL 0x0 +#define FTDI_SIO_DISABLE_FLOW_CTRL 0x0 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8) #define FTDI_SIO_DTR_DSR_HS (0x2 << 8) #define FTDI_SIO_XON_XOFF_HS (0x4 << 8) @@ -1085,7 +1085,7 @@ typedef enum { * bRequest: FTDI_SIO_SET_FLOW_CTRL * wValue: Xoff/Xon * wIndex: Protocol/Port - hIndex is protocl / lIndex is port - * wLength: 0 + * wLength: 0 * Data: None * * hIndex protocol is: @@ -1101,10 +1101,10 @@ typedef enum { * * A value of zero in the hIndex field disables handshaking * - * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character + * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character * and the lValue field contains the XON character. - */ - + */ + /* * FTDI_SIO_GET_LATENCY_TIMER * @@ -1118,7 +1118,7 @@ typedef enum { #define FTDI_SIO_GET_LATENCY_TIMER_REQUEST FTDI_SIO_GET_LATENCY_TIMER #define FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE 0xC0 -/* +/* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_LATENCY_TIMER * wValue: 0 @@ -1127,7 +1127,7 @@ typedef enum { * Data: latency (on return) */ -/* +/* * FTDI_SIO_SET_LATENCY_TIMER * * Set the timeout interval. The FTDI collects data from the slave @@ -1140,7 +1140,7 @@ typedef enum { #define FTDI_SIO_SET_LATENCY_TIMER_REQUEST FTDI_SIO_SET_LATENCY_TIMER #define FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE 0x40 -/* +/* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_LATENCY_TIMER * wValue: Latency (milliseconds) @@ -1155,7 +1155,7 @@ typedef enum { */ /* - * FTDI_SIO_SET_EVENT_CHAR + * FTDI_SIO_SET_EVENT_CHAR * * Set the special event character for the specified communications port. * If the device sees this character it will immediately return the @@ -1168,7 +1168,7 @@ typedef enum { #define FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE 0x40 -/* +/* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR * wValue: EventChar @@ -1184,12 +1184,12 @@ typedef enum { * B9..15 Reserved * */ - + /* FTDI_SIO_SET_ERROR_CHAR */ /* Set the parity error replacement character for the specified communications port */ -/* +/* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR * wValue: Error Char @@ -1215,15 +1215,15 @@ typedef enum { #define FTDI_SIO_DSR_MASK 0x20 #define FTDI_SIO_RI_MASK 0x40 #define FTDI_SIO_RLSD_MASK 0x80 -/* +/* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_MODEM_STATUS * wValue: zero * wIndex: Port * wLength: 1 * Data: Status - * - * One byte of data is returned + * + * One byte of data is returned * B0..3 0 * B4 CTS * 0 = inactive @@ -1236,15 +1236,15 @@ typedef enum { * 1 = active * B7 Receive Line Signal Detect (RLSD) * 0 = inactive - * 1 = active + * 1 = active */ -/* Descriptors returned by the device - * +/* Descriptors returned by the device + * * Device Descriptor - * + * * Offset Field Size Value Description * 0 bLength 1 0x12 Size of descriptor in bytes * 1 bDescriptorType 1 0x01 DEVICE Descriptor Type @@ -1260,9 +1260,9 @@ typedef enum { * 15 iProduct 1 0x02 Index of prod string desc * 16 iSerialNumber 1 0x02 Index of serial nmr string desc * 17 bNumConfigurations 1 0x01 Number of possible configurations - * + * * Configuration Descriptor - * + * * Offset Field Size Value * 0 bLength 1 0x09 Size of descriptor in bytes * 1 bDescriptorType 1 0x02 CONFIGURATION Descriptor Type @@ -1272,9 +1272,9 @@ typedef enum { * 6 iConfiguration 1 0x02 Index of config string descriptor * 7 bmAttributes 1 0x20 Config characteristics Remote Wakeup * 8 MaxPower 1 0x1E Max power consumption - * + * * Interface Descriptor - * + * * Offset Field Size Value * 0 bLength 1 0x09 Size of descriptor in bytes * 1 bDescriptorType 1 0x04 INTERFACE Descriptor Type @@ -1285,9 +1285,9 @@ typedef enum { * 6 bInterfaceSubClass 1 0xFF Subclass Code * 7 bInterfaceProtocol 1 0xFF Protocol Code * 8 iInterface 1 0x02 Index of interface string description - * + * * IN Endpoint Descriptor - * + * * Offset Field Size Value * 0 bLength 1 0x07 Size of descriptor in bytes * 1 bDescriptorType 1 0x05 ENDPOINT descriptor type @@ -1295,9 +1295,9 @@ typedef enum { * 3 bmAttributes 1 0x02 Endpoint attributes - Bulk * 4 bNumEndpoints 2 0x0040 maximum packet size * 5 bInterval 1 0x00 Interval for polling endpoint - * + * * OUT Endpoint Descriptor - * + * * Offset Field Size Value * 0 bLength 1 0x07 Size of descriptor in bytes * 1 bDescriptorType 1 0x05 ENDPOINT descriptor type @@ -1305,17 +1305,17 @@ typedef enum { * 3 bmAttributes 1 0x02 Endpoint attributes - Bulk * 4 bNumEndpoints 2 0x0040 maximum packet size * 5 bInterval 1 0x00 Interval for polling endpoint - * + * * DATA FORMAT - * + * * IN Endpoint - * + * * The device reserves the first two bytes of data on this endpoint to contain the current * values of the modem and line status registers. In the absence of data, the device * generates a message consisting of these two status bytes every 40 ms - * + * * Byte 0: Modem Status - * + * * Offset Description * B0 Reserved - must be 1 * B1 Reserved - must be 0 @@ -1325,9 +1325,9 @@ typedef enum { * B5 Data Set Ready (DSR) * B6 Ring Indicator (RI) * B7 Receive Line Signal Detect (RLSD) - * + * * Byte 1: Line Status - * + * * Offset Description * B0 Data Ready (DR) * B1 Overrun Error (OE) @@ -1337,7 +1337,7 @@ typedef enum { * B5 Transmitter Holding Register (THRE) * B6 Transmitter Empty (TEMT) * B7 Error in RCVR FIFO - * + * */ #define FTDI_RS0_CTS (1 << 4) #define FTDI_RS0_DSR (1 << 5) @@ -1355,17 +1355,17 @@ typedef enum { /* * OUT Endpoint - * + * * This device reserves the first bytes of data on this endpoint contain the length * and port identifier of the message. For the FTDI USB Serial converter the port * identifier is always 1. - * + * * Byte 0: Line Status - * + * * Offset Description * B0 Reserved - must be 1 * B1 Reserved - must be 0 * B2..7 Length of message - (not including Byte 0) - * + * */