Re: Endianness of wTotalLength field

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

 



Greg KH wrote:
> On Fri, May 29, 2009 at 04:21:20PM -0400, Daniel Drake wrote:
>   
>> 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.
>>     
>
> Hm, this happened years ago, are you sure this is a new thing?
>
> thanks,
>
> greg k-h
>
>   
As far as I can tell, it's at least a current thing. This machine is
running a 2.6.30-rc4 kernel with a number of local patches unrelated to
USB. If you'd like me to try other kernels to figure out when it
changed, please let me know.

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