Thread (1 message) 1 message, 1 author, 2015-06-10

Re: [PATCH v2 01/22] usb: add OTG version number in usb_otg_descriptor

From: Li Jun <hidden>
Date: 2015-06-10 13:53:37

On Tue, Jun 09, 2015 at 10:16:23AM -0400, Alan Stern wrote:
On Tue, 9 Jun 2015, Li Jun wrote:
quoted
quoted
quoted
-/* USB_DT_OTG (from OTG 1.0a supplement) */
+/* USB_DT_OTG */
 struct usb_otg_descriptor {
 	__u8  bLength;
 	__u8  bDescriptorType;
 
 	__u8  bmAttributes;	/* support for HNP, SRP, etc */
+	struct bcdOTG otg_rev[0];
why not just __le16 bcdOTG here ?
usb_otg_descriptor of OTG 1.0 and 2.0 have different size, if directly add
__le16 bcdOTG here, then it cannot used for OTG 1.0.
I use a zero length array as Peter suggested here for bcdOTG, then the size
of usb_otg_descriptor is still 3(not 5), which is compliant with OTG 1.x, if OTG
2.0 or later, we can use member of otg_rev to add bcdOTG, then the size
of usb_otg_descriptor + bcdOTG will be 5, in one word, I want to use existing
usb_otg_descriptor struct to cover both OTG 1.x and 2.0
In the end, you may find it is simpler to use two different 
structures: usb_otg_descriptor and usb_otg_20_descriptor.  
Try it and see.
That should be, I will try your suggested approach, thanks.

Li Jun
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help