(patch 2 of 8)

Hi,

Here's a patch for the usb acm driver against 2.2.20-pre2 that brings it
up to the same logic level that is in 2.4.5.

thanks,

greg k-h
diff -Nru a/drivers/usb/acm.c b/drivers/usb/acm.c
--- a/drivers/usb/acm.c Tue Jun 12 22:34:40 2001
+++ b/drivers/usb/acm.c Tue Jun 12 22:34:40 2001
@@ -1,5 +1,5 @@
 /*
- * acm.c  Version 0.16
+ * acm.c  Version 0.18
  *
  * Copyright (c) 1999 Armin Fuerst     <[EMAIL PROTECTED]>
  * Copyright (c) 1999 Pavel Machek     <[EMAIL PROTECTED]>
@@ -19,6 +19,8 @@
  *     v0.14 - sized down struct acm
  *     v0.15 - fixed flow control again - characters could be lost
  *     v0.16 - added code for modems with swapped data and control interfaces
+ *     v0.17 - added new style probing
+ *     v0.18 - fixed new style probing for devices with more configurations
  */
 
 /*
@@ -45,15 +47,22 @@
 #include <linux/init.h>
 #include <linux/malloc.h>
 #include <linux/fcntl.h>
+#include <linux/tty.h>
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
-#include <linux/tty.h>
 #include <linux/module.h>
-//#define DEBUG
+#undef DEBUG
 #include <linux/usb.h>
 #include <linux/devfs_fs_kernel.h>
 
 /*
+ * Version Information
+ */
+#define DRIVER_VERSION "v0.18"
+#define DRIVER_AUTHOR "Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik"
+#define DRIVER_DESC "USB Abstract Control Model driver for USB modems and ISDN 
+adapters"
+
+/*
  * CMSPAR, some architectures can't have space and mark parity.
  */
 
@@ -145,7 +154,7 @@
 
 static struct usb_driver acm_driver;
 static struct tty_driver acm_tty_driver;
-static struct acm *acm_table[ACM_TTY_MINORS] = { NULL, /* .... */ };
+static struct acm *acm_table[ACM_TTY_MINORS];
 
 #define ACM_READY(acm) (acm && acm->dev && acm->used)
 
@@ -232,8 +241,14 @@
                dbg("nonzero read bulk status received: %d", urb->status);
 
        if (!urb->status & !acm->throttle)  {
-               for (i = 0; i < urb->actual_length && !acm->throttle; i++)
+               for (i = 0; i < urb->actual_length && !acm->throttle; i++) {
+                       /* if we insert more than TTY_FLIPBUF_SIZE characters,
+                        * we drop them. */
+                       if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+                               tty_flip_buffer_push(tty);
+                       }
                        tty_insert_flip_char(tty, data[i], 0);
+               }
                tty_flip_buffer_push(tty);
        }
 
@@ -244,6 +259,7 @@
        }
 
        urb->actual_length = 0;
+       urb->dev = acm->dev;
 
        if (usb_submit_urb(urb))
                dbg("failed resubmitting read urb");
@@ -292,14 +308,20 @@
 
        if (acm->used++) return 0;
 
+       acm->ctrlurb.dev = acm->dev;
        if (usb_submit_urb(&acm->ctrlurb))
                dbg("usb_submit_urb(ctrl irq) failed");
 
+       acm->readurb.dev = acm->dev;
        if (usb_submit_urb(&acm->readurb))
                dbg("usb_submit_urb(read bulk) failed");
 
        acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS);
 
+       /* force low_latency on so that our tty_push actually forces the data through, 
+          otherwise it is scheduled, and with high data rates data can get lost. */
+       tty->low_latency = 1;
+
        return 0;
 }
 
@@ -340,6 +362,7 @@
                memcpy(acm->writeurb.transfer_buffer, buf, count);
 
        acm->writeurb.transfer_buffer_length = count;
+       acm->writeurb.dev = acm->dev;
 
        if (usb_submit_urb(&acm->writeurb))
                dbg("usb_submit_urb(write bulk) failed");
@@ -500,7 +523,7 @@
                ifcom = cfacm->interface[0].altsetting + 0;
                ifdata = cfacm->interface[1].altsetting + 0;
 
-               if (ifdata->bInterfaceClass != 10 || ifdata->bNumEndpoints != 2) {
+               if (ifdata->bInterfaceClass != 10 || ifdata->bNumEndpoints < 2) {
                        ifcom = cfacm->interface[1].altsetting + 0;
                        ifdata = cfacm->interface[0].altsetting + 0;
                        if (ifdata->bInterfaceClass != 10 || ifdata->bNumEndpoints < 2)
@@ -563,7 +586,7 @@
 
                FILL_BULK_URB(&acm->writeurb, dev, usb_sndbulkpipe(dev, 
epwrite->bEndpointAddress),
                        buf += readsize, acm->writesize, acm_write_bulk, acm);
-       
+
                printk(KERN_INFO "ttyACM%d: USB ACM device\n", minor);
 
                acm_set_control(acm, acm->ctrlout);
@@ -679,6 +702,9 @@
                return -1;
        }
 
+       info(DRIVER_VERSION " " DRIVER_AUTHOR);
+       info(DRIVER_DESC);
+
        return 0;
 }
 
@@ -691,5 +717,6 @@
 module_init(acm_init);
 module_exit(acm_exit);
 
-MODULE_AUTHOR("Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik");
-MODULE_DESCRIPTION("USB Abstract Control Model driver for USB modems and ISDN 
adapters");
+MODULE_AUTHOR( DRIVER_AUTHOR );
+MODULE_DESCRIPTION( DRIVER_DESC );
+

Reply via email to