2 * Nokia DKU2 USB driver
7 * This program is largely derived from work by the linux-usb group
8 * and associated source files. Please see the usb/serial files for
9 * individual credits and copyrights.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de>
17 * Added short name to device structure to make driver load into kernel 2.6.13
19 * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de>
20 * Added usb_deregister to exit code - to allow remove and reinsert of module
24 #include <linux/config.h>
25 #include <linux/kernel.h>
26 #include <linux/errno.h>
27 #include <linux/init.h>
28 #include <linux/slab.h>
29 #include <linux/tty.h>
30 #include <linux/tty_driver.h>
31 #include <linux/tty_flip.h>
32 #include <linux/module.h>
33 #include <linux/usb.h>
34 #include "usb-serial.h"
37 #define NOKIA_VENDOR_ID 0x0421
38 #define NOKIA7600_PRODUCT_ID 0x0400
39 #define NOKIA6230_PRODUCT_ID 0x040f
40 #define NOKIA6170_PRODUCT_ID 0x0416
41 #define NOKIA6670_PRODUCT_ID 0x041d
42 #define NOKIA6680_PRODUCT_ID 0x041e
43 #define NOKIA6230i_PRODUCT_ID 0x0428
45 #define NOKIA_AT_PORT 0x82
46 #define NOKIA_FBUS_PORT 0x86
51 #define DRIVER_VERSION "v0.2"
52 #define DRIVER_AUTHOR "C Kemp"
53 #define DRIVER_DESC "Nokia DKU2 Driver"
55 static struct usb_device_id id_table [] = {
56 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA7600_PRODUCT_ID) },
57 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230_PRODUCT_ID) },
58 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6170_PRODUCT_ID) },
59 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6670_PRODUCT_ID) },
60 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6680_PRODUCT_ID) },
61 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230i_PRODUCT_ID) },
62 { } /* Terminating entry */
64 MODULE_DEVICE_TABLE(usb, id_table);
66 /* The only thing which makes this device different from a generic
67 * device is that we have to set an alternative configuration to make
68 * the relevant endpoints available. In 2.6 this is really easy... */
69 static int nokia_probe(struct usb_serial *serial,
70 const struct usb_device_id *id)
74 if (serial->interface->altsetting[0].endpoint[0].desc.bEndpointAddress == NOKIA_AT_PORT) {
76 dev_info(&serial->dev->dev, "Nokia AT Port:\n");
78 } else if (serial->interface->num_altsetting == 2 &&
79 serial->interface->altsetting[1].endpoint[0].desc.bEndpointAddress == NOKIA_FBUS_PORT) {
81 dev_info(&serial->dev->dev, "Nokia FBUS Port:\n");
82 usb_set_interface(serial->dev, 10, 1);
89 static struct usb_driver nokia_driver = {
92 .probe = usb_serial_probe,
93 .disconnect = usb_serial_disconnect,
97 static struct usb_serial_driver nokia_serial_driver = {
100 .name = "nokia_dku2",
102 .description = "Nokia 7600/6230(i)/6170/66x0 DKU2 driver",
103 .id_table = id_table,
104 .num_interrupt_in = 1,
108 .probe = nokia_probe,
111 static int __init nokia_init(void)
115 retval = usb_serial_register(&nokia_serial_driver);
119 retval = usb_register(&nokia_driver);
121 usb_serial_deregister(&nokia_serial_driver);
125 info(DRIVER_VERSION " " DRIVER_AUTHOR);
131 static void __exit nokia_exit(void)
133 usb_deregister(&nokia_driver);
134 usb_serial_deregister(&nokia_serial_driver);
137 module_init(nokia_init);
138 module_exit(nokia_exit);
140 MODULE_AUTHOR(DRIVER_AUTHOR);
141 MODULE_DESCRIPTION(DRIVER_DESC);
142 MODULE_LICENSE("GPL");