Re: [PATCH] usb/composite: fix bMaxPacketSize for SuperSpeed

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

 



Hi,

On Mon, Jul 18, 2011 at 12:38:03PM +0200, Sebastian Andrzej Siewior wrote:
> Tanya Brokhman wrote:
> >Hi Sebastian,
> Hi Tanya,
> 
> >>For bMaxPacketSize0 we usually take what is specified in ep0-
> >>>maxpacket.
> >>This is fine in most cases, however on SuperSpeed bMaxPacketSize0
> >>specifies the exponent instead of the actual size in bytes. The only
> >>valid value on SS is 9 which denotes 512 bytes.
> >>
> >
> >You're right but something in this patch still bothers me: according to your
> >patch it is possible that cdev->gadget->ep0->maxpacket (that is set by the
> >DCD) won't match the bMaxPacketSize0 we report to the host in the device
> >descriptor.
> >cdev->gadget->ep0->maxpacket should be determined by the DCD otherwise it
> >won't function correctly. So, you're right that it should be 9 for SS but it
> >seems to me that it should be the DCDs responsibility to set the correct
> >value.
> >In the current code the device descriptor is updated according to the value
> >of bMaxPacketSize0 set by the DCD:
> >
> >	cdev->desc.bMaxPacketSize0 =	cdev->gadget->ep0->maxpacket;
> >
> >I think this should remain as is. For If the DCD declared that it supports
> >SS but neglected to set cdev->gadget->ep0->maxpacket to the correct value it
> >doesn't seem right to me to update the device descriptor.
> >I would add a warning message (or even ERROR) if the speed is SS but
> >cdev->gadget->ep0->maxpacket != 9.
> 
> I've been thinking about this and decided against it:
> maxpacket size is u16 and used in various for comparison for instance in
> the choose_ep code. It can be even 1024 on bulk SS eps. So if we change
> the meaning of the field from bytes to exponent than it makes the code
> more complicated as it has to check speed each time.

moreover ep*->maxpacket is a copy of wMaxPacketSize, not
bMaxPacketSize0 ;-)

wMaxPacketSize is 512 for SS ep0.

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