--- zzzz-none-000/linux-2.6.28.10/drivers/usb/serial/option.c 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/drivers/usb/serial/option.c 2012-02-14 14:37:49.000000000 +0000 @@ -43,6 +43,9 @@ #include /* Function prototypes */ +/* AVM/WK: Patch from AVM Kernel 2.6.19 */ +static int option_probe(struct usb_serial *serial, const struct usb_device_id *id); + static int option_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); static void option_close(struct tty_struct *tty, struct usb_serial_port *port, @@ -63,6 +66,25 @@ unsigned int set, unsigned int clear); static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *port); +/*== AVM/WK 20100727 Use params instead of default tables ==*/ +#define OPTION_USE_ID_PARAMS +#ifdef OPTION_USE_ID_PARAMS +static __u16 vendor = 0; +static __u16 product = 0; + +module_param(vendor, ushort, 0); +MODULE_PARM_DESC(vendor, "User specified USB idVendor"); + +module_param(product, ushort, 0); +MODULE_PARM_DESC(product, "User specified USB idProduct"); + +static struct usb_device_id option_param_ids[] = { + { }, + { } /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE(usb, option_param_ids); +#else /* Vendor and product IDs */ #define OPTION_VENDOR_ID 0x0AF0 #define OPTION_PRODUCT_COLT 0x5000 @@ -91,9 +113,20 @@ #define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100 #define OPTION_PRODUCT_GTM380_MODEM 0x7201 +#define OPTION_PRODUCT_ICON_225 0x6971 +#define OPTION_PRODUCT_ICON_7_2 0x6911 +#define OPTION_PRODUCT_ICON_HSUPA 0x7251 +#define OPTION_PRODUCT_ICON_401 0x7401 + +#define OPTION_VENDOR_ID_I210 0x1E0E +#define OPTION_PRODUCT_ICON_210 0x9000 + + #define HUAWEI_VENDOR_ID 0x12D1 #define HUAWEI_PRODUCT_E600 0x1001 #define HUAWEI_PRODUCT_E220 0x1003 +#define HUAWEI_PRODUCT_E182 0x14AC + #define HUAWEI_PRODUCT_E220BIS 0x1004 #define HUAWEI_PRODUCT_E1401 0x1401 #define HUAWEI_PRODUCT_E1402 0x1402 @@ -278,6 +311,12 @@ #define MAXON_VENDOR_ID 0x16d8 +/* 4 G Systems PRODUCTS */ +#define FOUR_G_SYSTEMS_VENDOR_ID MAXON_VENDOR_ID +#define FOUR_G_SYSTEMS_2ND_VENDOR_ID 0x1c9e +#define _4GSYSTEMS_PRODUCT_XSW12 0x628a +#define _4GSYSTEMS_PRODUCT_XSW14 0x9603 + #define TELIT_VENDOR_ID 0x1bc7 #define TELIT_PRODUCT_UC864E 0x1003 @@ -286,8 +325,21 @@ #define ZTE_PRODUCT_MF622 0x0001 #define ZTE_PRODUCT_MF628 0x0015 #define ZTE_PRODUCT_MF626 0x0031 +#define ZTE_PRODUCT_K3565 0x0063 #define ZTE_PRODUCT_CDMA_TECH 0xfffe +/* Sierra Wireless */ +#define SIERRAWIRELESS_VENDOR_ID 0x1199 +#define SIERRAWIRELESS_PRODUCT_C885 0x6880 + +/* NOKIA*/ +#define NOKIA_VENDOR_ID 0x0421 +#define NOKIA_PRODUCT_CS_15 0x0612 + +/* Alcatel*/ +#define ALCATEL_VENDOR_ID 0x1bbb +#define ALCATEL_PRODUCT_X200S 0x0000 + #define BENQ_VENDOR_ID 0x04a5 #define BENQ_PRODUCT_H10 0x4068 @@ -317,6 +369,13 @@ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTM380_MODEM) }, + + { USB_DEVICE(OPTION_VENDOR_ID_I210, OPTION_PRODUCT_ICON_210) }, + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ICON_225) }, + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ICON_7_2) }, + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ICON_HSUPA) }, + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ICON_401) }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, @@ -383,6 +442,7 @@ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E182, 0xff, 0xff, 0xff) }, { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ @@ -500,18 +560,30 @@ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622) }, { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) }, { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_K3565) }, { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ + { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_C885) }, + { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, _4GSYSTEMS_PRODUCT_XSW12) }, + { USB_DEVICE(FOUR_G_SYSTEMS_2ND_VENDOR_ID, _4GSYSTEMS_PRODUCT_XSW14) }, + { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA_PRODUCT_CS_15) }, + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X200S) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); +#endif static struct usb_driver option_driver = { .name = "option", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, +/*== AVM/WK 20100727 Use params instead of default tables ==*/ +#ifdef OPTION_USE_ID_PARAMS + .id_table = option_param_ids, +#else .id_table = option_ids, +#endif .no_dynamic_id = 1, }; @@ -526,8 +598,14 @@ }, .description = "GSM modem (1-port)", .usb_driver = &option_driver, +/*== AVM/WK 20100727 Use params instead of default tables ==*/ +#ifdef OPTION_USE_ID_PARAMS + .id_table = option_param_ids, +#else .id_table = option_ids, +#endif .num_ports = 1, + .probe = option_probe, .open = option_open, .close = option_close, .write = option_write, @@ -548,7 +626,7 @@ #define N_IN_URB 4 #define N_OUT_URB 1 #define IN_BUFLEN 4096 -#define OUT_BUFLEN 128 +#define OUT_BUFLEN 4096 struct option_port_private { /* Input endpoints and buffer for this port */ @@ -573,7 +651,20 @@ /* Functions used by new usb-serial code. */ static int __init option_init(void) { - int retval; + int retval= -ENODEV; + /*== AVM/WK 20100727 Use params instead of default tables ==*/ +#ifdef OPTION_USE_ID_PARAMS + if (vendor == 0) { + printk (KERN_ERR "option: vendor and product params missing!\n"); + return retval; + } + printk (KERN_INFO "option: use params vendor=%x product=%x\n", vendor, product); + + option_param_ids[0].idVendor = vendor; + option_param_ids[0].idProduct = product; + option_param_ids[0].match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; +#endif + retval = usb_serial_register(&option_1port_device); if (retval) goto failed_1port_device_register; @@ -868,6 +959,41 @@ return data_len; } +/* AVM/WK 20100422 Patch taken from AVM Kernel 2.6.19 */ +/* NEW: AVM/WK: 20081013: Patch for some UMTS Sticks */ +static int option_probe(struct usb_serial *serial, + const struct usb_device_id *id) +{ + struct usb_host_interface *iface_desc = serial->interface->cur_altsetting; + struct usb_endpoint_descriptor *endpoint; + int num_bulk_out=0; + int num_bulk_in=0; + int i; + + if (iface_desc->desc.bInterfaceClass == 8) { + return -ENODEV; + } + + for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { + endpoint = &iface_desc->endpoint[i].desc; + if ((endpoint->bmAttributes & 0x03) == 0x02) { + if (endpoint->bEndpointAddress & 0x80) { + ++num_bulk_in; + } else { + ++num_bulk_out; + } + } + } + + /* we need both directions */ + if (num_bulk_out == 0 || num_bulk_in == 0) { + dbg("Invalid interface, discarding"); + return -ENODEV; + } + + return 0; +} + static int option_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp) {