On Fri, 3 Aug 2007, Inaky Perez-Gonzalez wrote:

> +/*
> + * WUSB devices are simple: they have no hubs behind, so the mapping
> + * device <-> virtual port number becomes 1:1. Why? to simplify the
> + * life of the device connection logic in
> + * drivers/usb/wusbcore/devconnect.c. When we do the initial secret
> + * handshake we need to assign a temporary address in the unauthorized
> + * space. For simplicity we use the first virtual port number found to
> + * be free [drivers/usb/wusbcore/devconnect.c:wusbhc_devconnect_ack()]
> + * and that becomes it's address [X < 128] or its unauthorized address
> + * [X | 0x80].
> + *
> + * We add 2 as an offset for two reasons: (1) dev addr 0 is reserved
> + * by USB for default address; (2) Linux's USB stack uses always #1 for
> + * the root hub of the controller. So port 0 has address #2.

This comment is a little confusing since the code really adds 1, not 2:

> +     if (udev->wusb) {
> +             devnum = udev->portnum + 1;

See?  Besides, the USB specs I've run across define port numbers
starting at 1, not 0.  Maybe the WUSB spec is different.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to