On Wed, 21 Jul 2010 23:44:25 +0200, Adam Kropelin <akropel1@xxxxxxxxxxxxxxxx> wrote:
I have a composite device which consists of an RNDIS interface as well as several additional standard interfaces (cdc-serial, umass, etc.). These are all contained in a single configuration using IADs. I've discovered that kernels without CONFIG_USB_NET_RNDIS_HOST enabled will refuse to select any configuration, rendering the standard interfaces inaccessible (at least without additional jiggering). I traced this back to generic.c:usb_choose_configuration() which rejects configurations whose first interface is RNDIS when RNDIS is not enabled: | if (i == 0 && desc && (is_rndis(desc) || is_activesync(desc))) { |#if !defined(CONFIG_USB_NET_RNDIS_HOST) && !defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) | continue; |#else | best = c; |#endif | } I would propose one of two solutions: (A) Reject the configuration as we do today, but only if there are additional configurations available to choose from (i.e. bNumConfigurations > 1), or (B) Reject the configuration only if there are no additional interfaces in the config besides RNDIS. I lean toward (A). In the broader case, to some extent I wonder if the logic in usb_choose_configuration() should be as simple as choosing the one and only config regardless of any heuristics in all cases where only a single config is present. Is there value in failing to select any configuration at all?
I had an idea once to make the code choose configuration with the smallest bConfigurationValue. This way, composite devices could provide RNDIS configuration as the first one with bConifgurationValue == 2 and the other configuration, as second one, with bConfigurationValue == 1. This is what Ethernet gadget does for instance. Windows would still choose the first configuration so all would be grand. -- Best regards, _ _ | Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o | Computer Science, Michał "mina86" Nazarewicz (o o) +----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo-- -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html