--- 202-pl2303_backport.patch 2005-07-17 13:21:43.000000000 +0300 +++ 202-pl2303_backport.patch.new 2005-07-17 14:03:08.000000000 +0300 @@ -1,6 +1,6 @@ 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 +--- 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 @@ -39,11 +39,10 @@ #include #include #include -@@ -46,43 +57,44 @@ - #include +@@ -47,42 +58,45 @@ #include #include -- + -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else @@ -56,7 +55,7 @@ /* * Version Information */ --#define DRIVER_VERSION "v0.10" +-#define DRIVER_VERSION "v0.10.1" /* Takes from 2.6's */ +#define DRIVER_VERSION "v0.11" #define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver" @@ -90,86 +89,38 @@ +/* +static struct usb_driver pl2303_driver = { -+ .owner = THIS_MODULE, -+ .name = "pl2303", -+ .probe = usb_serial_probe, -+ .disconnect = usb_serial_disconnect, -+ .id_table = id_table, ++ .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 @@ +@@ -130,6 +144,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, ++//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 @@ +@@ -195,8 +212,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; + priv->type = type; + serial->port[i].private = priv; } return 0; } -@@ -215,13 +252,13 @@ +@@ -234,13 +251,13 @@ memcpy (port->write_urb->transfer_buffer, buf, count); } @@ -185,7 +136,7 @@ else result = count; -@@ -233,7 +270,7 @@ +@@ -252,7 +269,7 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *old_termios) { struct usb_serial *serial = port->serial; @@ -194,7 +145,7 @@ unsigned long flags; unsigned int cflag; unsigned char *buf; -@@ -241,8 +278,7 @@ +@@ -260,8 +277,7 @@ int i; u8 control; @@ -204,7 +155,7 @@ if ((!port->tty) || (!port->tty->termios)) { dbg("%s - no tty structures", __FUNCTION__); -@@ -269,7 +305,7 @@ +@@ -288,7 +304,7 @@ buf = kmalloc (7, GFP_KERNEL); if (!buf) { @@ -213,7 +164,7 @@ return; } memset (buf, 0x00, 0x07); -@@ -311,7 +347,7 @@ +@@ -330,7 +346,7 @@ case B230400: baud = 230400; break; case B460800: baud = 460800; break; default: @@ -222,38 +173,8 @@ 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; +@@ -424,9 +440,6 @@ + struct pl2303_private *priv = port->private; int result; - if (port_paranoia_check (port, __FUNCTION__)) @@ -262,26 +183,7 @@ 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 @@ +@@ -480,7 +493,7 @@ port->read_urb->dev = serial->dev; result = usb_submit_urb (port->read_urb); if (result) { @@ -290,7 +192,7 @@ pl2303_close (port, NULL); return -EPROTO; } -@@ -450,7 +502,7 @@ +@@ -489,7 +502,7 @@ port->interrupt_in_urb->dev = serial->dev; result = usb_submit_urb (port->interrupt_in_urb); if (result) { @@ -299,7 +201,7 @@ pl2303_close (port, NULL); return -EPROTO; } -@@ -460,125 +512,103 @@ +@@ -499,125 +512,103 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp) { @@ -390,7 +292,9 @@ - - if (copy_from_user(&arg, value, sizeof(int))) - return -EFAULT; -- ++ struct pl2303_private *priv = port->private; ++ unsigned int arg; + - spin_lock_irqsave (&priv->lock, flags); - switch (cmd) { - case TIOCMBIS: @@ -406,9 +310,7 @@ - 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 */ @@ -498,7 +400,7 @@ unsigned long flags; unsigned int prevstatus; unsigned int status; -@@ -617,21 +647,10 @@ +@@ -656,21 +647,10 @@ dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd); switch (cmd) { @@ -521,7 +423,7 @@ default: dbg("%s not supported = 0x%04x", __FUNCTION__, cmd); break; -@@ -652,7 +671,7 @@ +@@ -691,7 +671,7 @@ state = BREAK_OFF; else state = BREAK_ON; @@ -530,7 +432,7 @@ result = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0), BREAK_REQUEST, BREAK_REQUEST_TYPE, state, -@@ -669,8 +688,8 @@ +@@ -708,8 +688,8 @@ dbg("%s", __FUNCTION__); for (i = 0; i < serial->num_ports; ++i) { @@ -541,7 +443,7 @@ } } -@@ -678,16 +697,14 @@ +@@ -717,16 +697,14 @@ static void pl2303_read_int_callback (struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *) urb->context; @@ -560,7 +462,7 @@ switch (urb->status) { case 0: /* success */ -@@ -700,17 +717,14 @@ +@@ -739,17 +717,14 @@ return; default: dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); @@ -581,7 +483,7 @@ /* Save off the uart status for others to look at */ uart_state = data[UART_STATE]; -@@ -718,17 +732,19 @@ +@@ -757,17 +732,19 @@ uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK); priv->line_status = uart_state; spin_unlock_irqrestore(&priv->lock, flags); @@ -606,7 +508,7 @@ struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; unsigned long flags; -@@ -737,16 +753,8 @@ +@@ -776,16 +753,8 @@ u8 status; char tty_flag; @@ -623,7 +525,7 @@ if (urb->status) { dbg("%s - urb->status = %d", __FUNCTION__, urb->status); if (!port->open_count) { -@@ -757,17 +765,17 @@ +@@ -796,17 +765,17 @@ /* PL2303 mysteriously fails with -EPROTO reschedule the read */ dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); urb->status = 0; @@ -644,7 +546,7 @@ /* get tty_flag from status */ tty_flag = TTY_NORMAL; -@@ -776,7 +784,7 @@ +@@ -815,7 +784,7 @@ status = priv->line_status; priv->line_status &= ~UART_STATE_TRANSIENT_MASK; spin_unlock_irqrestore(&priv->lock, flags); @@ -653,7 +555,7 @@ /* break takes precedence over parity, */ /* which takes precedence over framing errors */ -@@ -805,10 +813,10 @@ +@@ -844,10 +813,10 @@ /* Schedule the next read _if_ we are still open */ if (port->open_count) { @@ -666,7 +568,7 @@ } return; -@@ -821,44 +829,32 @@ +@@ -860,44 +829,32 @@ struct usb_serial_port *port = (struct usb_serial_port *) urb->context; int result; @@ -715,24 +617,8 @@ } -@@ -877,3 +873,4 @@ +@@ -916,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 @@ - - #define SITECOM_VENDOR_ID 0x6189 - #define SITECOM_PRODUCT_ID 0x2068 -+ -+/* Alcatel OT535/735 USB cable */ -+#define ALCATEL_VENDOR_ID 0x11f7 -+#define ALCATEL_PRODUCT_ID 0x02df -+ -+/* Samsung I330 phone cradle */ -+#define SAMSUNG_VENDOR_ID 0x04e8 -+#define SAMSUNG_PRODUCT_ID 0x8001 -+