Re: Endianness of wTotalLength field

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

 



Joseph Jezak wrote:
Hi,

Recently, I tested libusb on a PowerPC processor and found that devices
were not enumerating. This was due to the assumption that the length of
the configuration descriptor was swapped to big endian, as with other 16
bit values in the descriptor. It appears (in core/config.c) that this
value is actually always left as a little endian value.

A few questions:
1. Is this a bug or expected behavior?
2. Is it documented anywhere?
3. Should user space applications that depend on /dev/bus/usb assume
that this value is always little endian?

To clarify, the surprise that we found is that the wTotalLength field from the device descriptor in (e.g.) /dev/bus/usb/001/001 is bus endian, not host endian, but the documentation in proc_usb_info.txt says:

These files can be read as binary data.  The binary data consists
of first the device descriptor, then the descriptors for each
configuration of the device.  Multi-byte fields in the device and
configuration descriptors, but not other descriptors, are converted
to host endianness by the kernel.

without mention of this exception.

Daniel
--
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