linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ACM USB modem on Kernel 2.6.0-test
@ 2003-10-11 12:38 Peter Matthias
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-11 12:38 UTC (permalink / raw)
  To: linux-kernel

Hello,

I have a problem running my Elsa Microlink USB modem with latest 2.6.0-test7
kernel. On startup I get:

usb 3-3: configuration #1 chosen from 2 choices
drivers/usb/class/cdc-acm.c: need inactive config #2
drivers/usb/class/cdc-acm.c: need inactive config #2

and the driver is not being loaded. I have no problems with 2.4 kernels.

Thank you,
        Peter


lsusb says:

Bus 003 Device 002: ID 05cc:2267 ELSA AG
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x05cc ELSA AG
  idProduct          0x2267
  bcdDevice            1.00
  iManufacturer           1 Lucent Technologies, Inc.
  iProduct                2 ELSA Modem Board
  iSerial                 0
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3
    bmAttributes         0xa0
      Remote Wakeup
    MaxPower              400mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              4 Lucent Win95 Modem USB
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              5 Control Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         16
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize         63
        bInterval               2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           67
    bNumInterfaces          2
    bConfigurationValue     2
    iConfiguration          6
    bmAttributes         0xa0
      Remote Wakeup
    MaxPower              400mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands
      iInterface              4 Lucent Win95 Modem USB
  unknown descriptor type: 05 24 00 00 01
  unknown descriptor type: 05 24 01 03 01
  unknown descriptor type: 04 24 02 07
  unknown descriptor type: 05 24 06 00 01
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
        wMaxPacketSize         32
        bInterval             128
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              5 Control Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               none
        wMaxPacketSize         64
        bInterval               0
  Language IDs: (length=6)
     0009 English(English)
     0409 English(US)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
@ 2003-10-11 18:53 David Brownell
  2003-10-12 12:07 ` Jamie Lokier
  2003-10-17 20:04 ` David Brownell
  0 siblings, 2 replies; 13+ messages in thread
From: David Brownell @ 2003-10-11 18:53 UTC (permalink / raw)
  To: Peter Matthias, linux-kernel; +Cc: linux-usb-devel

> usb 3-3: configuration #1 chosen from 2 choices
> drivers/usb/class/cdc-acm.c: need inactive config #2
> drivers/usb/class/cdc-acm.c: need inactive config #2

Until we get more intelligence somewhere, do this:

    # cd /sys/bus/usb/devices/3-3
    # echo '2' > bConfigurationValue
    #

That makes the device use vendor-neutral protocols
to talk to the host, not MSFT-proprietary ones.  (It's
important to use the numbers from those messages; they
will change if you use different USB ports.)

Hmm ... maybe usbcore would be better off with a less
naive algorithm for choosing defaults.  Like, preferring
configurations without proprietary device protocols.
That'd solve every cdc-acm case, and likely others.

- Dave



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found] <FwYB.Z9.25@gated-at.bofh.it>
@ 2003-10-12  8:40 ` Peter Matthias
  2003-10-12 12:06   ` Jamie Lokier
  2003-10-12 17:52 ` Peter Matthias
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Peter Matthias @ 2003-10-12  8:40 UTC (permalink / raw)
  To: linux-kernel

David Brownell schrieb:

>> usb 3-3: configuration #1 chosen from 2 choices
>> drivers/usb/class/cdc-acm.c: need inactive config #2
>> drivers/usb/class/cdc-acm.c: need inactive config #2
> 
> Until we get more intelligence somewhere, do this:
> 
>     # cd /sys/bus/usb/devices/3-3
>     # echo '2' > bConfigurationValue
>     #

Sound good, but I don't have /sys/ (nor do I have /proc/sys/bus/) with the
OHCI driver.

Peter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
  2003-10-12  8:40 ` Peter Matthias
@ 2003-10-12 12:06   ` Jamie Lokier
  0 siblings, 0 replies; 13+ messages in thread
From: Jamie Lokier @ 2003-10-12 12:06 UTC (permalink / raw)
  To: Peter Matthias; +Cc: linux-kernel

Peter Matthias wrote:
> Sound good, but I don't have /sys/ (nor do I have /proc/sys/bus/) with the
> OHCI driver.

You're using 2.6.0-test7, so you have sysfs in the kernel.
Do this:

	mkdir /sys
	mount none /sys -t sysfs

-- Jamie

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
  2003-10-11 18:53 ACM USB modem on Kernel 2.6.0-test David Brownell
@ 2003-10-12 12:07 ` Jamie Lokier
  2003-10-12 18:59   ` David Brownell
  2003-10-17 20:04 ` David Brownell
  1 sibling, 1 reply; 13+ messages in thread
