diff -u /home/rsidd/linux-2.6.7/drivers/usb/serial/bus.c serial/bus.c --- /home/rsidd/linux-2.6.7/drivers/usb/serial/bus.c 2004-06-16 10:50:26.000000000 +0530 +++ serial/bus.c 2004-08-14 16:26:24.000000000 +0530 @@ -14,13 +14,6 @@ #include #include #include - -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else - static int debug; -#endif - #include "usb-serial.h" static int usb_serial_device_match (struct device *dev, struct device_driver *drv) @@ -78,8 +71,8 @@ minor = port->number; tty_register_device (usb_serial_tty_driver, minor, dev); dev_info(&port->serial->dev->dev, - "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n", - driver->name, minor, minor); + "%s converter now attached to ttyUSB%d\n", + driver->name, minor); exit: return retval; Only in serial: .Makefile.swp diff -u /home/rsidd/linux-2.6.7/drivers/usb/serial/pl2303.c serial/pl2303.c --- /home/rsidd/linux-2.6.7/drivers/usb/serial/pl2303.c 2004-06-16 10:49:22.000000000 +0530 +++ serial/pl2303.c 2004-08-14 16:25:31.000000000 +0530 @@ -49,23 +49,16 @@ #include #include #include - -#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 int debug; static struct usb_device_id id_table [] = { { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, @@ -82,6 +75,7 @@ { 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) }, { } /* Terminating entry */ }; @@ -172,20 +166,38 @@ .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) @@ -193,6 +205,7 @@ memset (priv, 0x00, sizeof (struct pl2303_private)); spin_lock_init(&priv->lock); init_waitqueue_head(&priv->delta_msr_wait); + priv->type = type; usb_set_serial_port_data(serial->port[i], priv); } return 0; @@ -231,7 +244,7 @@ memcpy (port->write_urb->transfer_buffer, buf, count); } - usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer); port->write_urb->transfer_buffer_length = count; port->write_urb->dev = port->serial->dev; @@ -395,20 +408,27 @@ 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 = usb_get_serial_port_data(port); unsigned char *buf; int result; @@ -439,6 +459,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); @@ -677,7 +709,7 @@ } - usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer); + usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); if (urb->actual_length < UART_STATE) goto exit; @@ -731,7 +763,7 @@ return; } - usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); + usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); /* get tty_flag from status */ tty_flag = TTY_NORMAL; diff -u /home/rsidd/linux-2.6.7/drivers/usb/serial/pl2303.h serial/pl2303.h --- /home/rsidd/linux-2.6.7/drivers/usb/serial/pl2303.h 2004-06-16 10:49:35.000000000 +0530 +++ serial/pl2303.h 2004-08-14 16:25:33.000000000 +0530 @@ -42,5 +42,11 @@ #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 + diff -u /home/rsidd/linux-2.6.7/drivers/usb/serial/usb-serial.c serial/usb-serial.c --- /home/rsidd/linux-2.6.7/drivers/usb/serial/usb-serial.c 2004-06-16 10:49:17.000000000 +0530 +++ serial/usb-serial.c 2004-08-14 16:26:26.000000000 +0530 @@ -336,14 +336,6 @@ #include #include #include - - -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else - static int debug; -#endif - #include "usb-serial.h" #include "pl2303.h" @@ -354,26 +346,12 @@ #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" #define DRIVER_DESC "USB Serial Driver core" - -#ifdef CONFIG_USB_SERIAL_GENERIC -/* we want to look at all devices, as the vendor/product id can change - * depending on the command line argument */ -static struct usb_device_id generic_serial_ids[] = { - {.driver_info = 42}, - {} -}; - -#endif /* CONFIG_USB_SERIAL_GENERIC */ - /* Driver structure we register with the USB core */ static struct usb_driver usb_serial_driver = { .owner = THIS_MODULE, .name = "usbserial", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, -#ifdef CONFIG_USB_SERIAL_GENERIC - .id_table = generic_serial_ids, -#endif }; /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead @@ -383,10 +361,10 @@ drivers depend on it. */ -static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ +static int debug; +static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ static LIST_HEAD(usb_serial_driver_list); - struct usb_serial *usb_serial_get_by_index(unsigned index) { struct usb_serial *serial = serial_table[index]; @@ -1383,22 +1361,9 @@ void usb_serial_deregister(struct usb_serial_device_type *device) { - struct usb_serial *serial; - int i; - info("USB Serial deregistering driver %s", device->name); - - /* clear out the serial_table if the device is attached to a port */ - for(i = 0; i < SERIAL_TTY_MINORS; ++i) { - serial = serial_table[i]; - if ((serial != NULL) && (serial->type == device)) { - usb_driver_release_interface (&usb_serial_driver, serial->interface); - usb_serial_disconnect (serial->interface); - } - } - list_del(&device->driver_list); - usb_serial_bus_deregister (device); + usb_serial_bus_deregister(device); } diff -u /home/rsidd/linux-2.6.7/drivers/usb/serial/usb-serial.h serial/usb-serial.h --- /home/rsidd/linux-2.6.7/drivers/usb/serial/usb-serial.h 2004-06-16 10:50:26.000000000 +0530 +++ serial/usb-serial.h 2004-08-14 16:26:25.000000000 +0530 @@ -294,21 +294,21 @@ extern struct bus_type usb_serial_bus_type; extern struct tty_driver *usb_serial_tty_driver; -static inline void usb_serial_debug_data (const char *file, const char *function, int size, const unsigned char *data) +static inline void usb_serial_debug_data(int debug, + struct device *dev, + const char *function, int size, + const unsigned char *data) { int i; - if (!debug) - return; - - printk (KERN_DEBUG "%s: %s - length = %d, data = ", file, function, size); - for (i = 0; i < size; ++i) { - printk ("%.2x ", data[i]); + if (debug) { + dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); + for (i = 0; i < size; ++i) + printk ("%.2x ", data[i]); + printk ("\n"); } - printk ("\n"); } - /* Use our own dbg macro */ #undef dbg #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)