On Thu, Apr 24 2014, Andrzej Pietrasiewicz wrote: > @@ -438,8 +440,46 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value) > > } > > - /* This is a lookup by config *INDEX* */ > w_value &= 0xff; > + /* > + * This is a lookup to make non-compliant USB hosts happy. > + * > + * By non-compliant USB hosts I mean those which only ask for > + * configuration @index 0. > + * If one configuration is marked "special" by storing > + * its address in cdev->os_desc_config, we try returning > + * exactly this configuration. > + * > + * Otherwise, regular list lookup is performed. > + * > + * If we are connected to a compliant USB host _and_ > + * one configuration is "special" we report it @ index 0, > + * but report remaining configurations as well - with adjusted > + * indices. > + */ The purpose of this is confusing to me. Why not have the configurations in desired order? Or why not rearrange configurations instead of setting os_desc_config? > + c = cdev->os_desc_config; > + if (c) { > + if (!w_value) { > + switch (speed) { > + case USB_SPEED_SUPER: > + if (!c->superspeed) > + goto list_lookup; > + break; > + case USB_SPEED_HIGH: > + if (!c->highspeed) > + goto list_lookup; > + break; > + default: > + if (!c->fullspeed) > + goto list_lookup; > + } > + > + return config_buf(c, speed, cdev->req->buf, type); > + } > + --w_value; /* account for conf returned @ index 0 */ > + } > +list_lookup: > + /* This is a lookup by config *INDEX* */ > list_for_each_entry(c, &cdev->configs, list) { > /* ignore configs that won't work at this speed */ > switch (speed) { -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo--
Attachment:
signature.asc
Description: PGP signature