From: Jamie Lokier @ 2003-10-12 12:07 UTC (permalink / raw)
  To: David Brownell; +Cc: Peter Matthias, linux-kernel, linux-usb-devel

David Brownell wrote:
> Hmm ... maybe usbcore would be better off with a less
> naive algorithm for choosing defaults.  Like, preferring
> configurations without proprietary device protocols.
> That'd solve every cdc-acm case, and likely others.

Presumably 2.4 does that, because my acm modem works with 2.3 and 2.4
kernels.

Do you know anything about the proprietary protocols, btw?

-- Jamie

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found] <FwYB.Z9.25@gated-at.bofh.it>
  2003-10-12  8:40 ` Peter Matthias
@ 2003-10-12 17:52 ` Peter Matthias
  2003-10-13 16:28 ` Peter Matthias
       [not found] ` <HJ5m.2Eb.23@gated-at.bofh.it>
  3 siblings, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-12 17:52 UTC (permalink / raw)
  To: linux-kernel

David Brownell schrieb:

>> usb 3-3: configuration #1 chosen from 2 choices
>> drivers/usb/class/cdc-acm.c: need inactive config #2
>> drivers/usb/class/cdc-acm.c: need inactive config #2
> 
> Until we get more intelligence somewhere, do this:
> 
>     # cd /sys/bus/usb/devices/3-3
>     # echo '2' > bConfigurationValue
>     #
Thanks, it now works when I load the cdc-acm module after that.

Peter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
  2003-10-12 12:07 ` Jamie Lokier
@ 2003-10-12 18:59   ` David Brownell
  0 siblings, 0 replies; 13+ messages in thread
From: David Brownell @ 2003-10-12 18:59 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: Peter Matthias, linux-kernel, linux-usb-devel

Jamie Lokier wrote:
> David Brownell wrote:
> 
>>Hmm ... maybe usbcore would be better off with a less
>>naive algorithm for choosing defaults.  Like, preferring
>>configurations without proprietary device protocols.
>>That'd solve every cdc-acm case, and likely others.
> 
> 
> Presumably 2.4 does that, because my acm modem works with 2.3 and 2.4
> kernels.

No, 2.4 is just as dumb -- but it had a way to kluge around
that.  But that kluge doesn't work any more on 2.6, mostly
because usb_set_configuration() now behaves sanely.  (Not
only does it shut down the old configuration ... but it also
sets up the new one correctly.)

Your modem should work just fine with 2.6 too, if you just
switch to the other configuration from userspace.  However,
I'd certainly like to reduce the need for such steps.


> Do you know anything about the proprietary protocols, btw?

My understanding is that knowing technical details involves
signing NDAs with MSFT.  But I've not investigated much;
likely other people know more.

- Dave




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found] <FwYB.Z9.25@gated-at.bofh.it>
  2003-10-12  8:40 ` Peter Matthias
  2003-10-12 17:52 ` Peter Matthias
@ 2003-10-13 16:28 ` Peter Matthias
       [not found] ` <HJ5m.2Eb.23@gated-at.bofh.it>
  3 siblings, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-13 16:28 UTC (permalink / raw)
  To: linux-kernel

David Brownell schrieb:

>> usb 3-3: configuration #1 chosen from 2 choices
>> drivers/usb/class/cdc-acm.c: need inactive config #2
>> drivers/usb/class/cdc-acm.c: need inactive config #2
> 
> Until we get more intelligence somewhere, do this:
> 
>     # cd /sys/bus/usb/devices/3-3
>     # echo '2' > bConfigurationValue
>     #

It works, but I get lots of theses warnings.

Peter

