usb hub: fix root hub code so it takes more than 15 devices per root hub
Wireless USB Host Controllers accept a large number of devices per
host, which shows up as a large number of ports in its root hub.
When the number of ports in a hub device goes over 16, the activation
of the hub fails with the cryptic message in klogd.
hub 2-0:1.0: activate --> -22
Following this further, it was seen that:
hub_probe()
hub_configure()
generates pipe number
pseudo allocates buffer 'maxp' bytes in size using usb_maxpacket()
The endpoint descriptor for a root hub interrupt endpoint is
declared in
drivers/usb/core/hcd.c:hs_rh_config_descriptor and declares it
to be size two (supporting 15 devices max).
hub_activate()
usb_hcd_submit_urb()
rh_urb_enqueue()
urb->pipe is neither int nor ctl, so it errors out
rh_queue_status()
Returns -EINVAL because the buffer length is smaller
than the minimum needed to report all the hub port
bits as in accordance with USB2.0[11.12.3]. There has
to be trunc((PORTS + 1 + 7) / 8) bytes of space at
least.
Alan Stern confirmed that the reason for reading maxpktsize and not
the right amount is because some hubs are known to return more data
and thus cause overflow.
So this patch simply changes the code to make the interrupt endpoint's
max packet size be at least the minimum required by USB_MAXCHILDREN
(instead of a fixed magic number) and add documentation for that. This
way we are always ahead of the limit.