Re: [PATCH] usb: gadget: composite: fill bcdUSB for any gadget max speed

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

 



Hi,

On Wed, Aug 19, 2015 at 11:00:54AM +0200, Igor Kotrasinski wrote:
> 
> 
> On 08/18/2015 05:42 PM, Felipe Balbi wrote:
> > On Tue, Aug 18, 2015 at 11:06:32AM -0400, Alan Stern wrote:
> >> On Tue, 18 Aug 2015, Igor Kotrasinski wrote:
> >>
> >>> When handling device GET_DESCRIPTOR, composite gadget driver fills
> >>> the bcdUSB field only if the gadget supports USB 3.0. Otherwise
> >>> the field is left unfilled.
> >>>
> >>> Make behaviour consistent by filling bcdUSB for the other two cases of
> >>> USB 2.0 and USB 1.1 capable gadgets.
> >>>
> >>> Given that legacy gadget drivers set bcdUSB manually, it makes sense to
> >>> place the entire logic in the composite gadget driver.
> >>>
> >>> Signed-off-by: Igor Kotrasinski <i.kotrasinsk@xxxxxxxxxxx>
> >>> ---
> >>>  drivers/usb/gadget/composite.c | 4 ++++
> >>>  1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> >>> index 58b4657..6eac055 100644
> >>> --- a/drivers/usb/gadget/composite.c
> >>> +++ b/drivers/usb/gadget/composite.c
> >>> @@ -1499,6 +1499,10 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
> >>>  				} else {
> >>>  					cdev->desc.bcdUSB = cpu_to_le16(0x0210);
> >>>  				}
> >>> +			} else if (gadget_is_dualspeed(gadget)) {
> >>> +				cdev->desc.bcdUSB = cpu_to_le16(0x0200);
> >>> +			} else {
> >>> +				cdev->desc.bcdUSB = cpu_to_le16(0x0110);
> >>>  			}
> >> I would argue that there's no need to check gadget_is_dualspeed();
> >> bcdUSB should always be set to 0x0200.  After all, the spec explicitly
> >> permits USB-2.0 devices to run only at full speed.
> > we should actually set it to 0x0210 so we get to send BOS descriptors
> > :-)
> >
> If I understand it correctly then, gadget->max_speed isn't any
> indicator of supported standard?

well, it's an indicator of speed.

> Either way, some else block definitely should be there. I don't follow
> why 0x0210 is appropriate for all other gadget speeds; could you
> please, if possible, elaborate?

not all. You need to support BOS descriptor and LPM to use 0x0210. If
current udc supports that, there's no reason not to tell host we're
0x0210.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux