Re: [RFC 3/9] usb: gadget: OS Feature Descriptors support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michal,

W dniu 01.05.2014 03:42, Michal Nazarewicz pisze:
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?

The hosts uses indices to select device's configurations.
The gadget effectively assigns indices in the order usb_add_config()
invocations.

The solution proposed in this patch is with configfs interface in mind.

When a gadget is composed with configfs the usb_add_config() is invoked
each time a configuration's directory is created, so this way configurations'
indices are determined. If we were to rearrange the configurations if
one of them becomes "special" then we loose the information about the original
sequence of configurations (i.e. which was index 0, index 1 etc). If the user
then decides that they don't want to use "OS descriptors" (=> no "special"
configuration) than we end up with configurations presented to the host in
different order than they were created.

What I propose is to leave the list of configurations intact while
allowing one of them to be "special" in a way that it is reported to
appear at index 0. This way if "OS descriptors" are used then the
"special" configuration appears @ index 0 to the host. This must be
the case because the hosts which expect "OS descriptors" are mainly
ones which never use configurations at indices other than 0.
If "OS descriptors" are not used, then the configurations are reported
to be at indices corresponding to the sequence in which the configurations
have been added. And with configfs interface the user can create some
configurations, specify that "OS descriptors" are to be used and then
change their mind and specify not to use "OS descriptors". And still
the configurations reported to the host will be at indices corresponding
to the sequence usb_add_config() invocations.

Does this make sense to you?

AP


--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux