1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

update the 2.4 kernel to 2.4.32. it seems pl2303 has the fixes from 2.6, so we now only add the new ids. gcc4 fixes will come later

git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2515 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
kaloz
2005-11-18 11:40:36 +00:00
parent 10e169b96d
commit 1657a14f25
8 changed files with 2582 additions and 2559 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,729 +1,22 @@
diff -rNu linux-2.4.29.old/drivers/usb/serial/pl2303.c linux-2.4.29/drivers/usb/serial/pl2303.c
--- linux-2.4.29.old/drivers/usb/serial/pl2303.c 2005-03-22 14:48:04.000000000 +0100
+++ linux-2.4.29/drivers/usb/serial/pl2303.c 2005-03-22 15:33:05.735943352 +0100
@@ -1,7 +1,7 @@
/*
* Prolific PL2303 USB to serial adaptor driver
*
- * Copyright (C) 2001-2003 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (C) 2003 IBM Corp.
*
* Original driver for 2.2.x by anonymous
@@ -12,8 +12,16 @@
* (at your option) any later version.
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
- * 2003_Apr_24 gkh
- * Added line error reporting support. Hopefully it is correct...
+ *
+ *
+ * 2005_Mar_05 grsch
+ * ported 2.6.8 pl2303.c to 2.4.20 format
+ * (HX model works fine now, ID table should be brought up to date)
+ * Gregor Schaffrath <gschaff@ran-dom.org>
+ *
+ * 2002_Mar_26 gkh
+ * allowed driver to work properly if there is no tty assigned to a port
+ * (this happens for serial console devices.)
*
* 2001_Oct_06 gkh
* Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it.
@@ -33,6 +41,9 @@
*
*/
+static int debug;
+
+
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -46,43 +57,44 @@
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- static int debug = 1;
-#else
- static int debug;
-#endif
-
#include "usb-serial.h"
#include "pl2303.h"
/*
* Version Information
*/
-#define DRIVER_VERSION "v0.10"
+#define DRIVER_VERSION "v0.11"
#define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
-
-
static struct usb_device_id id_table [] = {
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
- { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
{ USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) },
{ USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
- { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
- { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
- { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
- { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
- { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
+ { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
+ { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
+ { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
+ { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
+ { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
+ { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
diff -ur linux-2.4.32/drivers/usb/serial/pl2303.c linux-2.4.32.openwrt/drivers/usb/serial/pl2303.c
--- linux-2.4.32/drivers/usb/serial/pl2303.c 2005-06-01 02:56:56.000000000 +0200
+++ linux-2.4.32.openwrt/drivers/usb/serial/pl2303.c 2005-11-18 12:22:23.000000000 +0100
@@ -78,6 +78,11 @@
{ USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
{ USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
{ USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
+ { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
+ { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
+ { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
+ { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, id_table);
+/*
+static struct usb_driver pl2303_driver = {
+ .owner = THIS_MODULE,
+ .name = "pl2303",
+ .probe = usb_serial_probe,
+ .disconnect = usb_serial_disconnect,
+ .id_table = id_table,
+};
+*/
#define SET_LINE_REQUEST_TYPE 0x21
#define SET_LINE_REQUEST 0x20
@@ -130,6 +142,9 @@
static int pl2303_write (struct usb_serial_port *port, int from_user,
const unsigned char *buf, int count);
static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
+static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file);
+static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
+ unsigned int set, unsigned int clear);
static int pl2303_startup (struct usb_serial *serial);
static void pl2303_shutdown (struct usb_serial *serial);
@@ -149,27 +164,48 @@
.ioctl = pl2303_ioctl,
.break_ctl = pl2303_break_ctl,
.set_termios = pl2303_set_termios,
+ //.tiocmget = pl2303_tiocmget,
+ //.tiocmset = pl2303_tiocmset,
.read_bulk_callback = pl2303_read_bulk_callback,
.read_int_callback = pl2303_read_int_callback,
.write_bulk_callback = pl2303_write_bulk_callback,
+ //.attach = pl2303_startup,
.startup = pl2303_startup,
.shutdown = pl2303_shutdown,
};
+enum pl2303_type {
+ type_0, /* don't know the difference between type 0 and */
+ type_1, /* type 1, until someone from prolific tells us... */
+ HX, /* HX version of the pl2303 chip */
+};
+
struct pl2303_private {
spinlock_t lock;
wait_queue_head_t delta_msr_wait;
u8 line_control;
u8 line_status;
u8 termios_initialized;
+ enum pl2303_type type;
};
static int pl2303_startup (struct usb_serial *serial)
{
struct pl2303_private *priv;
+ enum pl2303_type type = type_0;
int i;
+ if (serial->dev->descriptor.bDeviceClass == 0x02)
+ type = type_0;
+ else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)
+ type = HX;
+ else if (serial->dev->descriptor.bDeviceClass == 0x00)
+ type = type_1;
+ else if (serial->dev->descriptor.bDeviceClass == 0xFF)
+ type = type_1;
+ dbg("device type: %d", type);
+
for (i = 0; i < serial->num_ports; ++i) {
priv = kmalloc (sizeof (struct pl2303_private), GFP_KERNEL);
if (!priv)
@@ -177,7 +213,8 @@
memset (priv, 0x00, sizeof (struct pl2303_private));
spin_lock_init(&priv->lock);
init_waitqueue_head(&priv->delta_msr_wait);
- usb_set_serial_port_data(&serial->port[i], priv);
+ priv->type = type;
+ serial->port[i].private = priv;
}
return 0;
}
@@ -215,13 +252,13 @@
memcpy (port->write_urb->transfer_buffer, buf, count);
}
- usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
+ usb_serial_debug_data(__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
port->write_urb->transfer_buffer_length = count;
port->write_urb->dev = port->serial->dev;
result = usb_submit_urb (port->write_urb);
if (result)
- err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
+ err("%s - failed submitting write urb, error %d\n", __FUNCTION__, result);
else
result = count;
@@ -233,7 +270,7 @@
static void pl2303_set_termios (struct usb_serial_port *port, struct termios *old_termios)
{
struct usb_serial *serial = port->serial;
- struct pl2303_private *priv = usb_get_serial_port_data(port);
+ struct pl2303_private *priv = port->private;
unsigned long flags;
unsigned int cflag;
unsigned char *buf;
@@ -241,8 +278,7 @@
int i;
u8 control;
- dbg("%s - port %d, initialized = %d", __FUNCTION__, port->number,
- priv->termios_initialized);
+ dbg("%s - port %d", __FUNCTION__, port->number);
if ((!port->tty) || (!port->tty->termios)) {
dbg("%s - no tty structures", __FUNCTION__);
@@ -269,7 +305,7 @@
buf = kmalloc (7, GFP_KERNEL);
if (!buf) {
- err("%s - out of memory.", __FUNCTION__);
+ err("%s - out of memory.\n", __FUNCTION__);
return;
}
memset (buf, 0x00, 0x07);
@@ -311,7 +347,7 @@
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
default:
- err ("pl2303 driver does not support the baudrate requested (fix it)");
+ err("pl2303 driver does not support the baudrate requested (fix it)\n");
break;
}
dbg("%s - baud = %d", __FUNCTION__, baud);
@@ -380,26 +416,30 @@
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
if (cflag & CRTSCTS) {
- i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
- VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
- 0x0, 0x41, NULL, 0, 100);
- dbg ("0x40:0x1:0x0:0x41 %d", i);
+ __u16 index;
+ if (priv->type == HX)
+ index = 0x61;
+ else
+ index = 0x41;
+ i = usb_control_msg(serial->dev,
+ usb_sndctrlpipe(serial->dev, 0),
+ VENDOR_WRITE_REQUEST,
+ VENDOR_WRITE_REQUEST_TYPE,
+ 0x0, index, NULL, 0, 100);
+ dbg ("0x40:0x1:0x0:0x%x %d", index, i);
}
kfree (buf);
-}
-
+}
static int pl2303_open (struct usb_serial_port *port, struct file *filp)
{
struct termios tmp_termios;
struct usb_serial *serial = port->serial;
+ struct pl2303_private *priv = port->private;
unsigned char *buf;
int result;
- if (port_paranoia_check (port, __FUNCTION__))
- return -ENODEV;
-
dbg("%s - port %d", __FUNCTION__, port->number);
usb_clear_halt(serial->dev, port->write_urb->pipe);
@@ -427,6 +467,18 @@
SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 1);
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0, 1);
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 1, 0);
+
+ if (priv->type == HX) {
+ /* HX chip */
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x44);
+ /* reset upstream data pipes */
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 8, 0);
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 9, 0);
+ } else {
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x24);
+ }
kfree(buf);
@@ -441,7 +493,7 @@
port->read_urb->dev = serial->dev;
result = usb_submit_urb (port->read_urb);
if (result) {
- err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+ err("%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
pl2303_close (port, NULL);
return -EPROTO;
}
@@ -450,7 +502,7 @@
port->interrupt_in_urb->dev = serial->dev;
result = usb_submit_urb (port->interrupt_in_urb);
if (result) {
- err("%s - failed submitting interrupt urb, error %d", __FUNCTION__, result);
+ err("%s - failed submitting interrupt urb, error %d\n", __FUNCTION__, result);
pl2303_close (port, NULL);
return -EPROTO;
}
@@ -460,125 +512,103 @@
static void pl2303_close (struct usb_serial_port *port, struct file *filp)
{
- struct usb_serial *serial;
struct pl2303_private *priv;
unsigned long flags;
unsigned int c_cflag;
int result;
- if (port_paranoia_check (port, __FUNCTION__))
- return;
- serial = get_usb_serial (port, __FUNCTION__);
- if (!serial)
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
- if (serial->dev) {
- if (port->tty) {
- c_cflag = port->tty->termios->c_cflag;
- if (c_cflag & HUPCL) {
- /* drop DTR and RTS */
- priv = usb_get_serial_port_data(port);
- spin_lock_irqsave(&priv->lock, flags);
- priv->line_control = 0;
- spin_unlock_irqrestore (&priv->lock, flags);
- set_control_lines (port->serial->dev, 0);
- }
- }
+ /* shutdown our urbs */
+ dbg("%s - shutting down urbs", __FUNCTION__);
+ result = usb_unlink_urb (port->write_urb);
+ if (result)
+ dbg("%s - usb_unlink_urb (write_urb)"
+ " failed with reason: %d", __FUNCTION__,
+ result);
- /* shutdown our urbs */
- dbg("%s - shutting down urbs", __FUNCTION__);
- result = usb_unlink_urb (port->write_urb);
- if (result)
- dbg("%s - usb_unlink_urb (write_urb)"
- " failed with reason: %d", __FUNCTION__,
- result);
+ result = usb_unlink_urb (port->read_urb);
+ if (result)
+ dbg("%s - usb_unlink_urb (read_urb) "
+ "failed with reason: %d", __FUNCTION__,
+ result);
- result = usb_unlink_urb (port->read_urb);
- if (result)
- dbg("%s - usb_unlink_urb (read_urb) "
- "failed with reason: %d", __FUNCTION__,
- result);
+ result = usb_unlink_urb (port->interrupt_in_urb);
+ if (result)
+ dbg("%s - usb_unlink_urb (interrupt_in_urb)"
+ " failed with reason: %d", __FUNCTION__,
+ result);
- result = usb_unlink_urb (port->interrupt_in_urb);
- if (result)
- dbg("%s - usb_unlink_urb (interrupt_in_urb)"
- " failed with reason: %d", __FUNCTION__,
- result);
+ if (port->tty) {
+ c_cflag = port->tty->termios->c_cflag;
+ if (c_cflag & HUPCL) {
+ /* drop DTR and RTS */
+ priv = port->private;
+ spin_lock_irqsave(&priv->lock, flags);
+ priv->line_control = 0;
+ spin_unlock_irqrestore (&priv->lock, flags);
+ set_control_lines (port->serial->dev, 0);
+ }
}
+
}
+/* taken from 2.4.20 driver */
static int set_modem_info (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
{
- struct pl2303_private *priv = usb_get_serial_port_data(port);
- unsigned long flags;
- unsigned int arg;
- u8 control;
-
- if (copy_from_user(&arg, value, sizeof(int)))
- return -EFAULT;
-
- spin_lock_irqsave (&priv->lock, flags);
- switch (cmd) {
- case TIOCMBIS:
- if (arg & TIOCM_RTS)
- priv->line_control |= CONTROL_RTS;
- if (arg & TIOCM_DTR)
- priv->line_control |= CONTROL_DTR;
- break;
-
- case TIOCMBIC:
- if (arg & TIOCM_RTS)
- priv->line_control &= ~CONTROL_RTS;
- if (arg & TIOCM_DTR)
- priv->line_control &= ~CONTROL_DTR;
- break;
+ struct pl2303_private *priv = port->private;
+ unsigned int arg;
- case TIOCMSET:
- /* turn off RTS and DTR and then only turn
- on what was asked to */
- priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
- priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
- priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
- break;
- }
- control = priv->line_control;
- spin_unlock_irqrestore (&priv->lock, flags);
-
- return set_control_lines (port->serial->dev, control);
+ if (copy_from_user(&arg, value, sizeof(int)))
+ return -EFAULT;
+
+ switch (cmd) {
+ case TIOCMBIS:
+ if (arg & TIOCM_RTS)
+ priv->line_control |= CONTROL_RTS;
+ if (arg & TIOCM_DTR)
+ priv->line_control |= CONTROL_DTR;
+ break;
+
+ case TIOCMBIC:
+ if (arg & TIOCM_RTS)
+ priv->line_control &= ~CONTROL_RTS;
+ if (arg & TIOCM_DTR)
+ priv->line_control &= ~CONTROL_DTR;
+ break;
+
+ case TIOCMSET:
+ /* turn off RTS and DTR and then only turn
+ on what was asked to */
+ priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
+ priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
+ priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
+ break;
+ }
+
+ return set_control_lines (port->serial->dev, priv->line_control);
}
static int get_modem_info (struct usb_serial_port *port, unsigned int *value)
{
- struct pl2303_private *priv = usb_get_serial_port_data(port);
- unsigned long flags;
- unsigned int mcr;
- unsigned int status;
- unsigned int result;
-
- spin_lock_irqsave (&priv->lock, flags);
- mcr = priv->line_control;
- status = priv->line_status;
- spin_unlock_irqrestore (&priv->lock, flags);
-
- result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
- | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0)
- | ((status & UART_CTS) ? TIOCM_CTS : 0)
- | ((status & UART_DSR) ? TIOCM_DSR : 0)
- | ((status & UART_RING) ? TIOCM_RI : 0)
- | ((status & UART_DCD) ? TIOCM_CD : 0);
-
- dbg("%s - result = %x", __FUNCTION__, result);
-
- if (copy_to_user(value, &result, sizeof(int)))
- return -EFAULT;
- return 0;
+ struct pl2303_private *priv = port->private;
+ unsigned int mcr = priv->line_control;
+ unsigned int result;
+
+ result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
+ | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0);
+
+ dbg("%s - result = %x", __FUNCTION__, result);
+
+ if (copy_to_user(value, &result, sizeof(int)))
+ return -EFAULT;
+ return 0;
}
+/* end of 2.4.20 kernel part - grsch */
static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
{
- struct pl2303_private *priv = usb_get_serial_port_data(port);
+ struct pl2303_private *priv = port->private;
unsigned long flags;
unsigned int prevstatus;
unsigned int status;
@@ -617,21 +647,10 @@
dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
switch (cmd) {
-
- case TIOCMGET:
- dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
- return get_modem_info (port, (unsigned int *)arg);
-
- case TIOCMBIS:
- case TIOCMBIC:
- case TIOCMSET:
- dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
- return set_modem_info(port, cmd, (unsigned int *) arg);
-
case TIOCMIWAIT:
dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number);
return wait_modem_info(port, arg);
-
+
default:
dbg("%s not supported = 0x%04x", __FUNCTION__, cmd);
break;
@@ -652,7 +671,7 @@
state = BREAK_OFF;
else
state = BREAK_ON;
- dbg("%s - turning break %s", __FUNCTION__, state==BREAK_OFF ? "off" : "on");
+ dbg("%s - turning break %s", state==BREAK_OFF ? "off" : "on", __FUNCTION__);
result = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
@@ -669,8 +688,8 @@
dbg("%s", __FUNCTION__);
for (i = 0; i < serial->num_ports; ++i) {
- kfree (usb_get_serial_port_data(&serial->port[i]));
- usb_set_serial_port_data(&serial->port[i], NULL);
+ kfree (serial->port[i].private);
+ serial->port[i].private = NULL;
}
}
@@ -678,16 +697,14 @@
static void pl2303_read_int_callback (struct urb *urb)
{
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
- struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
- struct pl2303_private *priv = usb_get_serial_port_data(port);
+ struct pl2303_private *priv = port->private;
unsigned char *data = urb->transfer_buffer;
unsigned long flags;
+ int status;
u8 uart_state;
dbg("%s (%d)", __FUNCTION__, port->number);
- /* ints auto restart... */
-
switch (urb->status) {
case 0:
/* success */
@@ -700,17 +717,14 @@
return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
- return;
+ goto exit;
}
- if (!serial) {
- return;
- }
- usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
+ usb_serial_debug_data(__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
if (urb->actual_length < UART_STATE)
- return;
+ goto exit;
/* Save off the uart status for others to look at */
uart_state = data[UART_STATE];
@@ -718,17 +732,19 @@
uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK);
priv->line_status = uart_state;
spin_unlock_irqrestore(&priv->lock, flags);
- wake_up_interruptible (&priv->delta_msr_wait);
-
- return;
+
+exit:
+ status = usb_submit_urb (urb);
+ if (status)
+ err("%s - usb_submit_urb failed with result %d\n",
+ __FUNCTION__, status);
}
static void pl2303_read_bulk_callback (struct urb *urb)
{
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
- struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
- struct pl2303_private *priv = usb_get_serial_port_data(port);
+ struct pl2303_private *priv = port->private;
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
unsigned long flags;
@@ -737,16 +753,8 @@
u8 status;
char tty_flag;
- if (port_paranoia_check (port, __FUNCTION__))
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
- if (!serial) {
- dbg("%s - bad serial pointer, exiting", __FUNCTION__);
- return;
- }
-
if (urb->status) {
dbg("%s - urb->status = %d", __FUNCTION__, urb->status);
if (!port->open_count) {
@@ -757,17 +765,17 @@
/* PL2303 mysteriously fails with -EPROTO reschedule the read */
dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__);
urb->status = 0;
- urb->dev = serial->dev;
+ urb->dev = port->serial->dev;
result = usb_submit_urb(urb);
if (result)
- err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
+ err("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
return;
}
dbg("%s - unable to handle the error, exiting.", __FUNCTION__);
return;
}
- usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+ usb_serial_debug_data(__FILE__, __FUNCTION__, urb->actual_length, data);
/* get tty_flag from status */
tty_flag = TTY_NORMAL;
@@ -776,7 +784,7 @@
status = priv->line_status;
priv->line_status &= ~UART_STATE_TRANSIENT_MASK;
spin_unlock_irqrestore(&priv->lock, flags);
- wake_up_interruptible (&priv->delta_msr_wait); //AF from 2.6
+ wake_up_interruptible (&priv->delta_msr_wait);
/* break takes precedence over parity, */
/* which takes precedence over framing errors */
@@ -805,10 +813,10 @@
/* Schedule the next read _if_ we are still open */
if (port->open_count) {
- urb->dev = serial->dev;
+ urb->dev = port->serial->dev;
result = usb_submit_urb(urb);
if (result)
- err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
+ err("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
}
return;
@@ -821,44 +829,32 @@
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
int result;
- if (port_paranoia_check (port, __FUNCTION__))
- return;
-
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) {
/* error in the urb, so we have to resubmit it */
- if (serial_paranoia_check (port->serial, __FUNCTION__)) {
- return;
- }
dbg("%s - Overflow in write", __FUNCTION__);
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
port->write_urb->transfer_buffer_length = 1;
port->write_urb->dev = port->serial->dev;
result = usb_submit_urb (port->write_urb);
if (result)
- err("%s - failed resubmitting write urb, error %d", __FUNCTION__, result);
+ err("%s - failed resubmitting write urb, error %d\n", __FUNCTION__, result);
return;
}
- queue_task(&port->tqueue, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
- return;
+ queue_task(&port->tqueue, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
}
static int __init pl2303_init (void)
{
- int retval;
- retval = usb_serial_register(&pl2303_device);
- if (retval)
- goto failed_usb_serial_register;
+ usb_serial_register(&pl2303_device);
info(DRIVER_DESC " " DRIVER_VERSION);
return 0;
-failed_usb_serial_register:
- return retval;
}
@@ -877,3 +873,4 @@
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug enabled or not");
+//this is an error
diff -rNu linux-2.4.29.old/drivers/usb/serial/pl2303.h linux-2.4.29/drivers/usb/serial/pl2303.h
--- linux-2.4.29.old/drivers/usb/serial/pl2303.h 2005-03-22 14:48:04.000000000 +0100
+++ linux-2.4.29/drivers/usb/serial/pl2303.h 2005-03-22 15:33:05.758939856 +0100
@@ -41,3 +41,12 @@
diff -ur linux-2.4.32/drivers/usb/serial/pl2303.h linux-2.4.32.openwrt/drivers/usb/serial/pl2303.h
--- linux-2.4.32/drivers/usb/serial/pl2303.h 2004-02-18 14:36:31.000000000 +0100
+++ linux-2.4.32.openwrt/drivers/usb/serial/pl2303.h 2005-11-18 12:23:38.000000000 +0100
@@ -41,3 +41,18 @@
#define SITECOM_VENDOR_ID 0x6189
#define SITECOM_PRODUCT_ID 0x2068
@@ -733,6 +26,12 @@ diff -rNu linux-2.4.29.old/drivers/usb/serial/pl2303.h linux-2.4.29/drivers/usb/
+#define ALCATEL_PRODUCT_ID 0x02df
+
+/* Samsung I330 phone cradle */
+#define SAMSUNG_VENDOR_ID 0x04e8
+#define SAMSUNG_PRODUCT_ID 0x8001
+#define SAMSUNG_VENDOR_ID 0x04e8
+#define SAMSUNG_PRODUCT_ID 0x8001
+
+#define SYNTECH_VENDOR_ID 0x0745
+#define SYNTECH_PRODUCT_ID 0x0001
+
+/* Nokia CA-42 Cable */
+#define NOKIA_CA42_VENDOR_ID 0x078b
+#define NOKIA_CA42_PRODUCT_ID 0x1234

View File

@@ -1,198 +0,0 @@
diff -urN linux-2.4.30.old/drivers/i2c/i2c-core.c linux-2.4.30.dev/drivers/i2c/i2c-core.c
--- linux-2.4.30.old/drivers/i2c/i2c-core.c 2005-04-29 17:59:04.000000000 +0200
+++ linux-2.4.30.dev/drivers/i2c/i2c-core.c 2005-04-29 18:42:37.000000000 +0200
@@ -750,7 +750,7 @@
msg.addr = client->addr;
msg.flags = client->flags & I2C_M_TEN;
msg.len = count;
- (const char *)msg.buf = buf;
+ msg.buf = (__u8 *)buf;
DEB2(printk(KERN_DEBUG "i2c-core.o: master_send: writing %d bytes on %s.\n",
count,client->adapter->name));
@@ -780,7 +780,7 @@
msg.flags = client->flags & I2C_M_TEN;
msg.flags |= I2C_M_RD;
msg.len = count;
- msg.buf = buf;
+ msg.buf = (__u8 *)buf;
DEB2(printk(KERN_DEBUG "i2c-core.o: master_recv: reading %d bytes on %s.\n",
count,client->adapter->name));
diff -urN linux-2.4.30.old/drivers/usb/inode.c linux-2.4.30.dev/drivers/usb/inode.c
--- linux-2.4.30.old/drivers/usb/inode.c 2004-02-18 14:36:31.000000000 +0100
+++ linux-2.4.30.dev/drivers/usb/inode.c 2005-04-29 18:42:37.000000000 +0200
@@ -42,6 +42,8 @@
#include <asm/uaccess.h>
/* --------------------------------------------------------------------- */
+static struct file_operations usbdevfs_bus_file_operations;
+static struct inode_operations usbdevfs_bus_inode_operations;
/*
* This list of superblocks is still used,
diff -urN linux-2.4.30.old/include/asm-mips/uaccess.h linux-2.4.30.dev/include/asm-mips/uaccess.h
--- linux-2.4.30.old/include/asm-mips/uaccess.h 2005-01-19 15:10:12.000000000 +0100
+++ linux-2.4.30.dev/include/asm-mips/uaccess.h 2005-04-29 18:42:37.000000000 +0200
@@ -149,7 +149,7 @@
* Returns zero on success, or -EFAULT on error.
*/
#define put_user(x,ptr) \
- __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+ __put_user_check((x),(ptr),sizeof(*(ptr)))
/*
* get_user: - Get a simple variable from user space.
@@ -169,7 +169,7 @@
* On error, the variable @x is set to zero.
*/
#define get_user(x,ptr) \
- __get_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+ __get_user_check((x),(ptr),sizeof(*(ptr)))
/*
* __put_user: - Write a simple value into user space, with less checking.
@@ -191,7 +191,7 @@
* Returns zero on success, or -EFAULT on error.
*/
#define __put_user(x,ptr) \
- __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+ __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
/*
* __get_user: - Get a simple variable from user space, with less checking.
@@ -214,7 +214,7 @@
* On error, the variable @x is set to zero.
*/
#define __get_user(x,ptr) \
- __get_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+ __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
struct __large_struct { unsigned long buf[100]; };
#define __m(x) (*(struct __large_struct *)(x))
@@ -232,7 +232,7 @@
#define __get_user_nocheck(x,ptr,size) \
({ \
long __gu_err = 0; \
- __typeof(*(ptr)) __gu_val = 0; \
+ __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \
long __gu_addr; \
__gu_addr = (long) (ptr); \
switch (size) { \
diff -urN linux-2.4.30.old/include/linux/byteorder/swab.h linux-2.4.30.dev/include/linux/byteorder/swab.h
--- linux-2.4.30.old/include/linux/byteorder/swab.h 2002-11-29 00:53:15.000000000 +0100
+++ linux-2.4.30.dev/include/linux/byteorder/swab.h 2005-04-29 18:42:37.000000000 +0200
@@ -156,7 +156,7 @@
#endif /* OPTIMIZE */
-static __inline__ __const__ __u16 __fswab16(__u16 x)
+static __inline__ __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
@@ -169,7 +169,7 @@
__arch__swab16s(addr);
}
-static __inline__ __const__ __u32 __fswab24(__u32 x)
+static __inline__ __u32 __fswab24(__u32 x)
{
return __arch__swab24(x);
}
@@ -182,7 +182,7 @@
__arch__swab24s(addr);
}
-static __inline__ __const__ __u32 __fswab32(__u32 x)
+static __inline__ __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
@@ -196,7 +196,7 @@
}
#ifdef __BYTEORDER_HAS_U64__
-static __inline__ __const__ __u64 __fswab64(__u64 x)
+static __inline__ __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
__u32 h = x >> 32;
diff -urN linux-2.4.30.old/include/linux/fs.h linux-2.4.30.dev/include/linux/fs.h
--- linux-2.4.30.old/include/linux/fs.h 2005-04-29 17:59:08.000000000 +0200
+++ linux-2.4.30.dev/include/linux/fs.h 2005-04-29 18:42:37.000000000 +0200
@@ -1563,7 +1563,6 @@
unsigned long generate_cluster(kdev_t, int b[], int);
unsigned long generate_cluster_swab32(kdev_t, int b[], int);
extern kdev_t ROOT_DEV;
-extern char root_device_name[];
extern void show_buffers(void);
diff -urN linux-2.4.30.old/include/linux/i2c.h linux-2.4.30.dev/include/linux/i2c.h
--- linux-2.4.30.old/include/linux/i2c.h 2005-01-19 15:10:12.000000000 +0100
+++ linux-2.4.30.dev/include/linux/i2c.h 2005-04-29 18:42:37.000000000 +0200
@@ -70,7 +70,7 @@
/* Transfer num messages.
*/
-extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num);
+extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num);
/*
* Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
@@ -197,7 +197,7 @@
to NULL. If an adapter algorithm can do SMBus access, set
smbus_xfer. If set to NULL, the SMBus protocol is simulated
using common I2C messages */
- int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[],
+ int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
int num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write,
diff -urN linux-2.4.30.old/include/linux/usbdevice_fs.h linux-2.4.30.dev/include/linux/usbdevice_fs.h
--- linux-2.4.30.old/include/linux/usbdevice_fs.h 2003-11-28 19:26:21.000000000 +0100
+++ linux-2.4.30.dev/include/linux/usbdevice_fs.h 2005-04-29 18:42:37.000000000 +0200
@@ -185,8 +185,6 @@
extern struct file_operations usbdevfs_devices_fops;
extern struct file_operations usbdevfs_device_file_operations;
extern struct inode_operations usbdevfs_device_inode_operations;
-extern struct inode_operations usbdevfs_bus_inode_operations;
-extern struct file_operations usbdevfs_bus_file_operations;
extern void usbdevfs_conn_disc_event(void);
#endif /* __KERNEL__ */
diff -urN linux-2.4.30.old/include/net/icmp.h linux-2.4.30.dev/include/net/icmp.h
--- linux-2.4.30.old/include/net/icmp.h 2001-11-22 20:47:15.000000000 +0100
+++ linux-2.4.30.dev/include/net/icmp.h 2005-04-29 18:42:37.000000000 +0200
@@ -23,6 +23,7 @@
#include <net/sock.h>
#include <net/protocol.h>
+#include <net/snmp.h>
struct icmp_err {
int errno;
diff -urN linux-2.4.30.old/include/net/ipv6.h linux-2.4.30.dev/include/net/ipv6.h
--- linux-2.4.30.old/include/net/ipv6.h 2004-11-17 12:54:22.000000000 +0100
+++ linux-2.4.30.dev/include/net/ipv6.h 2005-04-29 18:42:37.000000000 +0200
@@ -19,6 +19,7 @@
#include <asm/hardirq.h>
#include <net/ndisc.h>
#include <net/flow.h>
+#include <net/snmp.h>
#define SIN6_LEN_RFC2133 24
diff -urN linux-2.4.30.old/include/linux/netfilter_ipv4/ip_tables.h linux-2.4.30.dev/include/linux/netfilter_ipv4/ip_tables.h
--- linux-2.4.30.old/include/linux/netfilter_ipv4/ip_tables.h 2005-04-29 17:59:08.000000000 +0200
+++ linux-2.4.30.dev/include/linux/netfilter_ipv4/ip_tables.h 2005-04-29 19:06:36.000000000 +0200
@@ -283,7 +283,7 @@
struct ipt_entry entrytable[0];
};
-extern struct semaphore ipt_mutex;
+// extern struct semaphore ipt_mutex;
/* Standard return verdict, or do jump. */
#define IPT_STANDARD_TARGET ""

View File

@@ -1,146 +0,0 @@
--- linux/drivers/usb/serial/pl2303.c.orig 2005-10-17 12:09:48.000000000 +0200
+++ linux/drivers/usb/serial/pl2303.c 2005-10-19 04:10:46.000000000 +0200
@@ -14,6 +14,13 @@
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
*
+ * 2005_Oct_19 grsch
+ * added some missing ioctl commands
+ * it seems that there's still an issue with the 2.6.8 version when
+ * using the device with echo "whatever" >/dev/usb/tts/0 .
+ * Apparently, a timeout is needed upon pl2303_close (implemented in
+ * 2.6.13.4)
+ *
* 2005_Mar_05 grsch
* ported 2.6.8 pl2303.c to 2.4.20 format
* (HX model works fine now, ID table should be brought up to date)
@@ -142,9 +149,8 @@
static int pl2303_write (struct usb_serial_port *port, int from_user,
const unsigned char *buf, int count);
static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
-static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file);
-static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
- unsigned int set, unsigned int clear);
+static int pl2303_tiocmget (struct usb_serial_port *port, unsigned int* value);
+static int pl2303_tiocmset (struct usb_serial_port *port, unsigned int cmd, unsigned int *value);
static int pl2303_startup (struct usb_serial *serial);
static void pl2303_shutdown (struct usb_serial *serial);
@@ -642,11 +648,108 @@
return 0;
}
+
+
+static int pl2303_tiocmget (struct usb_serial_port *port, unsigned int *value)
+{
+ struct pl2303_private *priv = usb_get_serial_port_data(port);
+ unsigned long flags;
+ unsigned int mcr;
+ unsigned int status;
+ unsigned int result;
+
+ dbg("%s (%d)", __FUNCTION__, port->number);
+
+ spin_lock_irqsave (&priv->lock, flags);
+ mcr = priv->line_control;
+ status = priv->line_status;
+ spin_unlock_irqrestore (&priv->lock, flags);
+
+ result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
+ | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0)
+ | ((status & UART_CTS) ? TIOCM_CTS : 0)
+ | ((status & UART_DSR) ? TIOCM_DSR : 0)
+ | ((status & UART_RING) ? TIOCM_RI : 0)
+ | ((status & UART_DCD) ? TIOCM_CD : 0);
+
+ dbg("%s - result = %x", __FUNCTION__, result);
+
+ if (copy_to_user(value, &result, sizeof(int)))
+ return -EFAULT;
+ return 0;
+}
+
+
+
+static int pl2303_tiocmset (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
+{
+ /*
+ struct pl2303_private *priv = usb_get_serial_port_data(port);
+ unsigned long flags;
+ u8 control;
+
+ spin_lock_irqsave (&priv->lock, flags);
+ if (set & TIOCM_RTS)
+ priv->line_control |= CONTROL_RTS;
+ if (set & TIOCM_DTR)
+ priv->line_control |= CONTROL_DTR;
+ if (clear & TIOCM_RTS)
+ priv->line_control &= ~CONTROL_RTS;
+ if (clear & TIOCM_DTR)
+ priv->line_control &= ~CONTROL_DTR;
+ control = priv->line_control;
+ spin_unlock_irqrestore (&priv->lock, flags);
+
+ return set_control_lines (port->serial->dev, control);
+ */
+ struct pl2303_private *priv = port->private;
+ unsigned int arg;
+
+ if (copy_from_user(&arg, value, sizeof(int)))
+ return -EFAULT;
+
+ switch (cmd) {
+ case TIOCMBIS:
+ if (arg & TIOCM_RTS)
+ priv->line_control |= CONTROL_RTS;
+ if (arg & TIOCM_DTR)
+ priv->line_control |= CONTROL_DTR;
+ break;
+
+ case TIOCMBIC:
+ if (arg & TIOCM_RTS)
+ priv->line_control &= ~CONTROL_RTS;
+ if (arg & TIOCM_DTR)
+ priv->line_control &= ~CONTROL_DTR;
+ break;
+
+ case TIOCMSET:
+ /* turn off RTS and DTR and then only turn
+ on what was asked to */
+ priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
+ priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
+ priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
+ break;
+ }
+
+ return set_control_lines (port->serial->dev, priv->line_control);
+}
+
+
+
static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg)
{
dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
switch (cmd) {
+ case TIOCMGET:
+ dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
+ return pl2303_tiocmget(port,(unsigned int *)arg);
+ case TIOCMBIS:
+ case TIOCMBIC:
+ case TIOCMSET:
+ dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
+ return pl2303_tiocmset(port,cmd,(unsigned int*)arg);
case TIOCMIWAIT:
dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number);
return wait_modem_info(port, arg);
@@ -705,6 +808,8 @@
dbg("%s (%d)", __FUNCTION__, port->number);
+ dbg("%s - urb status %d...", __FUNCTION__, urb->status);
+
switch (urb->status) {
case 0:
/* success */