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

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

 



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.

We don't "update" any device descriptor. ->ep0 is setup by the gadget driver. There are some UDC which don't support 64 as max packet size for ep0 and set maxpacket to something less. This value is taken for the
bMaxPacketSize0 descriptor field which is not set by the udc.

The same kind of is required for all other gadgets which do not use the
composite framework like the printer gadget. However they don't support SS
and they may be more hiding so I postponed them.

Thanks,
Tanya Brokhman

Sebastian
--
Phone: +49 7556 91 98 91; Fax.: +49 7556 91 98 86

Firmensitz: 88690 Uhldingen, Auf dem Berg 3
Registergericht: Amtsgericht Freiburg i. Br., HRB 700 806;
StNr. 87007/07777; Ust-Id Nr.: DE252739476
Geschäftsführer: Heinz Egger, Thomas Gleixner
--
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