diff options
author | David Brownell <david-b@pacbell.net> | 2006-10-13 18:57:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-17 17:46:34 -0400 |
commit | 5c09d144ff94706c2a5df292329ad83a27380173 (patch) | |
tree | 4a6af6f5660bbed739546a68e5cd0d0bd3c44914 /drivers/usb/serial/ftdi_sio.c | |
parent | 61926b975d83aa6c0124b5b0ce40c08579e6cc98 (diff) |
USB: ftdi_sio whitespace fixes
Whitespace fixups for drivers/usb/serial/ftdi_sio.c ...
removing end-of-line whitespace, and space-before-tab.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index d3dc1a15ec6c..bd76b4c11fcc 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * USB FTDI SIO driver | 2 | * USB FTDI SIO driver |
3 | * | 3 | * |
4 | * Copyright (C) 1999 - 2001 | 4 | * Copyright (C) 1999 - 2001 |
5 | * Greg Kroah-Hartman (greg@kroah.com) | 5 | * Greg Kroah-Hartman (greg@kroah.com) |
6 | * Bill Ryder (bryder@sgi.com) | 6 | * Bill Ryder (bryder@sgi.com) |
7 | * Copyright (C) 2002 | 7 | * Copyright (C) 2002 |
8 | * Kuba Ober (kuba@mareimbrium.org) | 8 | * Kuba Ober (kuba@mareimbrium.org) |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | 14 | * |
15 | * See Documentation/usb/usb-serial.txt for more information on using this driver | 15 | * See Documentation/usb/usb-serial.txt for more information on using this driver |
16 | * | 16 | * |
@@ -32,7 +32,7 @@ | |||
32 | * Changed full name of USB-UIRT device to avoid "/" character. | 32 | * Changed full name of USB-UIRT device to avoid "/" character. |
33 | * Added FTDI's alternate PID (0x6006) for FT232/245 devices. | 33 | * Added FTDI's alternate PID (0x6006) for FT232/245 devices. |
34 | * Added PID for "ELV USB Module UO100" from Stefan Frings. | 34 | * Added PID for "ELV USB Module UO100" from Stefan Frings. |
35 | * | 35 | * |
36 | * (21/Oct/2003) Ian Abbott | 36 | * (21/Oct/2003) Ian Abbott |
37 | * Renamed some VID/PID macros for Matrix Orbital and Perle Systems | 37 | * Renamed some VID/PID macros for Matrix Orbital and Perle Systems |
38 | * devices. Removed Matrix Orbital and Perle Systems devices from the | 38 | * devices. Removed Matrix Orbital and Perle Systems devices from the |
@@ -69,7 +69,7 @@ | |||
69 | * does not incure any measurable overhead. This also relies on the fact | 69 | * does not incure any measurable overhead. This also relies on the fact |
70 | * that we have proper reference counting logic for urbs. I nicked this | 70 | * that we have proper reference counting logic for urbs. I nicked this |
71 | * from Greg KH's Visor driver. | 71 | * from Greg KH's Visor driver. |
72 | * | 72 | * |
73 | * (23/Jun/2003) Ian Abbott | 73 | * (23/Jun/2003) Ian Abbott |
74 | * Reduced flip buffer pushes and corrected a data length test in | 74 | * Reduced flip buffer pushes and corrected a data length test in |
75 | * ftdi_read_bulk_callback. | 75 | * ftdi_read_bulk_callback. |
@@ -77,7 +77,7 @@ | |||
77 | * | 77 | * |
78 | * (21/Jun/2003) Erik Nygren | 78 | * (21/Jun/2003) Erik Nygren |
79 | * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip. | 79 | * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip. |
80 | * See <http://www.home-electro.com/tira1.htm>. Only operates properly | 80 | * See <http://www.home-electro.com/tira1.htm>. Only operates properly |
81 | * at 100000 and RTS-CTS, so set custom divisor mode on startup. | 81 | * at 100000 and RTS-CTS, so set custom divisor mode on startup. |
82 | * Also force the Tira-1 and USB-UIRT to only use their custom baud rates. | 82 | * Also force the Tira-1 and USB-UIRT to only use their custom baud rates. |
83 | * | 83 | * |
@@ -137,17 +137,17 @@ | |||
137 | * (17/Feb/2003) Bill Ryder | 137 | * (17/Feb/2003) Bill Ryder |
138 | * Added write urb buffer pool on a per device basis | 138 | * Added write urb buffer pool on a per device basis |
139 | * Added more checking for open file on callbacks (fixed OOPS) | 139 | * Added more checking for open file on callbacks (fixed OOPS) |
140 | * Added CrystalFontz 632 and 634 PIDs | 140 | * Added CrystalFontz 632 and 634 PIDs |
141 | * (thanx to CrystalFontz for the sample devices - they flushed out | 141 | * (thanx to CrystalFontz for the sample devices - they flushed out |
142 | * some driver bugs) | 142 | * some driver bugs) |
143 | * Minor debugging message changes | 143 | * Minor debugging message changes |
144 | * Added throttle, unthrottle and chars_in_buffer functions | 144 | * Added throttle, unthrottle and chars_in_buffer functions |
145 | * Fixed FTDI_SIO (the original device) bug | 145 | * Fixed FTDI_SIO (the original device) bug |
146 | * Fixed some shutdown handling | 146 | * Fixed some shutdown handling |
147 | * | 147 | * |
148 | * | 148 | * |
149 | * | 149 | * |
150 | * | 150 | * |
151 | * (07/Jun/2002) Kuba Ober | 151 | * (07/Jun/2002) Kuba Ober |
152 | * Changed FTDI_SIO_BASE_BAUD_TO_DIVISOR macro into ftdi_baud_to_divisor | 152 | * Changed FTDI_SIO_BASE_BAUD_TO_DIVISOR macro into ftdi_baud_to_divisor |
153 | * function. It was getting too complex. | 153 | * function. It was getting too complex. |
@@ -158,7 +158,7 @@ | |||
158 | * | 158 | * |
159 | * (25/Jul/2002) Bill Ryder inserted Dmitri's TIOCMIWAIT patch | 159 | * (25/Jul/2002) Bill Ryder inserted Dmitri's TIOCMIWAIT patch |
160 | * Not tested by me but it doesn't break anything I use. | 160 | * Not tested by me but it doesn't break anything I use. |
161 | * | 161 | * |
162 | * (04/Jan/2002) Kuba Ober | 162 | * (04/Jan/2002) Kuba Ober |
163 | * Implemented 38400 baudrate kludge, where it can be substituted with other | 163 | * Implemented 38400 baudrate kludge, where it can be substituted with other |
164 | * values. That's the only way to set custom baudrates. | 164 | * values. That's the only way to set custom baudrates. |
@@ -179,7 +179,7 @@ | |||
179 | * (the previous version caused panics) | 179 | * (the previous version caused panics) |
180 | * Removed port iteration code since the device only has one I/O port and it | 180 | * Removed port iteration code since the device only has one I/O port and it |
181 | * was wrong anyway. | 181 | * was wrong anyway. |
182 | * | 182 | * |
183 | * (31/May/2001) gkh | 183 | * (31/May/2001) gkh |
184 | * Switched from using spinlock to a semaphore, which fixes lots of problems. | 184 | * Switched from using spinlock to a semaphore, which fixes lots of problems. |
185 | * | 185 | * |
@@ -188,16 +188,16 @@ | |||
188 | * Cleaned up comments for 8U232 | 188 | * Cleaned up comments for 8U232 |
189 | * Added parity, framing and overrun error handling | 189 | * Added parity, framing and overrun error handling |
190 | * Added receive break handling. | 190 | * Added receive break handling. |
191 | * | 191 | * |
192 | * (04/08/2001) gb | 192 | * (04/08/2001) gb |
193 | * Identify version on module load. | 193 | * Identify version on module load. |
194 | * | 194 | * |
195 | * (18/March/2001) Bill Ryder | 195 | * (18/March/2001) Bill Ryder |
196 | * (Not released) | 196 | * (Not released) |
197 | * Added send break handling. (requires kernel patch too) | 197 | * Added send break handling. (requires kernel patch too) |
198 | * Fixed 8U232AM hardware RTS/CTS etc status reporting. | 198 | * Fixed 8U232AM hardware RTS/CTS etc status reporting. |
199 | * Added flipbuf fix copied from generic device | 199 | * Added flipbuf fix copied from generic device |
200 | * | 200 | * |
201 | * (12/3/2000) Bill Ryder | 201 | * (12/3/2000) Bill Ryder |
202 | * Added support for 8U232AM device. | 202 | * Added support for 8U232AM device. |
203 | * Moved PID and VIDs into header file only. | 203 | * Moved PID and VIDs into header file only. |
@@ -211,14 +211,14 @@ | |||
211 | * Cleaned up comments. Removed multiple PID/VID definitions. | 211 | * Cleaned up comments. Removed multiple PID/VID definitions. |
212 | * Factorised cts/dtr code | 212 | * Factorised cts/dtr code |
213 | * Made use of __FUNCTION__ in dbg's | 213 | * Made use of __FUNCTION__ in dbg's |
214 | * | 214 | * |
215 | * (11/01/2000) Adam J. Richter | 215 | * (11/01/2000) Adam J. Richter |
216 | * usb_device_id table support | 216 | * usb_device_id table support |
217 | * | 217 | * |
218 | * (10/05/2000) gkh | 218 | * (10/05/2000) gkh |
219 | * Fixed bug with urb->dev not being set properly, now that the usb | 219 | * Fixed bug with urb->dev not being set properly, now that the usb |
220 | * core needs it. | 220 | * core needs it. |
221 | * | 221 | * |
222 | * (09/11/2000) gkh | 222 | * (09/11/2000) gkh |
223 | * Removed DEBUG #ifdefs with call to usb_serial_debug_data | 223 | * Removed DEBUG #ifdefs with call to usb_serial_debug_data |
224 | * | 224 | * |
@@ -226,11 +226,11 @@ | |||
226 | * Added module_init and module_exit functions to handle the fact that this | 226 | * Added module_init and module_exit functions to handle the fact that this |
227 | * driver is a loadable module now. | 227 | * driver is a loadable module now. |
228 | * | 228 | * |
229 | * (04/04/2000) Bill Ryder | 229 | * (04/04/2000) Bill Ryder |
230 | * Fixed bugs in TCGET/TCSET ioctls (by removing them - they are | 230 | * Fixed bugs in TCGET/TCSET ioctls (by removing them - they are |
231 | * handled elsewhere in the tty io driver chain). | 231 | * handled elsewhere in the tty io driver chain). |
232 | * | 232 | * |
233 | * (03/30/2000) Bill Ryder | 233 | * (03/30/2000) Bill Ryder |
234 | * Implemented lots of ioctls | 234 | * Implemented lots of ioctls |
235 | * Fixed a race condition in write | 235 | * Fixed a race condition in write |
236 | * Changed some dbg's to errs | 236 | * Changed some dbg's to errs |
@@ -444,13 +444,13 @@ static struct usb_device_id id_table_combined [] = { | |||
444 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, */ | 444 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, */ |
445 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, */ | 445 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, */ |
446 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, */ | 446 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, */ |
447 | { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, | 447 | { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, |
448 | { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, | 448 | { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, |
449 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, | 449 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, |
450 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, | 450 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, |
451 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, | 451 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, |
452 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, | 452 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, |
453 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, | 453 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, |
454 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, | 454 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, |
455 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, | 455 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, |
456 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, | 456 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, |
@@ -522,7 +522,7 @@ static struct usb_driver ftdi_driver = { | |||
522 | .probe = usb_serial_probe, | 522 | .probe = usb_serial_probe, |
523 | .disconnect = usb_serial_disconnect, | 523 | .disconnect = usb_serial_disconnect, |
524 | .id_table = id_table_combined, | 524 | .id_table = id_table_combined, |
525 | .no_dynamic_id = 1, | 525 | .no_dynamic_id = 1, |
526 | }; | 526 | }; |
527 | 527 | ||
528 | static const char *ftdi_chip_name[] = { | 528 | static const char *ftdi_chip_name[] = { |
@@ -548,13 +548,13 @@ struct ftdi_private { | |||
548 | int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */ | 548 | int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */ |
549 | __u16 last_set_data_urb_value ; | 549 | __u16 last_set_data_urb_value ; |
550 | /* the last data state set - needed for doing a break */ | 550 | /* the last data state set - needed for doing a break */ |
551 | int write_offset; /* This is the offset in the usb data block to write the serial data - | 551 | int write_offset; /* This is the offset in the usb data block to write the serial data - |
552 | * it is different between devices | 552 | * it is different between devices |
553 | */ | 553 | */ |
554 | int flags; /* some ASYNC_xxxx flags are supported */ | 554 | int flags; /* some ASYNC_xxxx flags are supported */ |
555 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 555 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
556 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 556 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
557 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 557 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ |
558 | __u8 rx_flags; /* receive state flags (throttling) */ | 558 | __u8 rx_flags; /* receive state flags (throttling) */ |
559 | spinlock_t rx_lock; /* spinlock for receive state */ | 559 | spinlock_t rx_lock; /* spinlock for receive state */ |
560 | struct work_struct rx_work; | 560 | struct work_struct rx_work; |
@@ -721,7 +721,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned | |||
721 | urb_value |= FTDI_SIO_SET_RTS_HIGH; | 721 | urb_value |= FTDI_SIO_SET_RTS_HIGH; |
722 | rv = usb_control_msg(port->serial->dev, | 722 | rv = usb_control_msg(port->serial->dev, |
723 | usb_sndctrlpipe(port->serial->dev, 0), | 723 | usb_sndctrlpipe(port->serial->dev, 0), |
724 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, | 724 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, |
725 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, | 725 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, |
726 | urb_value, priv->interface, | 726 | urb_value, priv->interface, |
727 | buf, 0, WDR_TIMEOUT); | 727 | buf, 0, WDR_TIMEOUT); |
@@ -768,7 +768,7 @@ static int change_speed(struct usb_serial_port *port) | |||
768 | if (priv->interface) { /* FT2232C */ | 768 | if (priv->interface) { /* FT2232C */ |
769 | urb_index = (__u16)((urb_index << 8) | priv->interface); | 769 | urb_index = (__u16)((urb_index << 8) | priv->interface); |
770 | } | 770 | } |
771 | 771 | ||
772 | rv = usb_control_msg(port->serial->dev, | 772 | rv = usb_control_msg(port->serial->dev, |
773 | usb_sndctrlpipe(port->serial->dev, 0), | 773 | usb_sndctrlpipe(port->serial->dev, 0), |
774 | FTDI_SIO_SET_BAUDRATE_REQUEST, | 774 | FTDI_SIO_SET_BAUDRATE_REQUEST, |
@@ -827,7 +827,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
827 | 827 | ||
828 | /* 3. Convert baudrate to device-specific divisor */ | 828 | /* 3. Convert baudrate to device-specific divisor */ |
829 | 829 | ||
830 | if (!baud) baud = 9600; | 830 | if (!baud) baud = 9600; |
831 | switch(priv->chip_type) { | 831 | switch(priv->chip_type) { |
832 | case SIO: /* SIO chip */ | 832 | case SIO: /* SIO chip */ |
833 | switch(baud) { | 833 | switch(baud) { |
@@ -843,7 +843,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
843 | case 115200: div_value = ftdi_sio_b115200; break; | 843 | case 115200: div_value = ftdi_sio_b115200; break; |
844 | } /* baud */ | 844 | } /* baud */ |
845 | if (div_value == 0) { | 845 | if (div_value == 0) { |
846 | dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); | 846 | dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); |
847 | div_value = ftdi_sio_b9600; | 847 | div_value = ftdi_sio_b9600; |
848 | div_okay = 0; | 848 | div_okay = 0; |
849 | } | 849 | } |
@@ -925,7 +925,7 @@ static int set_serial_info(struct usb_serial_port * port, struct serial_struct _ | |||
925 | /* Make the changes - these are privileged changes! */ | 925 | /* Make the changes - these are privileged changes! */ |
926 | 926 | ||
927 | priv->flags = ((priv->flags & ~ASYNC_FLAGS) | | 927 | priv->flags = ((priv->flags & ~ASYNC_FLAGS) | |
928 | (new_serial.flags & ASYNC_FLAGS)); | 928 | (new_serial.flags & ASYNC_FLAGS)); |
929 | priv->custom_divisor = new_serial.custom_divisor; | 929 | priv->custom_divisor = new_serial.custom_divisor; |
930 | 930 | ||
931 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 931 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
@@ -950,7 +950,7 @@ check_and_exit: | |||
950 | (old_priv.custom_divisor != priv->custom_divisor))) { | 950 | (old_priv.custom_divisor != priv->custom_divisor))) { |
951 | change_speed(port); | 951 | change_speed(port); |
952 | } | 952 | } |
953 | 953 | ||
954 | return (0); | 954 | return (0); |
955 | 955 | ||
956 | } /* set_serial_info */ | 956 | } /* set_serial_info */ |
@@ -1022,18 +1022,18 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a | |||
1022 | struct usb_device *udev; | 1022 | struct usb_device *udev; |
1023 | unsigned short latency = 0; | 1023 | unsigned short latency = 0; |
1024 | int rv = 0; | 1024 | int rv = 0; |
1025 | 1025 | ||
1026 | udev = to_usb_device(dev); | 1026 | udev = to_usb_device(dev); |
1027 | 1027 | ||
1028 | dbg("%s",__FUNCTION__); | 1028 | dbg("%s",__FUNCTION__); |
1029 | 1029 | ||
1030 | rv = usb_control_msg(udev, | 1030 | rv = usb_control_msg(udev, |
1031 | usb_rcvctrlpipe(udev, 0), | 1031 | usb_rcvctrlpipe(udev, 0), |
1032 | FTDI_SIO_GET_LATENCY_TIMER_REQUEST, | 1032 | FTDI_SIO_GET_LATENCY_TIMER_REQUEST, |
1033 | FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, | 1033 | FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, |
1034 | 0, priv->interface, | 1034 | 0, priv->interface, |
1035 | (char*) &latency, 1, WDR_TIMEOUT); | 1035 | (char*) &latency, 1, WDR_TIMEOUT); |
1036 | 1036 | ||
1037 | if (rv < 0) { | 1037 | if (rv < 0) { |
1038 | dev_err(dev, "Unable to read latency timer: %i", rv); | 1038 | dev_err(dev, "Unable to read latency timer: %i", rv); |
1039 | return -EIO; | 1039 | return -EIO; |
@@ -1051,23 +1051,23 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * | |||
1051 | char buf[1]; | 1051 | char buf[1]; |
1052 | int v = simple_strtoul(valbuf, NULL, 10); | 1052 | int v = simple_strtoul(valbuf, NULL, 10); |
1053 | int rv = 0; | 1053 | int rv = 0; |
1054 | 1054 | ||
1055 | udev = to_usb_device(dev); | 1055 | udev = to_usb_device(dev); |
1056 | 1056 | ||
1057 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); | 1057 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); |
1058 | 1058 | ||
1059 | rv = usb_control_msg(udev, | 1059 | rv = usb_control_msg(udev, |
1060 | usb_sndctrlpipe(udev, 0), | 1060 | usb_sndctrlpipe(udev, 0), |
1061 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST, | 1061 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST, |
1062 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, | 1062 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, |
1063 | v, priv->interface, | 1063 | v, priv->interface, |
1064 | buf, 0, WDR_TIMEOUT); | 1064 | buf, 0, WDR_TIMEOUT); |
1065 | 1065 | ||
1066 | if (rv < 0) { | 1066 | if (rv < 0) { |
1067 | dev_err(dev, "Unable to write latency timer: %i", rv); | 1067 | dev_err(dev, "Unable to write latency timer: %i", rv); |
1068 | return -EIO; | 1068 | return -EIO; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | return count; | 1071 | return count; |
1072 | } | 1072 | } |
1073 | 1073 | ||
@@ -1082,23 +1082,23 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att | |||
1082 | char buf[1]; | 1082 | char buf[1]; |
1083 | int v = simple_strtoul(valbuf, NULL, 10); | 1083 | int v = simple_strtoul(valbuf, NULL, 10); |
1084 | int rv = 0; | 1084 | int rv = 0; |
1085 | 1085 | ||
1086 | udev = to_usb_device(dev); | 1086 | udev = to_usb_device(dev); |
1087 | 1087 | ||
1088 | dbg("%s: setting event char = %i", __FUNCTION__, v); | 1088 | dbg("%s: setting event char = %i", __FUNCTION__, v); |
1089 | 1089 | ||
1090 | rv = usb_control_msg(udev, | 1090 | rv = usb_control_msg(udev, |
1091 | usb_sndctrlpipe(udev, 0), | 1091 | usb_sndctrlpipe(udev, 0), |
1092 | FTDI_SIO_SET_EVENT_CHAR_REQUEST, | 1092 | FTDI_SIO_SET_EVENT_CHAR_REQUEST, |
1093 | FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE, | 1093 | FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE, |
1094 | v, priv->interface, | 1094 | v, priv->interface, |
1095 | buf, 0, WDR_TIMEOUT); | 1095 | buf, 0, WDR_TIMEOUT); |
1096 | 1096 | ||
1097 | if (rv < 0) { | 1097 | if (rv < 0) { |
1098 | dbg("Unable to write event character: %i", rv); | 1098 | dbg("Unable to write event character: %i", rv); |
1099 | return -EIO; | 1099 | return -EIO; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | return count; | 1102 | return count; |
1103 | } | 1103 | } |
1104 | 1104 | ||
@@ -1135,11 +1135,11 @@ static void remove_sysfs_attrs(struct usb_serial *serial) | |||
1135 | struct ftdi_private *priv; | 1135 | struct ftdi_private *priv; |
1136 | struct usb_device *udev; | 1136 | struct usb_device *udev; |
1137 | 1137 | ||
1138 | dbg("%s",__FUNCTION__); | 1138 | dbg("%s",__FUNCTION__); |
1139 | 1139 | ||
1140 | priv = usb_get_serial_port_data(serial->port[0]); | 1140 | priv = usb_get_serial_port_data(serial->port[0]); |
1141 | udev = serial->dev; | 1141 | udev = serial->dev; |
1142 | 1142 | ||
1143 | /* XXX see create_sysfs_attrs */ | 1143 | /* XXX see create_sysfs_attrs */ |
1144 | if (priv->chip_type != SIO) { | 1144 | if (priv->chip_type != SIO) { |
1145 | device_remove_file(&udev->dev, &dev_attr_event_char); | 1145 | device_remove_file(&udev->dev, &dev_attr_event_char); |
@@ -1147,7 +1147,7 @@ static void remove_sysfs_attrs(struct usb_serial *serial) | |||
1147 | device_remove_file(&udev->dev, &dev_attr_latency_timer); | 1147 | device_remove_file(&udev->dev, &dev_attr_latency_timer); |
1148 | } | 1148 | } |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | /* | 1153 | /* |
@@ -1258,7 +1258,7 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) | |||
1258 | } /* ftdi_HE_TIRA1_setup */ | 1258 | } /* ftdi_HE_TIRA1_setup */ |
1259 | 1259 | ||
1260 | 1260 | ||
1261 | /* ftdi_shutdown is called from usbserial:usb_serial_disconnect | 1261 | /* ftdi_shutdown is called from usbserial:usb_serial_disconnect |
1262 | * it is called when the usb device is disconnected | 1262 | * it is called when the usb device is disconnected |
1263 | * | 1263 | * |
1264 | * usbserial:usb_serial_disconnect | 1264 | * usbserial:usb_serial_disconnect |
@@ -1269,16 +1269,16 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) | |||
1269 | 1269 | ||
1270 | static void ftdi_shutdown (struct usb_serial *serial) | 1270 | static void ftdi_shutdown (struct usb_serial *serial) |
1271 | { /* ftdi_shutdown */ | 1271 | { /* ftdi_shutdown */ |
1272 | 1272 | ||
1273 | struct usb_serial_port *port = serial->port[0]; | 1273 | struct usb_serial_port *port = serial->port[0]; |
1274 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1274 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1275 | 1275 | ||
1276 | dbg("%s", __FUNCTION__); | 1276 | dbg("%s", __FUNCTION__); |
1277 | 1277 | ||
1278 | remove_sysfs_attrs(serial); | 1278 | remove_sysfs_attrs(serial); |
1279 | 1279 | ||
1280 | /* all open ports are closed at this point | 1280 | /* all open ports are closed at this point |
1281 | * (by usbserial.c:__serial_close, which calls ftdi_close) | 1281 | * (by usbserial.c:__serial_close, which calls ftdi_close) |
1282 | */ | 1282 | */ |
1283 | 1283 | ||
1284 | if (priv) { | 1284 | if (priv) { |
@@ -1293,7 +1293,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1293 | struct usb_device *dev = port->serial->dev; | 1293 | struct usb_device *dev = port->serial->dev; |
1294 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1294 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1295 | unsigned long flags; | 1295 | unsigned long flags; |
1296 | 1296 | ||
1297 | int result = 0; | 1297 | int result = 0; |
1298 | char buf[1]; /* Needed for the usb_control_msg I think */ | 1298 | char buf[1]; /* Needed for the usb_control_msg I think */ |
1299 | 1299 | ||
@@ -1312,8 +1312,8 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1312 | /* No error checking for this (will get errors later anyway) */ | 1312 | /* No error checking for this (will get errors later anyway) */ |
1313 | /* See ftdi_sio.h for description of what is reset */ | 1313 | /* See ftdi_sio.h for description of what is reset */ |
1314 | usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1314 | usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
1315 | FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, | 1315 | FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, |
1316 | FTDI_SIO_RESET_SIO, | 1316 | FTDI_SIO_RESET_SIO, |
1317 | priv->interface, buf, 0, WDR_TIMEOUT); | 1317 | priv->interface, buf, 0, WDR_TIMEOUT); |
1318 | 1318 | ||
1319 | /* Termios defaults are set by usb_serial_init. We don't change | 1319 | /* Termios defaults are set by usb_serial_init. We don't change |
@@ -1350,12 +1350,12 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1350 | 1350 | ||
1351 | 1351 | ||
1352 | 1352 | ||
1353 | /* | 1353 | /* |
1354 | * usbserial:__serial_close only calls ftdi_close if the point is open | 1354 | * usbserial:__serial_close only calls ftdi_close if the point is open |
1355 | * | 1355 | * |
1356 | * This only gets called when it is the last close | 1356 | * This only gets called when it is the last close |
1357 | * | 1357 | * |
1358 | * | 1358 | * |
1359 | */ | 1359 | */ |
1360 | 1360 | ||
1361 | static void ftdi_close (struct usb_serial_port *port, struct file *filp) | 1361 | static void ftdi_close (struct usb_serial_port *port, struct file *filp) |
@@ -1368,14 +1368,14 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp) | |||
1368 | 1368 | ||
1369 | if (c_cflag & HUPCL){ | 1369 | if (c_cflag & HUPCL){ |
1370 | /* Disable flow control */ | 1370 | /* Disable flow control */ |
1371 | if (usb_control_msg(port->serial->dev, | 1371 | if (usb_control_msg(port->serial->dev, |
1372 | usb_sndctrlpipe(port->serial->dev, 0), | 1372 | usb_sndctrlpipe(port->serial->dev, 0), |
1373 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, | 1373 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
1374 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, | 1374 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, |
1375 | 0, priv->interface, buf, 0, | 1375 | 0, priv->interface, buf, 0, |
1376 | WDR_TIMEOUT) < 0) { | 1376 | WDR_TIMEOUT) < 0) { |
1377 | err("error from flowcontrol urb"); | 1377 | err("error from flowcontrol urb"); |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | /* drop RTS and DTR */ | 1380 | /* drop RTS and DTR */ |
1381 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 1381 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
@@ -1384,14 +1384,14 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp) | |||
1384 | /* cancel any scheduled reading */ | 1384 | /* cancel any scheduled reading */ |
1385 | cancel_delayed_work(&priv->rx_work); | 1385 | cancel_delayed_work(&priv->rx_work); |
1386 | flush_scheduled_work(); | 1386 | flush_scheduled_work(); |
1387 | 1387 | ||
1388 | /* shutdown our bulk read */ | 1388 | /* shutdown our bulk read */ |
1389 | if (port->read_urb) | 1389 | if (port->read_urb) |
1390 | usb_kill_urb(port->read_urb); | 1390 | usb_kill_urb(port->read_urb); |
1391 | } /* ftdi_close */ | 1391 | } /* ftdi_close */ |
1392 | 1392 | ||
1393 | 1393 | ||
1394 | 1394 | ||
1395 | /* The SIO requires the first byte to have: | 1395 | /* The SIO requires the first byte to have: |
1396 | * B0 1 | 1396 | * B0 1 |
1397 | * B1 0 | 1397 | * B1 0 |
@@ -1423,7 +1423,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1423 | return 0; | 1423 | return 0; |
1424 | } | 1424 | } |
1425 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 1425 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
1426 | 1426 | ||
1427 | data_offset = priv->write_offset; | 1427 | data_offset = priv->write_offset; |
1428 | dbg("data_offset set to %d",data_offset); | 1428 | dbg("data_offset set to %d",data_offset); |
1429 | 1429 | ||
@@ -1462,7 +1462,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1462 | user_pktsz = todo; | 1462 | user_pktsz = todo; |
1463 | } | 1463 | } |
1464 | /* Write the control byte at the front of the packet*/ | 1464 | /* Write the control byte at the front of the packet*/ |
1465 | *first_byte = 1 | ((user_pktsz) << 2); | 1465 | *first_byte = 1 | ((user_pktsz) << 2); |
1466 | /* Copy data for packet */ | 1466 | /* Copy data for packet */ |
1467 | memcpy (first_byte + data_offset, | 1467 | memcpy (first_byte + data_offset, |
1468 | current_position, user_pktsz); | 1468 | current_position, user_pktsz); |
@@ -1479,7 +1479,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1479 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer); | 1479 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer); |
1480 | 1480 | ||
1481 | /* fill the buffer and send it */ | 1481 | /* fill the buffer and send it */ |
1482 | usb_fill_bulk_urb(urb, port->serial->dev, | 1482 | usb_fill_bulk_urb(urb, port->serial->dev, |
1483 | usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), | 1483 | usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), |
1484 | buffer, transfer_size, | 1484 | buffer, transfer_size, |
1485 | ftdi_write_bulk_callback, port); | 1485 | ftdi_write_bulk_callback, port); |
@@ -1520,7 +1520,7 @@ static void ftdi_write_bulk_callback (struct urb *urb) | |||
1520 | kfree (urb->transfer_buffer); | 1520 | kfree (urb->transfer_buffer); |
1521 | 1521 | ||
1522 | dbg("%s - port %d", __FUNCTION__, port->number); | 1522 | dbg("%s - port %d", __FUNCTION__, port->number); |
1523 | 1523 | ||
1524 | if (urb->status) { | 1524 | if (urb->status) { |
1525 | dbg("nonzero write bulk status received: %d", urb->status); | 1525 | dbg("nonzero write bulk status received: %d", urb->status); |
1526 | return; | 1526 | return; |
@@ -1651,7 +1651,7 @@ static void ftdi_process_read (void *param) | |||
1651 | struct tty_struct *tty; | 1651 | struct tty_struct *tty; |
1652 | struct ftdi_private *priv; | 1652 | struct ftdi_private *priv; |
1653 | char error_flag; | 1653 | char error_flag; |
1654 | unsigned char *data; | 1654 | unsigned char *data; |
1655 | 1655 | ||
1656 | int i; | 1656 | int i; |
1657 | int result; | 1657 | int result; |
@@ -1759,7 +1759,7 @@ static void ftdi_process_read (void *param) | |||
1759 | } | 1759 | } |
1760 | if (length > 0) { | 1760 | if (length > 0) { |
1761 | for (i = 2; i < length+2; i++) { | 1761 | for (i = 2; i < length+2; i++) { |
1762 | /* Note that the error flag is duplicated for | 1762 | /* Note that the error flag is duplicated for |
1763 | every character received since we don't know | 1763 | every character received since we don't know |
1764 | which character it applied to */ | 1764 | which character it applied to */ |
1765 | tty_insert_flip_char(tty, data[packet_offset+i], error_flag); | 1765 | tty_insert_flip_char(tty, data[packet_offset+i], error_flag); |
@@ -1773,7 +1773,7 @@ static void ftdi_process_read (void *param) | |||
1773 | This doesn't work well since the application receives a never | 1773 | This doesn't work well since the application receives a never |
1774 | ending stream of bad data - even though new data hasn't been sent. | 1774 | ending stream of bad data - even though new data hasn't been sent. |
1775 | Therefore I (bill) have taken this out. | 1775 | Therefore I (bill) have taken this out. |
1776 | However - this might make sense for framing errors and so on | 1776 | However - this might make sense for framing errors and so on |
1777 | so I am leaving the code in for now. | 1777 | so I am leaving the code in for now. |
1778 | */ | 1778 | */ |
1779 | else { | 1779 | else { |
@@ -1827,7 +1827,7 @@ static void ftdi_process_read (void *param) | |||
1827 | /* if the port is closed stop trying to read */ | 1827 | /* if the port is closed stop trying to read */ |
1828 | if (port->open_count > 0){ | 1828 | if (port->open_count > 0){ |
1829 | /* Continue trying to always read */ | 1829 | /* Continue trying to always read */ |
1830 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | 1830 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
1831 | usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), | 1831 | usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), |
1832 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | 1832 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, |
1833 | ftdi_read_bulk_callback, port); | 1833 | ftdi_read_bulk_callback, port); |
@@ -1844,9 +1844,9 @@ static void ftdi_process_read (void *param) | |||
1844 | static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) | 1844 | static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) |
1845 | { | 1845 | { |
1846 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1846 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1847 | __u16 urb_value = 0; | 1847 | __u16 urb_value = 0; |
1848 | char buf[1]; | 1848 | char buf[1]; |
1849 | 1849 | ||
1850 | /* break_state = -1 to turn on break, and 0 to turn off break */ | 1850 | /* break_state = -1 to turn on break, and 0 to turn off break */ |
1851 | /* see drivers/char/tty_io.c to see it used */ | 1851 | /* see drivers/char/tty_io.c to see it used */ |
1852 | /* last_set_data_urb_value NEVER has the break bit set in it */ | 1852 | /* last_set_data_urb_value NEVER has the break bit set in it */ |
@@ -1854,20 +1854,20 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) | |||
1854 | if (break_state) { | 1854 | if (break_state) { |
1855 | urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; | 1855 | urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; |
1856 | } else { | 1856 | } else { |
1857 | urb_value = priv->last_set_data_urb_value; | 1857 | urb_value = priv->last_set_data_urb_value; |
1858 | } | 1858 | } |
1859 | 1859 | ||
1860 | 1860 | ||
1861 | if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), | 1861 | if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), |
1862 | FTDI_SIO_SET_DATA_REQUEST, | 1862 | FTDI_SIO_SET_DATA_REQUEST, |
1863 | FTDI_SIO_SET_DATA_REQUEST_TYPE, | 1863 | FTDI_SIO_SET_DATA_REQUEST_TYPE, |
1864 | urb_value , priv->interface, | 1864 | urb_value , priv->interface, |
1865 | buf, 0, WDR_TIMEOUT) < 0) { | 1865 | buf, 0, WDR_TIMEOUT) < 0) { |
1866 | err("%s FAILED to enable/disable break state (state was %d)", __FUNCTION__,break_state); | 1866 | err("%s FAILED to enable/disable break state (state was %d)", __FUNCTION__,break_state); |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | dbg("%s break state is %d - urb is %d", __FUNCTION__,break_state, urb_value); | 1869 | dbg("%s break state is %d - urb is %d", __FUNCTION__,break_state, urb_value); |
1870 | 1870 | ||
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | 1873 | ||
@@ -1883,12 +1883,12 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1883 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1883 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1884 | __u16 urb_value; /* will hold the new flags */ | 1884 | __u16 urb_value; /* will hold the new flags */ |
1885 | char buf[1]; /* Perhaps I should dynamically alloc this? */ | 1885 | char buf[1]; /* Perhaps I should dynamically alloc this? */ |
1886 | 1886 | ||
1887 | // Added for xon/xoff support | 1887 | // Added for xon/xoff support |
1888 | unsigned int iflag = port->tty->termios->c_iflag; | 1888 | unsigned int iflag = port->tty->termios->c_iflag; |
1889 | unsigned char vstop; | 1889 | unsigned char vstop; |
1890 | unsigned char vstart; | 1890 | unsigned char vstart; |
1891 | 1891 | ||
1892 | dbg("%s", __FUNCTION__); | 1892 | dbg("%s", __FUNCTION__); |
1893 | 1893 | ||
1894 | /* Force baud rate if this device requires it, unless it is set to B0. */ | 1894 | /* Force baud rate if this device requires it, unless it is set to B0. */ |
@@ -1906,20 +1906,20 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1906 | 1906 | ||
1907 | cflag = port->tty->termios->c_cflag; | 1907 | cflag = port->tty->termios->c_cflag; |
1908 | 1908 | ||
1909 | /* FIXME -For this cut I don't care if the line is really changing or | 1909 | /* FIXME -For this cut I don't care if the line is really changing or |
1910 | not - so just do the change regardless - should be able to | 1910 | not - so just do the change regardless - should be able to |
1911 | compare old_termios and tty->termios */ | 1911 | compare old_termios and tty->termios */ |
1912 | /* NOTE These routines can get interrupted by | 1912 | /* NOTE These routines can get interrupted by |
1913 | ftdi_sio_read_bulk_callback - need to examine what this | 1913 | ftdi_sio_read_bulk_callback - need to examine what this |
1914 | means - don't see any problems yet */ | 1914 | means - don't see any problems yet */ |
1915 | 1915 | ||
1916 | /* Set number of data bits, parity, stop bits */ | 1916 | /* Set number of data bits, parity, stop bits */ |
1917 | 1917 | ||
1918 | urb_value = 0; | 1918 | urb_value = 0; |
1919 | urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : | 1919 | urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : |
1920 | FTDI_SIO_SET_DATA_STOP_BITS_1); | 1920 | FTDI_SIO_SET_DATA_STOP_BITS_1); |
1921 | urb_value |= (cflag & PARENB ? | 1921 | urb_value |= (cflag & PARENB ? |
1922 | (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD : | 1922 | (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD : |
1923 | FTDI_SIO_SET_DATA_PARITY_EVEN) : | 1923 | FTDI_SIO_SET_DATA_PARITY_EVEN) : |
1924 | FTDI_SIO_SET_DATA_PARITY_NONE); | 1924 | FTDI_SIO_SET_DATA_PARITY_NONE); |
1925 | if (cflag & CSIZE) { | 1925 | if (cflag & CSIZE) { |
@@ -1936,25 +1936,25 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1936 | /* This is needed by the break command since it uses the same command - but is | 1936 | /* This is needed by the break command since it uses the same command - but is |
1937 | * or'ed with this value */ | 1937 | * or'ed with this value */ |
1938 | priv->last_set_data_urb_value = urb_value; | 1938 | priv->last_set_data_urb_value = urb_value; |
1939 | 1939 | ||
1940 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1940 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
1941 | FTDI_SIO_SET_DATA_REQUEST, | 1941 | FTDI_SIO_SET_DATA_REQUEST, |
1942 | FTDI_SIO_SET_DATA_REQUEST_TYPE, | 1942 | FTDI_SIO_SET_DATA_REQUEST_TYPE, |
1943 | urb_value , priv->interface, | 1943 | urb_value , priv->interface, |
1944 | buf, 0, WDR_SHORT_TIMEOUT) < 0) { | 1944 | buf, 0, WDR_SHORT_TIMEOUT) < 0) { |
1945 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); | 1945 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); |
1946 | } | 1946 | } |
1947 | 1947 | ||
1948 | /* Now do the baudrate */ | 1948 | /* Now do the baudrate */ |
1949 | if ((cflag & CBAUD) == B0 ) { | 1949 | if ((cflag & CBAUD) == B0 ) { |
1950 | /* Disable flow control */ | 1950 | /* Disable flow control */ |
1951 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1951 | if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
1952 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, | 1952 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
1953 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, | 1953 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, |
1954 | 0, priv->interface, | 1954 | 0, priv->interface, |
1955 | buf, 0, WDR_TIMEOUT) < 0) { | 1955 | buf, 0, WDR_TIMEOUT) < 0) { |
1956 | err("%s error from disable flowcontrol urb", __FUNCTION__); | 1956 | err("%s error from disable flowcontrol urb", __FUNCTION__); |
1957 | } | 1957 | } |
1958 | /* Drop RTS and DTR */ | 1958 | /* Drop RTS and DTR */ |
1959 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 1959 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1960 | } else { | 1960 | } else { |
@@ -1972,16 +1972,16 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1972 | /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ | 1972 | /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ |
1973 | if (cflag & CRTSCTS) { | 1973 | if (cflag & CRTSCTS) { |
1974 | dbg("%s Setting to CRTSCTS flow control", __FUNCTION__); | 1974 | dbg("%s Setting to CRTSCTS flow control", __FUNCTION__); |
1975 | if (usb_control_msg(dev, | 1975 | if (usb_control_msg(dev, |
1976 | usb_sndctrlpipe(dev, 0), | 1976 | usb_sndctrlpipe(dev, 0), |
1977 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, | 1977 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
1978 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, | 1978 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, |
1979 | 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), | 1979 | 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), |
1980 | buf, 0, WDR_TIMEOUT) < 0) { | 1980 | buf, 0, WDR_TIMEOUT) < 0) { |
1981 | err("urb failed to set to rts/cts flow control"); | 1981 | err("urb failed to set to rts/cts flow control"); |
1982 | } | 1982 | } |
1983 | 1983 | ||
1984 | } else { | 1984 | } else { |
1985 | /* | 1985 | /* |
1986 | * Xon/Xoff code | 1986 | * Xon/Xoff code |
1987 | * | 1987 | * |
@@ -2011,16 +2011,16 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
2011 | /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */ | 2011 | /* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */ |
2012 | /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */ | 2012 | /* CHECKME Assuming XON/XOFF handled by tty stack - not by device */ |
2013 | dbg("%s Turning off hardware flow control", __FUNCTION__); | 2013 | dbg("%s Turning off hardware flow control", __FUNCTION__); |
2014 | if (usb_control_msg(dev, | 2014 | if (usb_control_msg(dev, |
2015 | usb_sndctrlpipe(dev, 0), | 2015 | usb_sndctrlpipe(dev, 0), |
2016 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, | 2016 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
2017 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, | 2017 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, |
2018 | 0, priv->interface, | 2018 | 0, priv->interface, |
2019 | buf, 0, WDR_TIMEOUT) < 0) { | 2019 | buf, 0, WDR_TIMEOUT) < 0) { |
2020 | err("urb failed to clear flow control"); | 2020 | err("urb failed to clear flow control"); |
2021 | } | 2021 | } |
2022 | } | 2022 | } |
2023 | 2023 | ||
2024 | } | 2024 | } |
2025 | return; | 2025 | return; |
2026 | } /* ftdi_termios */ | 2026 | } /* ftdi_termios */ |
@@ -2036,11 +2036,11 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) | |||
2036 | switch (priv->chip_type) { | 2036 | switch (priv->chip_type) { |
2037 | case SIO: | 2037 | case SIO: |
2038 | /* Request the status from the device */ | 2038 | /* Request the status from the device */ |
2039 | if ((ret = usb_control_msg(port->serial->dev, | 2039 | if ((ret = usb_control_msg(port->serial->dev, |
2040 | usb_rcvctrlpipe(port->serial->dev, 0), | 2040 | usb_rcvctrlpipe(port->serial->dev, 0), |
2041 | FTDI_SIO_GET_MODEM_STATUS_REQUEST, | 2041 | FTDI_SIO_GET_MODEM_STATUS_REQUEST, |
2042 | FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, | 2042 | FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, |
2043 | 0, 0, | 2043 | 0, 0, |
2044 | buf, 1, WDR_TIMEOUT)) < 0 ) { | 2044 | buf, 1, WDR_TIMEOUT)) < 0 ) { |
2045 | err("%s Could not get modem status of device - err: %d", __FUNCTION__, | 2045 | err("%s Could not get modem status of device - err: %d", __FUNCTION__, |
2046 | ret); | 2046 | ret); |
@@ -2052,11 +2052,11 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) | |||
2052 | case FT2232C: | 2052 | case FT2232C: |
2053 | /* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same | 2053 | /* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same |
2054 | format as the data returned from the in point */ | 2054 | format as the data returned from the in point */ |
2055 | if ((ret = usb_control_msg(port->serial->dev, | 2055 | if ((ret = usb_control_msg(port->serial->dev, |
2056 | usb_rcvctrlpipe(port->serial->dev, 0), | 2056 | usb_rcvctrlpipe(port->serial->dev, 0), |
2057 | FTDI_SIO_GET_MODEM_STATUS_REQUEST, | 2057 | FTDI_SIO_GET_MODEM_STATUS_REQUEST, |
2058 | FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, | 2058 | FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, |
2059 | 0, priv->interface, | 2059 | 0, priv->interface, |
2060 | buf, 2, WDR_TIMEOUT)) < 0 ) { | 2060 | buf, 2, WDR_TIMEOUT)) < 0 ) { |
2061 | err("%s Could not get modem status of device - err: %d", __FUNCTION__, | 2061 | err("%s Could not get modem status of device - err: %d", __FUNCTION__, |
2062 | ret); | 2062 | ret); |
@@ -2067,12 +2067,12 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) | |||
2067 | return -EFAULT; | 2067 | return -EFAULT; |
2068 | break; | 2068 | break; |
2069 | } | 2069 | } |
2070 | 2070 | ||
2071 | return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | | 2071 | return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | |
2072 | (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) | | 2072 | (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) | |
2073 | (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) | | 2073 | (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) | |
2074 | (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) | | 2074 | (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) | |
2075 | priv->last_dtr_rts; | 2075 | priv->last_dtr_rts; |
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) | 2078 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) |
@@ -2138,11 +2138,11 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne | |||
2138 | break; | 2138 | break; |
2139 | default: | 2139 | default: |
2140 | break; | 2140 | break; |
2141 | 2141 | ||
2142 | } | 2142 | } |
2143 | 2143 | ||
2144 | 2144 | ||
2145 | /* This is not necessarily an error - turns out the higher layers will do | 2145 | /* This is not necessarily an error - turns out the higher layers will do |
2146 | * some ioctls itself (see comment above) | 2146 | * some ioctls itself (see comment above) |
2147 | */ | 2147 | */ |
2148 | dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd); | 2148 | dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __FUNCTION__, cmd); |
@@ -2199,7 +2199,7 @@ static int __init ftdi_init (void) | |||
2199 | if (retval) | 2199 | if (retval) |
2200 | goto failed_sio_register; | 2200 | goto failed_sio_register; |
2201 | retval = usb_register(&ftdi_driver); | 2201 | retval = usb_register(&ftdi_driver); |
2202 | if (retval) | 2202 | if (retval) |
2203 | goto failed_usb_register; | 2203 | goto failed_usb_register; |
2204 | 2204 | ||
2205 | info(DRIVER_VERSION ":" DRIVER_DESC); | 2205 | info(DRIVER_VERSION ":" DRIVER_DESC); |