linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Peter Matthias <espi@epost.de>, Jamie Lokier <jamie@shareable.org>
Cc: linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net
Subject: Re: ACM USB modem on Kernel 2.6.0-test
Date: Fri, 17 Oct 2003 13:04:49 -0700	[thread overview]
Message-ID: <3F904B61.3020400@pacbell.net> (raw)
In-Reply-To: <3F8851A7.3000105@pacbell.net>

[-- 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);

  parent reply	other threads:[~2003-10-17 20:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F904B61.3020400@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=espi@epost.de \
    --cc=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).