On Thu, 27 Jan 2011, Tatyana Brokhman wrote: > This patch adds SS support to the dummy hcd module. It may be used to test > SS device when no (SS) HW is available. > USB 3.0 hub includes 2 hubs - HS and SS ones. > This patch adds support for a SS hub in the dummy_hcd module. Thus, when > dummy_hcd enabled it will register 2 root hubs (SS and HS). Getting there. A few spots could still use some attention. Also, you might try running this patch through checkpatch.pl and fixing any complaints it makes. > @@ -343,7 +431,13 @@ dummy_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) > dum = ep_to_dummy (ep); > if (!dum->driver || !is_enabled (dum)) > return -ESHUTDOWN; > - max = le16_to_cpu(desc->wMaxPacketSize) & 0x3ff; > + max = le16_to_cpu(desc->wMaxPacketSize) ; > + /* > + * For HS/FS devices only bits 0..9 of the wMaxPacketSize represent the > + * maximum packet size > + */ > + if (dum->gadget.speed < USB_SPEED_SUPER) > + max &= 0x3ff; Strictly speaking, both the old and the new code are wrong. For all devices, regardless of speed, we should say: max = le16_to_cpu(desc->wMaxPacketSize) & 0x7ff; In other words, the speed is contained in bits 0..10 (not 0..9). > @@ -1352,6 +1559,10 @@ static void dummy_timer (unsigned long _dum) > case USB_SPEED_HIGH: > total = 512/*bytes*/ * 13/*packets*/ * 8/*uframes*/; > break; > + case USB_SPEED_SUPER: > + /* 400MBps = 400*(2^20)/1000 bytes per milisec */ > + total = (400 << 20) / 1000; > + break; Ugh. For one thing, SuperSpeed runs at 500 million bytes/s, not 400 million. For another, 400 << 20 isn't equal to 400 million. Don't try to be too clever. Realizing that this is only an approximation anyway, just say: /* Bus speed is 500000 bytes/ms, so use a little less */ total = 490000; Alan Stern -- 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