Badness in local_bh_enable at kernel/softirq.c:121
Call Trace:
 [<c011bf5d>] local_bh_enable+0x7d/0x80
 [<c0204984>] ppp_async_input+0x2f4/0x5a0
 [<c0203dcb>] ppp_asynctty_receive+0x4b/0x90
 [<c01def5f>] flush_to_ldisc+0x7f/0xd0
 [<df88d20f>] acm_read_bulk+0xbf/0x140 [cdc_acm]
 [<c023af59>] usb_hcd_giveback_urb+0x29/0x50
 [<c0248585>] dl_done_list+0xd5/0xe0
 [<c0248ea0>] ohci_irq+0xe0/0x150
 [<c023afb6>] usb_hcd_irq+0x36/0x60
 [<c010a9ca>] handle_IRQ_event+0x3a/0x70
 [<c010acb1>] do_IRQ+0x71/0xf0
 [<c010920c>] common_interrupt+0x18/0x20

Badness in local_bh_enable at kernel/softirq.c:121
Call Trace:
 [<c011bf5d>] local_bh_enable+0x7d/0x80
 [<c0203dd0>] ppp_asynctty_receive+0x50/0x90
 [<c01def5f>] flush_to_ldisc+0x7f/0xd0
 [<df88d20f>] acm_read_bulk+0xbf/0x140 [cdc_acm]
 [<c023af59>] usb_hcd_giveback_urb+0x29/0x50
 [<c0248585>] dl_done_list+0xd5/0xe0
 [<c0248ea0>] ohci_irq+0xe0/0x150
 [<c023afb6>] usb_hcd_irq+0x36/0x60
 [<c010a9ca>] handle_IRQ_event+0x3a/0x70
 [<c010acb1>] do_IRQ+0x71/0xf0
 [<c010920c>] common_interrupt+0x18/0x20


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
  2003-10-11 18:53 ACM USB modem on Kernel 2.6.0-test David Brownell
  2003-10-12 12:07 ` Jamie Lokier
@ 2003-10-17 20:04 ` David Brownell
  2003-10-19 15:13   ` David Brownell
  1 sibling, 1 reply; 13+ messages in thread
From: David Brownell @ 2003-10-17 20:04 UTC (permalink / raw)
  To: Peter Matthias, Jamie Lokier; +Cc: linux-kernel, linux-usb-devel

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

David Brownell wrote:
> 
> Hmm ... maybe usbcore would be better off with a less
> naive algorithm for choosing defaults.  Like, preferring
> configurations without proprietary device protocols.
> That'd solve every cdc-acm case, and likely others.

In fact, here's a patch with that very change.  Does
it make current 2.6.0-test kernels work "out of the box"
again with your USB modems?

- Dave




[-- Attachment #2: Diff --]
[-- Type: text/plain, Size: 1389 bytes --]

--- 1.143/drivers/usb/core/usb.c	Thu Sep 25 03:59:51 2003
+++ edited/drivers/usb/core/usb.c	Fri Oct 17 12:18:16 2003
@@ -991,6 +997,7 @@
 	int err = -EINVAL;
 	int i;
 	int j;
+	int config;
 
 	/*
 	 * Set the driver for the usb device to point to the "generic" driver.
@@ -1105,15 +1112,27 @@
 
 	/* choose and set the configuration. that registers the interfaces
 	 * with the driver core, and lets usb device drivers bind to them.
+	 * NOTE:  should interact with hub power budgeting.
 	 */
+	config = dev->config[0].desc.bConfigurationValue;
 	if (dev->descriptor.bNumConfigurations != 1) {
+		for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
+			/* heuristic:  Linux is more likely to have class
+			 * drivers, so avoid vendor-specific interfaces.
+			 */
+			if (dev->config[i].interface[0]->altsetting
+						->desc.bInterfaceClass
+					== USB_CLASS_VENDOR_SPEC)
+				continue;
+			config = dev->config[i].desc.bConfigurationValue;
+			break;
+		}
 		dev_info(&dev->dev,
 			"configuration #%d chosen from %d choices\n",
-			dev->config[0].desc.bConfigurationValue,
+			config,
 			dev->descriptor.bNumConfigurations);
 	}
-	err = usb_set_configuration(dev,
-			dev->config[0].desc.bConfigurationValue);
+	err = usb_set_configuration(dev, config);
 	if (err) {
 		dev_err(&dev->dev, "can't set config #%d, error %d\n",
 			dev->config[0].desc.bConfigurationValue, err);

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found] ` <HJ5m.2Eb.23@gated-at.bofh.it>
@ 2003-10-18 16:21   ` Peter Matthias
       [not found]   ` <Inm6.60T.19@gated-at.bofh.it>
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-18 16:21 UTC (permalink / raw)
  To: linux-kernel

