USB: fix comment about endianness of descriptors

This patch fixes a comment and clarifies the documentation about the
endianness of descriptors. The current policy is that descriptors will
be little-endian at the API even on big-endian systems; however the
/proc/bus/usb API predates this policy and presents descriptors with
some multibyte fields byte-swapped.

Signed-off-by: Phil Endecott <usb_endian_patch@chezphil.org>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Phil Endecott and committed by
Greg Kroah-Hartman
9a9fafb8 c33ba392

+10 -4
+4 -2
Documentation/usb/proc_usb_info.txt
··· 49 50 These files can be read as binary data. The binary data consists 51 of first the device descriptor, then the descriptors for each 52 - configuration of the device. That information is also shown in 53 - text form by the /proc/bus/usb/devices file, described later. 54 55 These files may also be used to write user-level drivers for the USB 56 devices. You would open the /proc/bus/usb/BBB/DDD file read/write,
··· 49 50 These files can be read as binary data. The binary data consists 51 of first the device descriptor, then the descriptors for each 52 + configuration of the device. Multi-byte fields in the device and 53 + configuration descriptors, but not other descriptors, are converted 54 + to host endianness by the kernel. This information is also shown 55 + in text form by the /proc/bus/usb/devices file, described later. 56 57 These files may also be used to write user-level drivers for the USB 58 devices. You would open the /proc/bus/usb/BBB/DDD file read/write,
+6 -2
include/linux/usb/ch9.h
··· 158 * (rarely) accepted by SET_DESCRIPTOR. 159 * 160 * Note that all multi-byte values here are encoded in little endian 161 - * byte order "on the wire". But when exposed through Linux-USB APIs, 162 - * they've been converted to cpu byte order. 163 */ 164 165 /*
··· 158 * (rarely) accepted by SET_DESCRIPTOR. 159 * 160 * Note that all multi-byte values here are encoded in little endian 161 + * byte order "on the wire". Within the kernel and when exposed 162 + * through the Linux-USB APIs, they are not converted to cpu byte 163 + * order; it is the responsibility of the client code to do this. 164 + * The single exception is when device and configuration descriptors (but 165 + * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD); 166 + * in this case the fields are converted to host endianness by the kernel. 167 */ 168 169 /*