1 /*****************************************************************************/
3 * auermain.c -- Auerswald PBX/System Telephone usb driver.
5 * Copyright (C) 2002-2004 Wolfgang Mües (wolfgang@iksw-muees.de)
7 * Very much code of this driver is borrowed from dabusb.c (Deti Fliegl)
8 * and from the USB Skeleton driver (Greg Kroah-Hartman). Thank you.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /*****************************************************************************/
26 /* Standard Linux module include files */
27 #include <linux/slab.h>
28 #include <linux/module.h>
29 #include <linux/init.h>
30 #include <linux/devfs_fs_kernel.h>
31 #undef DEBUG /* include debug macros until it's done */
32 #include <linux/usb.h>
33 #include "auerchain.h"
40 /*-------------------------------------------------------------------*/
43 #define dump( desc, adr, len) \
46 printk (KERN_DEBUG); \
48 for (u = 0; u < len; u++) \
49 printk (" %02X", adr[u] & 0xFF); \
53 #define dump( desc, adr, len)
56 /*-------------------------------------------------------------------*/
57 /* Version Information */
58 #define DRIVER_VERSION "1.2.7"
59 #define DRIVER_AUTHOR "Wolfgang Mües <wolfgang@iksw-muees.de>"
60 #define DRIVER_DESC "Auerswald PBX/System Telephone usb driver"
62 /*-------------------------------------------------------------------*/
63 /* Internal data structures */
65 /* the global usb devfs handle */
66 extern devfs_handle_t usb_devfs_handle;
68 /* array of pointers to our devices that are currently connected */
69 struct auerswald *auerdev_table[AUER_MAX_DEVICES];
71 /* lock to protect the auerdev_table structure */
72 struct semaphore auerdev_table_mutex;
74 /*-------------------------------------------------------------------*/
76 static void auerswald_ctrlread_complete(struct urb *urb);
78 /*-------------------------------------------------------------------*/
79 /* Completion handlers */
81 /* Values of urb->status or results of usb_submit_urb():
83 -EINPROGRESS during submission until end
84 -ENOENT if urb is unlinked
85 -ETIMEDOUT Transfer timed out, NAK
86 -ENOMEM Memory Overflow
87 -ENODEV Specified USB-device or bus doesn't exist
88 -ENXIO URB already queued
89 -EINVAL a) Invalid transfer type specified (or not supported)
90 b) Invalid interrupt interval (0n256)
91 -EAGAIN a) Specified ISO start frame too early
92 b) (using ISO-ASAP) Too much scheduled for the future wait some time and try again.
93 -EFBIG Too much ISO frames requested (currently uhci900)
94 -EPIPE Specified pipe-handle/Endpoint is already stalled
95 -EMSGSIZE Endpoint message size is zero, do interface/alternate setting
96 -EPROTO a) Bitstuff error
100 -EREMOTEIO Short packet detected
101 -EXDEV ISO transfer only partially completed look at individual frame status for details
102 -EINVAL ISO madness, if this happens: Log off and go home
106 /* check if a status code allows a retry */
107 static int auerswald_status_retry(int status)
119 return 1; /* do a retry */
121 return 0; /* no retry possible */
125 /* Completion of asynchronous write block */
126 void auerchar_ctrlwrite_complete(struct urb *urb)
128 struct auerbuf *bp = (struct auerbuf *) urb->context;
129 struct auerswald *cp =
130 ((struct auerswald *) ((char *) (bp->list) -
132 long) (&((struct auerswald *) 0)->
134 dbg("auerchar_ctrlwrite_complete called");
136 /* reuse the buffer */
137 auerbuf_releasebuf(bp);
138 /* Wake up all processes waiting for a buffer */
139 wake_up(&cp->bufferwait);
142 /* Completion handler for dummy retry packet */
143 static void auerswald_ctrlread_wretcomplete(struct urb *urb)
145 struct auerbuf *bp = (struct auerbuf *) urb->context;
146 struct auerswald *cp;
148 dbg("auerswald_ctrlread_wretcomplete called");
149 dbg("complete with status: %d", urb->status);
150 cp = ((struct auerswald *) ((char *) (bp->list) -
152 long) (&((struct auerswald *) 0)->
155 /* check if it is possible to advance */
156 if (!auerswald_status_retry(urb->status) || !cp->usbdev) {
157 /* reuse the buffer */
158 err("control dummy: transmission error %d, can not retry",
160 auerbuf_releasebuf(bp);
161 /* Wake up all processes waiting for a buffer */
162 wake_up(&cp->bufferwait);
166 /* fill the control message */
167 bp->dr->bRequestType = AUT_RREQ;
168 bp->dr->bRequest = AUV_RBLOCK;
169 bp->dr->wLength = bp->dr->wValue; /* temporary stored */
170 bp->dr->wValue = cpu_to_le16(1); /* Retry Flag */
171 /* bp->dr->wIndex = channel id; remains */
172 FILL_CONTROL_URB(bp->urbp, cp->usbdev,
173 usb_rcvctrlpipe(cp->usbdev, 0),
174 (unsigned char *) bp->dr, bp->bufp,
175 le16_to_cpu(bp->dr->wLength),
176 (usb_complete_t) auerswald_ctrlread_complete, bp);
178 /* submit the control msg as next paket */
179 ret = auerchain_submit_urb_list(&cp->controlchain, bp->urbp, 1);
181 dbg("auerswald_ctrlread_complete: nonzero result of auerchain_submit_urb_list %d", ret);
182 bp->urbp->status = ret;
183 auerswald_ctrlread_complete(bp->urbp);
187 /* completion handler for receiving of control messages */
188 static void auerswald_ctrlread_complete(struct urb *urb)
190 unsigned int serviceid;
191 struct auerswald *cp;
192 struct auerscon *scp;
193 struct auerbuf *bp = (struct auerbuf *) urb->context;
195 dbg("auerswald_ctrlread_complete called");
197 cp = ((struct auerswald *) ((char *) (bp->list) -
199 long) (&((struct auerswald *) 0)->
202 /* check if there is valid data in this urb */
204 dbg("complete with non-zero status: %d", urb->status);
205 /* should we do a retry? */
206 if (!auerswald_status_retry(urb->status)
207 || !cp->usbdev || (cp->version < AUV_RETRY)
208 || (bp->retries >= AU_RETRIES)) {
209 /* reuse the buffer */
210 err("control read: transmission error %d, can not retry", urb->status);
211 auerbuf_releasebuf(bp);
212 /* Wake up all processes waiting for a buffer */
213 wake_up(&cp->bufferwait);
217 dbg("Retry count = %d", bp->retries);
218 /* send a long dummy control-write-message to allow device firmware to react */
219 bp->dr->bRequestType = AUT_WREQ;
220 bp->dr->bRequest = AUV_DUMMY;
221 bp->dr->wValue = bp->dr->wLength; /* temporary storage */
222 // bp->dr->wIndex channel ID remains
223 bp->dr->wLength = cpu_to_le16(32); /* >= 8 bytes */
224 FILL_CONTROL_URB(bp->urbp, cp->usbdev,
225 usb_sndctrlpipe(cp->usbdev, 0),
226 (unsigned char *) bp->dr, bp->bufp, 32,
228 auerswald_ctrlread_wretcomplete, bp);
230 /* submit the control msg as next paket */
232 auerchain_submit_urb_list(&cp->controlchain, bp->urbp,
235 dbg("auerswald_ctrlread_complete: nonzero result of auerchain_submit_urb_list %d", ret);
236 bp->urbp->status = ret;
237 auerswald_ctrlread_wretcomplete(bp->urbp);
242 /* get the actual bytecount (incl. headerbyte) */
243 bp->len = urb->actual_length;
244 serviceid = bp->bufp[0] & AUH_TYPEMASK;
245 dbg("Paket with serviceid %d and %d bytes received", serviceid,
248 /* dispatch the paket */
249 scp = cp->services[serviceid];
251 /* look, Ma, a listener! */
252 scp->dispatch(scp, bp);
255 /* release the paket */
256 auerbuf_releasebuf(bp);
257 /* Wake up all processes waiting for a buffer */
258 wake_up(&cp->bufferwait);
261 /*-------------------------------------------------------------------*/
262 /* Handling of Interrupt Endpoint */
263 /* This interrupt Endpoint is used to inform the host about waiting
264 messages from the USB device.
266 /* int completion handler. */
267 static void auerswald_int_complete(struct urb *urb)
269 unsigned int channelid;
270 unsigned int bytecount;
272 struct auerbuf *bp = NULL;
273 struct auerswald *cp = (struct auerswald *) urb->context;
275 dbg("auerswald_int_complete called");
277 /* do not respond to an error condition */
278 if (urb->status != 0) {
279 dbg("nonzero URB status = %d", urb->status);
283 /* check if all needed data was received */
284 if (urb->actual_length < AU_IRQMINSIZE) {
285 dbg("invalid data length received: %d bytes",
290 /* check the command code */
291 if (cp->intbufp[0] != AU_IRQCMDID) {
292 dbg("invalid command received: %d", cp->intbufp[0]);
296 /* check the command type */
297 if (cp->intbufp[1] != AU_BLOCKRDY) {
298 dbg("invalid command type received: %d", cp->intbufp[1]);
302 /* now extract the information */
303 channelid = cp->intbufp[2];
304 bytecount = le16_to_cpup(&cp->intbufp[3]);
306 /* check the channel id */
307 if (channelid >= AUH_TYPESIZE) {
308 dbg("invalid channel id received: %d", channelid);
312 /* check the byte count */
313 if (bytecount > (cp->maxControlLength + AUH_SIZE)) {
314 dbg("invalid byte count received: %d", bytecount);
317 dbg("Service Channel = %d", channelid);
318 dbg("Byte Count = %d", bytecount);
320 /* get a buffer for the next data paket */
321 bp = auerbuf_getbuf(&cp->bufctl);
322 /* if no buffer available: skip it */
324 dbg("auerswald_int_complete: no data buffer available");
325 /* can we do something more?
326 This is a big problem: if this int packet is ignored, the
327 device will wait forever and not signal any more data.
328 The only real solution is: having enought buffers!
329 Or perhaps temporary disabling the int endpoint?
334 /* fill the control message */
335 bp->dr->bRequestType = AUT_RREQ;
336 bp->dr->bRequest = AUV_RBLOCK;
337 bp->dr->wValue = cpu_to_le16(0);
338 bp->dr->wIndex = cpu_to_le16(channelid | AUH_DIRECT | AUH_UNSPLIT);
339 bp->dr->wLength = cpu_to_le16(bytecount);
340 FILL_CONTROL_URB(bp->urbp, cp->usbdev,
341 usb_rcvctrlpipe(cp->usbdev, 0),
342 (unsigned char *) bp->dr, bp->bufp, bytecount,
343 (usb_complete_t) auerswald_ctrlread_complete, bp);
345 /* submit the control msg */
346 ret = auerchain_submit_urb(&cp->controlchain, bp->urbp);
348 dbg("auerswald_int_complete: nonzero result of auerchain_submit_urb %d", ret);
349 bp->urbp->status = ret;
350 auerswald_ctrlread_complete(bp->urbp);
351 /* here applies the same problem as above: device locking! */
355 /* int memory deallocation
356 NOTE: no mutex please!
358 static void auerswald_int_free(struct auerswald *cp)
361 usb_free_urb(cp->inturbp);
367 /* This function is called to activate the interrupt
368 endpoint. This function returns 0 if successfull or an error code.
369 NOTE: no mutex please!
371 static int auerswald_int_open(struct auerswald *cp)
374 struct usb_endpoint_descriptor *ep;
376 dbg("auerswald_int_open");
378 ep = usb_epnum_to_ep_desc(cp->usbdev, USB_DIR_IN | AU_IRQENDP);
383 irqsize = ep->wMaxPacketSize;
384 cp->irqsize = irqsize;
386 /* allocate the urb and data buffer */
388 cp->inturbp = usb_alloc_urb(0);
395 cp->intbufp = (char *) kmalloc(irqsize, GFP_KERNEL);
402 FILL_INT_URB(cp->inturbp, cp->usbdev,
403 usb_rcvintpipe(cp->usbdev, AU_IRQENDP), cp->intbufp,
404 irqsize, auerswald_int_complete, cp, ep->bInterval);
406 cp->inturbp->status = 0; /* needed! */
407 ret = usb_submit_urb(cp->inturbp);
411 /* activation of interrupt endpoint has failed. Now clean up. */
412 dbg("auerswald_int_open: activation of int endpoint failed");
414 /* deallocate memory */
415 auerswald_int_free(cp);
420 /* This function is called to deactivate the interrupt
421 endpoint. This function returns 0 if successfull or an error code.
422 NOTE: no mutex please!
424 static int auerswald_int_release(struct auerswald *cp)
427 dbg("auerswald_int_release");
429 /* stop the int endpoint */
431 ret = usb_unlink_urb(cp->inturbp);
433 dbg("nonzero int unlink result received: %d", ret);
436 /* deallocate memory */
437 auerswald_int_free(cp);
442 /* --------------------------------------------------------------------- */
443 /* Helper functions */
445 /* Delete an auerswald driver context */
446 void auerswald_delete(struct auerswald *cp)
448 dbg("auerswald_delete");
452 /* Wake up all processes waiting for a buffer */
453 wake_up(&cp->bufferwait);
456 auerisdn_disconnect(cp);
457 auerswald_int_release(cp);
458 auerchain_free(&cp->controlchain);
459 auerbuf_free_buffers(&cp->bufctl);
461 /* release the memory */
466 /* add a new service to the device
468 return: 0 if OK, else error code
470 int auerswald_addservice(struct auerswald *cp, struct auerscon *scp)
474 /* is the device available? */
476 dbg("usbdev == NULL");
477 return -EIO; /*no: can not add a service, sorry */
480 /* is the service available? */
481 if (cp->services[scp->id]) {
482 dbg("service is busy");
486 /* device is available, service is free */
487 cp->services[scp->id] = scp;
489 /* register service in device */
490 ret = auerchain_control_msg(&cp->controlchain, /* pointer to control chain */
491 cp->usbdev, /* pointer to device */
492 usb_sndctrlpipe(cp->usbdev, 0), /* pipe to control endpoint */
493 AUV_CHANNELCTL, /* USB message request value */
494 AUT_WREQ, /* USB message request type value */
495 0x01, /* open */ /* USB message value */
496 scp->id, /* USB message index value */
497 NULL, /* pointer to the data to send */
498 0, /* length in bytes of the data to send */
499 HZ * 2); /* time to wait for the message to complete before timing out */
501 dbg("auerswald_addservice: auerchain_control_msg returned error code %d", ret);
502 /* undo above actions */
503 cp->services[scp->id] = NULL;
507 dbg("auerswald_addservice: channel open OK");
512 /* remove a service from the the device
513 scp->id must be set! */
514 void auerswald_removeservice(struct auerswald *cp, struct auerscon *scp)
516 dbg("auerswald_removeservice called");
518 /* check if we have a service allocated */
519 if (scp->id == AUH_UNASSIGNED)
522 /* If there is a device: close the channel */
523 if (cp->usbdev && !cp->disconnecting) {
524 /* Close the service channel inside the device */
525 int ret = auerchain_control_msg(&cp->controlchain, /* pointer to control chain */
526 cp->usbdev, /* pointer to device */
527 usb_sndctrlpipe(cp->usbdev, 0), /* pipe to control endpoint */
528 AUV_CHANNELCTL, /* USB message request value */
529 AUT_WREQ, /* USB message request type value */
530 0x00, /* close */ /* USB message value */
531 scp->id, /* USB message index value */
532 NULL, /* pointer to the data to send */
533 0, /* length in bytes of the data to send */
534 HZ * 2); /* time to wait for the message to complete before timing out */
536 dbg("auerswald_removeservice: auerchain_control_msg returned error code %d", ret);
538 dbg("auerswald_removeservice: channel close OK");
542 /* remove the service from the device */
543 cp->services[scp->id] = NULL;
544 scp->id = AUH_UNASSIGNED;
548 /*----------------------------------------------------------------------*/
549 /* File operation structure */
550 static struct file_operations auerswald_fops = {
552 llseek:auerchar_llseek,
554 write:auerchar_write,
555 ioctl:auerchar_ioctl,
557 release:auerchar_release,
560 /* --------------------------------------------------------------------- */
561 /* Special USB driver functions */
563 /* Probe if this driver wants to serve an USB device
565 This entry point is called whenever a new device is attached to the bus.
566 Then the device driver has to create a new instance of its internal data
567 structures for the new device.
569 The dev argument specifies the device context, which contains pointers
570 to all USB descriptors. The interface argument specifies the interface
571 number. If a USB driver wants to bind itself to a particular device and
572 interface it has to return a pointer. This pointer normally references
573 the device driver's context structure.
575 Probing normally is done by checking the vendor and product identifications
576 or the class and subclass definitions. If they match the interface number
577 is compared with the ones supported by the driver. When probing is done
578 class based it might be necessary to parse some more USB descriptors because
579 the device properties can differ in a wide range.
581 static void *auerswald_probe(struct usb_device *usbdev, unsigned int ifnum,
582 const struct usb_device_id *id)
584 struct auerswald *cp = NULL;
585 DECLARE_WAIT_QUEUE_HEAD(wqh);
586 unsigned int dtindex;
591 dbg("probe: vendor id 0x%x, device id 0x%x ifnum:%d",
592 usbdev->descriptor.idVendor, usbdev->descriptor.idProduct,
595 /* See if the device offered us matches that we can accept */
596 if (usbdev->descriptor.idVendor != ID_AUERSWALD)
599 /* we use only the first -and only- interface */
603 /* prevent module unloading while sleeping */
606 /* allocate memory for our device and intialize it */
607 cp = kmalloc(sizeof(struct auerswald), GFP_KERNEL);
609 err("out of memory");
613 /* Initialize device descriptor */
614 memset(cp, 0, sizeof(struct auerswald));
615 init_MUTEX(&cp->mutex);
617 auerchain_init(&cp->controlchain);
618 auerbuf_init(&cp->bufctl);
619 init_waitqueue_head(&cp->bufferwait);
620 auerisdn_init_dev(cp);
622 /* find a free slot in the device table */
623 down(&auerdev_table_mutex);
624 for (dtindex = 0; dtindex < AUER_MAX_DEVICES; ++dtindex) {
625 if (auerdev_table[dtindex] == NULL)
628 if (dtindex >= AUER_MAX_DEVICES) {
629 err("more than %d devices plugged in, can not handle this device", AUER_MAX_DEVICES);
630 up(&auerdev_table_mutex);
634 /* Give the device a name */
635 sprintf(cp->name, AU_PREFIX "%d", dtindex);
637 /* Store the index */
638 cp->dtindex = dtindex;
639 auerdev_table[dtindex] = cp;
640 up(&auerdev_table_mutex);
642 /* initialize the devfs node for this device and register it */
643 cp->devfs = devfs_register(usb_devfs_handle, cp->name,
644 DEVFS_FL_DEFAULT, USB_MAJOR,
645 AUER_MINOR_BASE + dtindex,
646 S_IFCHR | S_IRUGO | S_IWUGO,
647 &auerswald_fops, NULL);
649 /* Get the usb version of the device */
650 cp->version = cp->usbdev->descriptor.bcdDevice;
651 dbg("Version is %X", cp->version);
653 /* allow some time to settle the device */
654 sleep_on_timeout(&wqh, HZ / 3);
656 /* Try to get a suitable textual description of the device */
659 usb_string(cp->usbdev, AUSI_DEVICE, cp->dev_desc,
663 /* Append Serial Number */
664 memcpy(&cp->dev_desc[u], ",Ser# ", 6);
667 usb_string(cp->usbdev, AUSI_SERIALNR, &cp->dev_desc[u],
671 /* Append subscriber number */
672 memcpy(&cp->dev_desc[u], ", ", 2);
675 usb_string(cp->usbdev, AUSI_MSN,
683 cp->dev_desc[u] = '\0';
684 info("device is a %s", cp->dev_desc);
686 /* get the maximum allowed control transfer length */
687 pbuf = (char *) kmalloc(2, GFP_KERNEL); /* use an allocated buffer because of urb target */
689 err("out of memory");
692 ret = usb_control_msg(cp->usbdev, /* pointer to device */
693 usb_rcvctrlpipe(cp->usbdev, 0), /* pipe to control endpoint */
694 AUV_GETINFO, /* USB message request value */
695 AUT_RREQ, /* USB message request type value */
696 0, /* USB message value */
697 AUDI_MBCTRANS, /* USB message index value */
698 pbuf, /* pointer to the receive buffer */
699 2, /* length of the buffer */
700 HZ * 2); /* time to wait for the message to complete before timing out */
702 cp->maxControlLength = le16_to_cpup(pbuf);
704 dbg("setup: max. allowed control transfersize is %d bytes",
705 cp->maxControlLength);
708 err("setup: getting max. allowed control transfer length failed with error %d", ret);
711 /* allocate a chain for the control messages */
712 if (auerchain_setup(&cp->controlchain, AUCH_ELEMENTS)) {
713 err("out of memory");
717 /* allocate buffers for control messages */
719 (&cp->bufctl, AU_RBUFFERS * 2,
720 cp->maxControlLength + AUH_SIZE)) {
721 err("out of memory");
725 /* start the interrupt endpoint */
726 if (auerswald_int_open(cp)) {
727 err("int endpoint failed");
731 /* Try to connect to hisax interface */
732 if (auerisdn_probe(cp)) {
733 err("hisax connect failed");
740 /* Error exit: clean up the memory */
741 pfail:auerswald_delete(cp);
747 /* Disconnect driver from a served device
749 This function is called whenever a device which was served by this driver
752 The argument dev specifies the device context and the driver_context
753 returns a pointer to the previously registered driver_context of the
754 probe function. After returning from the disconnect function the USB
755 framework completly deallocates all data structures associated with
756 this device. So especially the usb_device structure must not be used
757 any longer by the usb driver.
759 static void auerswald_disconnect(struct usb_device *usbdev,
760 void *driver_context)
762 struct auerswald *cp = (struct auerswald *) driver_context;
765 /* all parallel tasks can react on disconnect ASAP */
766 cp->disconnecting = 1;
768 info("device /dev/usb/%s now disconnecting", cp->name);
770 /* remove from device table */
771 /* Nobody can open() this device any more */
772 down(&auerdev_table_mutex);
773 auerdev_table[cp->dtindex] = NULL;
774 up(&auerdev_table_mutex);
776 /* remove our devfs node */
777 /* Nobody can see this device any more */
778 devfs_unregister(cp->devfs);
780 /* stop the ISDN connection */
781 auerisdn_disconnect(cp);
783 /* Stop the interrupt endpoint 0 */
784 auerswald_int_release(cp);
786 /* remove the control chain allocated in auerswald_probe
787 This has the benefit of
788 a) all pending (a)synchronous urbs are unlinked
789 b) all buffers dealing with urbs are reclaimed
791 auerchain_free(&cp->controlchain);
793 if (cp->open_count == 0) {
794 struct auerscon *scp;
795 /* nobody is using this device. So we can clean up now */
796 up(&cp->mutex); /* up() is possible here because no other task
797 can open the device (see above). I don't want
798 to kfree() a locked mutex. */
799 /* disconnect the D channel */
800 scp = cp->services[AUH_DCHANNEL];
802 scp->disconnect(scp);
803 auerswald_delete(cp);
805 /* device is used. Remove the pointer to the
806 usb device (it's not valid any more). The last
807 release() will do the clean up */
810 /* Terminate waiting writers */
811 wake_up(&cp->bufferwait);
812 /* Inform all waiting readers */
813 for (u = 0; u < AUH_TYPESIZE; u++) {
814 struct auerscon *scp = cp->services[u];
816 scp->disconnect(scp);
820 /* The device releases this module */
824 /* Descriptor for the devices which are served by this driver.
825 NOTE: this struct is parsed by the usbmanager install scripts.
826 Don't change without caution!
828 static struct usb_device_id auerswald_ids[] = {
829 {USB_DEVICE(ID_AUERSWALD, 0x00C0)}, /* COMpact 2104 USB/DSL */
830 {USB_DEVICE(ID_AUERSWALD, 0x00DB)}, /* COMpact 4410/2206 USB */
831 {USB_DEVICE(ID_AUERSWALD, 0x00DC)}, /* COMpact 4406 DSL */
832 {USB_DEVICE(ID_AUERSWALD, 0x00DD)}, /* COMpact 2204 USB */
833 {USB_DEVICE(ID_AUERSWALD, 0x00F1)}, /* COMfort 2000 System Telephone */
834 {USB_DEVICE(ID_AUERSWALD, 0x00F2)}, /* COMfort 1200 System Telephone */
835 {} /* Terminating entry */
838 /* Standard module device table */
839 MODULE_DEVICE_TABLE(usb, auerswald_ids);
841 /* Standard usb driver struct */
842 static struct usb_driver auerswald_driver = {
844 probe:auerswald_probe,
845 disconnect:auerswald_disconnect,
846 fops:&auerswald_fops,
847 minor:AUER_MINOR_BASE,
848 id_table:auerswald_ids,
852 /* --------------------------------------------------------------------- */
853 /* Module loading/unloading */
855 /* Driver initialisation. Called after module loading.
856 NOTE: there is no concurrency at _init
858 static int __init auerswald_init(void)
863 /* initialize the device table */
864 memset(&auerdev_table, 0, sizeof(auerdev_table));
865 init_MUTEX(&auerdev_table_mutex);
868 /* register driver at the USB subsystem */
869 /* NOTE: usb_register() may call probe()! */
870 result = usb_register(&auerswald_driver);
872 err("driver could not be registered");
878 /* Driver deinit. Called before module removal.
879 NOTE: there is no concurrency at _cleanup
881 static void __exit auerswald_cleanup(void)
885 usb_deregister(&auerswald_driver);
888 /* --------------------------------------------------------------------- */
889 /* Linux device driver module description */
891 MODULE_AUTHOR(DRIVER_AUTHOR);
892 MODULE_DESCRIPTION(DRIVER_DESC);
893 MODULE_LICENSE("GPL");
895 module_init(auerswald_init);
896 module_exit(auerswald_cleanup);
898 /* --------------------------------------------------------------------- */