David Brownell schrieb:

> David Brownell wrote:
>> 
>> Hmm ... maybe usbcore would be better off with a less
>> naive algorithm for choosing defaults.  Like, preferring
>> configurations without proprietary device protocols.
>> That'd solve every cdc-acm case, and likely others.
> 
> In fact, here's a patch with that very change.  Does
> it make current 2.6.0-test kernels work "out of the box"
> again with your USB modems?

Yes, it works with ELSA Microlink USB. Thanks.

Peter

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found]   ` <I1Yg.6oy.11@gated-at.bofh.it>
@ 2003-10-19  9:34     ` Peter Matthias
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-19  9:34 UTC (permalink / raw)
  To: linux-kernel

Peter Matthias schrieb:

> David Brownell schrieb:
> 
>> David Brownell wrote:
>>> 
>>> Hmm ... maybe usbcore would be better off with a less
>>> naive algorithm for choosing defaults.  Like, preferring
>>> configurations without proprietary device protocols.
>>> That'd solve every cdc-acm case, and likely others.
>> 
>> In fact, here's a patch with that very change.  Does
>> it make current 2.6.0-test kernels work "out of the box"
>> again with your USB modems?
> 
> Yes, it works with ELSA Microlink USB. Thanks.

Hmm. Too early. I get either a "acm: probe of 3-3:2.1 failed with error -5"
but it works or a 
Unable to handle kernel NULL pointer dereference at virtual address 00000008
 printing eip:
 c023d9c3
 *pde = 00000000
 Oops: 0000 [#1]
 CPU:    0
 EIP:    0060:[usb_driver_claim_interface+67/112]    Tainted: P
 EFLAGS: 00010202
 EIP is at usb_driver_claim_interface+0x43/0x70
 eax: c02ffe72   ebx: dddcf200   ecx: 00000004   edx: dddfa2ec
 esi: dddfa120   edi: 00000000   ebp: dddce3c0   esp: c15b1dd8
 ds: 007b   es: 007b   ss: 0068
 Process khubd (pid: 5, threadinfo=c15b0000 task=ddf8e040)
 Stack: c030a460 c02ff409 c02ffe72 00001388 dddcf200 c025141c c033a8e0
dddfa2ec
        dddce3c0 dddce3d8 00000007 00000094 dddcf200 00000000 00000020
dddfa120
        c1796ac0 c1796ad4 dddddc00 c033a968 c033a900 c033a8e0 dddfa240
c023d713
 Call Trace:
  [acm_probe+1228/1408] acm_probe+0x4cc/0x580
  [usb_probe_interface+115/160] usb_probe_interface+0x73/0xa0
  [bus_match+63/112] bus_match+0x3f/0x70
  [device_attach+65/160] device_attach+0x41/0xa0
  [bus_add_device+91/160] bus_add_device+0x5b/0xa0
  [device_add+167/272] device_add+0xa7/0x110
  [usb_set_configuration+456/576] usb_set_configuration+0x1c8/0x240
  [usb_new_device+690/992] usb_new_device+0x2b2/0x3e0
  [hub_port_connect_change+461/816] hub_port_connect_change+0x1cd/0x330
  [hub_events+773/848] hub_events+0x305/0x350
  [hub_thread+53/224] hub_thread+0x35/0xe0
  [default_wake_function+0/48] default_wake_function+0x0/0x30
  [hub_thread+0/224] hub_thread+0x0/0xe0
  [kernel_thread_helper+5/12] kernel_thread_helper+0x5/0xc

 Code: 8b 41 04 89 54 24 10 89 44 24 0c e8 1d b6 ed ff b8 f0 ff ff

Peter



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
  2003-10-17 20:04 ` David Brownell
@ 2003-10-19 15:13   ` David Brownell
  0 siblings, 0 replies; 13+ messages in thread
From: David Brownell @ 2003-10-19 15:13 UTC (permalink / raw)
  To: Peter Matthias; +Cc: linux-kernel, linux-usb-devel

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

>>> In fact, here's a patch with that very change.  Does
>>> it make current 2.6.0-test kernels work "out of the box"
>>> again with your USB modems?
>> 
>> Yes, it works with ELSA Microlink USB. Thanks.
> 
> Hmm. Too early. I get either a "acm: probe of 3-3:2.1 failed with error -5"
> but it works or a 
> Unable to handle kernel NULL pointer dereference at virtual address 00000008
>  ...
>  EIP:    0060:[usb_driver_claim_interface+67/112]    Tainted: P
>  ...

Well, the "it works at all (without the sysfs write)" is
what that patch was about -- so it's still a clear win!

But cdc-acm probe() is pretty broken, and I'm told it's
had strange behavior in various other cases for a while,
including some oopsing.  Like this; not a new bug.

Try this cdc-acm patch.  One user reported that it made
oopsing go away, the bogus probe() errors stopped, and
even the /proc/bus/usb/devices listings were finally
right (both interfaces now claimed by cdc_acm).  Plus
it should stop the pointless hotplugging of "cdc_acm"
for Ethernet devices (including MSFT's RNDIS).

- Dave




[-- Attachment #2: Diff --]
[-- Type: text/plain, Size: 6769 bytes --]

--- 1.50/drivers/usb/class/cdc-acm.c	Sat Aug 23 12:40:13 2003
+++ edited/drivers/usb/class/cdc-acm.c	Sun Oct 19 07:37:15 2003
@@ -1,5 +1,5 @@
 /*
- * acm.c  Version 0.21
+ * acm.c  Version 0.22
  *
  * Copyright (c) 1999 Armin Fuerst	<fuerst@in.tum.de>
  * Copyright (c) 1999 Pavel Machek	<pavel@suse.cz>
@@ -24,6 +24,8 @@
  *	v0.19 - fixed CLOCAL handling (thanks to Richard Shih-Ping Chan)
  *	v0.20 - switched to probing on interface (rather than device) class
  *	v0.21 - revert to probing on device for devices with multiple configs
+ *	v0.22 - probe only the control interface. if usbcore doesn't choose the
+ *		config we want, sysadmin changes bConfigurationValue in sysfs.
  */
 
 /*
@@ -139,7 +141,8 @@
 
 struct acm {
 	struct usb_device *dev;				/* the corresponding usb device */
-	struct usb_interface *iface;			/* the interfaces - +0 control +1 data */
+	struct usb_interface *control;			/* control interface */
+	struct usb_interface *data;			/* data interface */
 	struct tty_struct *tty;				/* the corresponding tty */
 	struct urb *ctrlurb, *readurb, *writeurb;	/* urbs */
 	struct acm_line line;				/* line coding (bits, stop, parity) */
@@ -167,12 +170,15 @@
 {
 	int retval = usb_control_msg(acm->dev, usb_sndctrlpipe(acm->dev, 0),
 		request, USB_RT_ACM, value,
-		acm->iface[0].altsetting[0].desc.bInterfaceNumber,
+		acm->control->altsetting[0].desc.bInterfaceNumber,
 		buf, len, HZ * 5);
 	dbg("acm_control_msg: rq: 0x%02x val: %#x len: %#x result: %d", request, value, len, retval);
 	return retval < 0 ? retval : 0;
 }
 
+/* devices aren't required to support these requests.
+ * the cdc acm descriptor tells whether they do...
+ */
 #define acm_set_control(acm, control)	acm_ctrl_msg(acm, ACM_REQ_SET_CONTROL, control, NULL, 0)
 #define acm_set_line(acm, line)		acm_ctrl_msg(acm, ACM_REQ_SET_LINE, 0, line, sizeof(struct acm_line))
 #define acm_send_break(acm, ms)		acm_ctrl_msg(acm, ACM_REQ_SEND_BREAK, ms, NULL, 0)
@@ -211,7 +217,7 @@
 
 		case ACM_IRQ_NETWORK:
 
-			dbg("%s network", data[0] ? "connected to" : "disconnected from");
+			dbg("%s network", dr->wValue ? "connected to" : "disconnected from");
 			break;
 
 		case ACM_IRQ_LINE_STATE:
@@ -546,17 +552,15 @@
 	struct usb_device *dev;
 	struct acm *acm;
 	struct usb_host_config *cfacm;
+	struct usb_interface *data;
 	struct usb_host_interface *ifcom, *ifdata;
 	struct usb_endpoint_descriptor *epctrl, *epread, *epwrite;
-	int readsize, ctrlsize, minor, i, j;
+	int readsize, ctrlsize, minor, j;
 	unsigned char *buf;
 
 	dev = interface_to_usbdev (intf);
-	for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
-
-		cfacm = dev->config + i;
 
-		dbg("probing config %d", cfacm->desc.bConfigurationValue);
+		cfacm = dev->actconfig;
 
 		for (j = 0; j < cfacm->desc.bNumInterfaces - 1; j++) {
 		    
@@ -564,19 +568,23 @@
 			    usb_interface_claimed(cfacm->interface[j + 1]))
 			continue;
 
-			ifcom = cfacm->interface[j]->altsetting + 0;
-			ifdata = cfacm->interface[j + 1]->altsetting + 0;
-
-			if (ifdata->desc.bInterfaceClass != 10 || ifdata->desc.bNumEndpoints < 2) {
-				ifcom = cfacm->interface[j + 1]->altsetting + 0;
+			/* We know we're probe()d with the control interface.
+			 * FIXME ACM doesn't guarantee the data interface is
+			 * adjacent to the control interface, or that if one
+			 * is there it's not for call management ... so use
+			 * the cdc union descriptor whenever there is one.
+			 */
+			ifcom = intf->altsetting + 0;
+			if (intf == cfacm->interface[j]) {
+				ifdata = cfacm->interface[j + 1]->altsetting + 0;
+				data = cfacm->interface[j + 1];
+			} else if (intf == cfacm->interface[j + 1]) {
 				ifdata = cfacm->interface[j]->altsetting + 0;
-				if (ifdata->desc.bInterfaceClass != 10 || ifdata->desc.bNumEndpoints < 2)
-					continue;
-			}
+				data = cfacm->interface[j];
+			} else
+				continue;
 
-			if (ifcom->desc.bInterfaceClass != 2 || ifcom->desc.bInterfaceSubClass != 2 ||
-			    ifcom->desc.bInterfaceProtocol < 1 || ifcom->desc.bInterfaceProtocol > 6 ||
-			    ifcom->desc.bNumEndpoints < 1)
+			if (ifdata->desc.bInterfaceClass != 10 || ifdata->desc.bNumEndpoints < 2)
 				continue;
 
 			epctrl = &ifcom->endpoint[0].desc;
@@ -593,15 +601,6 @@
 				epwrite = &ifdata->endpoint[0].desc;
 			}
 
-			/* FIXME don't scan every config. it's either correct
-			 * when we probe(), or some other task must fix this.
-			 */
-			if (dev->actconfig != cfacm) {
-				err("need inactive config #%d",
-					cfacm->desc.bConfigurationValue);
-				return -ENODEV;
-			}
-
 			for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++);
 			if (acm_table[minor]) {
 				err("no more free acm devices");
@@ -617,7 +616,8 @@
 			ctrlsize = epctrl->wMaxPacketSize;
 			readsize = epread->wMaxPacketSize;
 			acm->writesize = epwrite->wMaxPacketSize;
-			acm->iface = cfacm->interface[j];
+			acm->control = intf;
+			acm->data = data;
 			acm->minor = minor;
 			acm->dev = dev;
 
@@ -665,7 +665,7 @@
 				buf += readsize, acm->writesize, acm_write_bulk, acm);
 			acm->writeurb->transfer_flags |= URB_NO_FSBR;
 
-			info("ttyACM%d: USB ACM device", minor);
+			dev_info(&intf->dev, "ttyACM%d: USB ACM device", minor);
 
 			acm_set_control(acm, acm->ctrlout);
 
@@ -673,8 +673,7 @@
 			acm->line.databits = 8;
 			acm_set_line(acm, &acm->line);
 
-			usb_driver_claim_interface(&acm_driver, acm->iface + 0, acm);
-			usb_driver_claim_interface(&acm_driver, acm->iface + 1, acm);
+			usb_driver_claim_interface(&acm_driver, data, acm);
 
 			tty_register_device(acm_tty_driver, minor, &intf->dev);
 
@@ -682,7 +681,6 @@
 			usb_set_intfdata (intf, acm);
 			return 0;
 		}
