move generic kernel build parts out of board support patches
[openwrt.git] / target / linux / linux-2.4 / patches / generic / 211-pl2303_bugfixes.patch
1 --- linux/drivers/usb/serial/pl2303.c.orig 2005-10-17 12:09:48.000000000 +0200
2 +++ linux/drivers/usb/serial/pl2303.c 2005-10-19 04:10:46.000000000 +0200
3 @@ -14,6 +14,13 @@
4 * See Documentation/usb/usb-serial.txt for more information on using this driver
5 *
6 *
7 + * 2005_Oct_19 grsch
8 + * added some missing ioctl commands
9 + * it seems that there's still an issue with the 2.6.8 version when
10 + * using the device with echo "whatever" >/dev/usb/tts/0 .
11 + * Apparently, a timeout is needed upon pl2303_close (implemented in
12 + * 2.6.13.4)
13 + *
14 * 2005_Mar_05 grsch
15 * ported 2.6.8 pl2303.c to 2.4.20 format
16 * (HX model works fine now, ID table should be brought up to date)
17 @@ -142,9 +149,8 @@
18 static int pl2303_write (struct usb_serial_port *port, int from_user,
19 const unsigned char *buf, int count);
20 static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
21 -static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file);
22 -static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
23 - unsigned int set, unsigned int clear);
24 +static int pl2303_tiocmget (struct usb_serial_port *port, unsigned int* value);
25 +static int pl2303_tiocmset (struct usb_serial_port *port, unsigned int cmd, unsigned int *value);
26 static int pl2303_startup (struct usb_serial *serial);
27 static void pl2303_shutdown (struct usb_serial *serial);
28
29 @@ -642,11 +648,108 @@
30 return 0;
31 }
32
33 +
34 +
35 +static int pl2303_tiocmget (struct usb_serial_port *port, unsigned int *value)
36 +{
37 + struct pl2303_private *priv = usb_get_serial_port_data(port);
38 + unsigned long flags;
39 + unsigned int mcr;
40 + unsigned int status;
41 + unsigned int result;
42 +
43 + dbg("%s (%d)", __FUNCTION__, port->number);
44 +
45 + spin_lock_irqsave (&priv->lock, flags);
46 + mcr = priv->line_control;
47 + status = priv->line_status;
48 + spin_unlock_irqrestore (&priv->lock, flags);
49 +
50 + result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
51 + | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0)
52 + | ((status & UART_CTS) ? TIOCM_CTS : 0)
53 + | ((status & UART_DSR) ? TIOCM_DSR : 0)
54 + | ((status & UART_RING) ? TIOCM_RI : 0)
55 + | ((status & UART_DCD) ? TIOCM_CD : 0);
56 +
57 + dbg("%s - result = %x", __FUNCTION__, result);
58 +
59 + if (copy_to_user(value, &result, sizeof(int)))
60 + return -EFAULT;
61 + return 0;
62 +}
63 +
64 +
65 +
66 +static int pl2303_tiocmset (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
67 +{
68 + /*
69 + struct pl2303_private *priv = usb_get_serial_port_data(port);
70 + unsigned long flags;
71 + u8 control;
72 +
73 + spin_lock_irqsave (&priv->lock, flags);
74 + if (set & TIOCM_RTS)
75 + priv->line_control |= CONTROL_RTS;
76 + if (set & TIOCM_DTR)
77 + priv->line_control |= CONTROL_DTR;
78 + if (clear & TIOCM_RTS)
79 + priv->line_control &= ~CONTROL_RTS;
80 + if (clear & TIOCM_DTR)
81 + priv->line_control &= ~CONTROL_DTR;
82 + control = priv->line_control;
83 + spin_unlock_irqrestore (&priv->lock, flags);
84 +
85 + return set_control_lines (port->serial->dev, control);
86 + */
87 + struct pl2303_private *priv = port->private;
88 + unsigned int arg;
89 +
90 + if (copy_from_user(&arg, value, sizeof(int)))
91 + return -EFAULT;
92 +
93 + switch (cmd) {
94 + case TIOCMBIS:
95 + if (arg & TIOCM_RTS)
96 + priv->line_control |= CONTROL_RTS;
97 + if (arg & TIOCM_DTR)
98 + priv->line_control |= CONTROL_DTR;
99 + break;
100 +
101 + case TIOCMBIC:
102 + if (arg & TIOCM_RTS)
103 + priv->line_control &= ~CONTROL_RTS;
104 + if (arg & TIOCM_DTR)
105 + priv->line_control &= ~CONTROL_DTR;
106 + break;
107 +
108 + case TIOCMSET:
109 + /* turn off RTS and DTR and then only turn
110 + on what was asked to */
111 + priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
112 + priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
113 + priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
114 + break;
115 + }
116 +
117 + return set_control_lines (port->serial->dev, priv->line_control);
118 +}
119 +
120 +
121 +
122 static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg)
123 {
124 dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
125
126 switch (cmd) {
127 + case TIOCMGET:
128 + dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
129 + return pl2303_tiocmget(port,(unsigned int *)arg);
130 + case TIOCMBIS:
131 + case TIOCMBIC:
132 + case TIOCMSET:
133 + dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
134 + return pl2303_tiocmset(port,cmd,(unsigned int*)arg);
135 case TIOCMIWAIT:
136 dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number);
137 return wait_modem_info(port, arg);
138 @@ -705,6 +808,8 @@
139
140 dbg("%s (%d)", __FUNCTION__, port->number);
141
142 + dbg("%s - urb status %d...", __FUNCTION__, urb->status);
143 +
144 switch (urb->status) {
145 case 0:
146 /* success */
This page took 0.053184 seconds and 5 git commands to generate.