-	}
 
 	return -EIO;
 }
@@ -705,8 +703,7 @@
 
 	kfree(acm->ctrlurb->transfer_buffer);
 
-	usb_driver_release_interface(&acm_driver, acm->iface + 0);
-	usb_driver_release_interface(&acm_driver, acm->iface + 1);
+	usb_driver_release_interface(&acm_driver, acm->data);
 
 	if (!acm->used) {
 		tty_unregister_device(acm_tty_driver, acm->minor);
@@ -727,8 +724,15 @@
  */
 
 static struct usb_device_id acm_ids[] = {
-	{ USB_DEVICE_INFO(USB_CLASS_COMM, 0, 0) },
-	{ USB_DEVICE_INFO(USB_CLASS_COMM, 2, 0) },
+	/* control interfaces with various AT-command sets */
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 1) },
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 2) },
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 3) },
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 4) },
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 5) },
+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 6) },
+
+	/* NOTE:  COMM/2/0xff is likely MSFT RNDIS ... NOT a modem!! */
 	{ }
 };
 
@@ -736,7 +740,7 @@
 
 static struct usb_driver acm_driver = {
 	.owner =	THIS_MODULE,
-	.name =		"acm",
+	.name =		"cdc_acm",
 	.probe =	acm_probe,
 	.disconnect =	acm_disconnect,
 	.id_table =	acm_ids,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ACM USB modem on Kernel 2.6.0-test
       [not found]   ` <Inm6.60T.19@gated-at.bofh.it>
@ 2003-10-20 16:54     ` Peter Matthias
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Matthias @ 2003-10-20 16:54 UTC (permalink / raw)
  To: linux-kernel

David Brownell schrieb:

>>>> In fact, here's a patch with that very change.  Does
>>>> it make current 2.6.0-test kernels work "out of the box"
>>>> again with your USB modems?
>>> 
>>> Yes, it works with ELSA Microlink USB. Thanks.
>> 
>> Hmm. Too early. I get either a "acm: probe of 3-3:2.1 failed with error
-5"
>> but it works or a 
>> Unable to handle kernel NULL pointer dereference at virtual address
00000008
>>  ...
>>  EIP:    0060:[usb_driver_claim_interface+67/112]    Tainted: P
>>  ...
> 
> Well, the "it works at all (without the sysfs write)" is
> what that patch was about -- so it's still a clear win!
> 
> But cdc-acm probe() is pretty broken, and I'm told it's
> had strange behavior in various other cases for a while,
> including some oopsing.  Like this; not a new bug.
> 
> Try this cdc-acm patch.  One user reported that it made
> oopsing go away, the bogus probe() errors stopped, and
> even the /proc/bus/usb/devices listings were finally
> right (both interfaces now claimed by cdc_acm).  Plus
> it should stop the pointless hotplugging of "cdc_acm"
> for Ethernet devices (including MSFT's RNDIS).

Yes, it works. I hope it will be integrated in 2.6.0.

Peter


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-10-20 16:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-11 18:53 ACM USB modem on Kernel 2.6.0-test David Brownell
2003-10-12 12:07 ` Jamie Lokier
2003-10-12 18:59   ` David Brownell
2003-10-17 20:04 ` David Brownell
2003-10-19 15:13   ` David Brownell
     [not found] <FJVJ.4PN.5@gated-at.bofh.it>
     [not found] ` <I1Yg.6oy.13@gated-at.bofh.it>
     [not found]   ` <I1Yg.6oy.11@gated-at.bofh.it>
2003-10-19  9:34     ` Peter Matthias
     [not found] <FwYB.Z9.25@gated-at.bofh.it>
2003-10-12  8:40 ` Peter Matthias
2003-10-12 12:06   ` Jamie Lokier
2003-10-12 17:52 ` Peter Matthias
2003-10-13 16:28 ` Peter Matthias
     [not found] ` <HJ5m.2Eb.23@gated-at.bofh.it>
2003-10-18 16:21   ` Peter Matthias
     [not found]   ` <Inm6.60T.19@gated-at.bofh.it>
2003-10-20 16:54     ` Peter Matthias
  -- strict thread matches above, loose matches on Subject: below --
2003-10-11 12:38 Peter Matthias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).