Re: lsusb USB descriptor fields byteswapped on BE

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

 



On Wed, Oct 28, 2009 at 12:01:57AM +0100, Michael Buesch wrote:
> On Tuesday 27 October 2009 23:38:29 Greg KH wrote:
> > On Tue, Oct 27, 2009 at 11:28:16PM +0100, Michael Buesch wrote:
> > > On Tuesday 27 October 2009 22:20:05 Greg KH wrote:
> > > > On Tue, Oct 27, 2009 at 10:00:21PM +0100, Michael Buesch wrote:
> > > > > Hi Greg,
> > > > > 
> > > > > The following fields are byteswapped in lsusb on BigEndian machines:
> > > > > 
> > > > > wTotalLength		(Config descriptor)
> > > > > wMaxPacketSize		(EP descriptor)
> > > > 
> > > > How so?  Can you provide the output of 'lsusb -v' so I can see it?
> > > 
> > > 
> > > Here's an example prototype device for which I know what the values must look like.
> > > Other devices look similiar.
> > > 
> > > wTotalLength 12288 is 0x30 swapped.
> > > wMaxPacketSize 0x4000 is 0x40 swapped.
> > > 0x30 and 0x40 would be the correct values. So it certainly is a byteorder issue.
> > > 
> > > This is lsusb version 0.73 (Debian Lenny stable). I didn't try a newer upstream version.
> > 
> > This was fixed back in May of 2006 and should have showed up in the 0.73
> > release.  If you could, can you grab a newer version of usbutils, like
> > the upstream version, to see if it is still an issue or not?
> 
> version 0.86 shows the same behavior.
> The endianness check in lsusb.c does also work correctly.
> 
> The following patch will produce the correct result.
> 
> However, the patch obviously is incorrect.
> I suspect that libusb (or the kernel) already swapped the values for us.
> Look at those other 16bit values like idProduct, idVendor, bcdXXX...
> Those are correctly displayed and usbutils does _not_ byteswap them.
> So I guess either libusb (or the kernel) does.
> 
> 
> --- usbutils-0.86.orig/lsusb.c
> +++ usbutils-0.86/lsusb.c
> @@ -41,7 +41,7 @@
>  
>  #include <getopt.h>
>  
> -#if (__BYTE_ORDER == __LITTLE_ENDIAN)
> +#if (__BYTE_ORDER == __LITTLE_ENDIAN) ||1

Somehow __BYTE_ORDER isn't getting set properly on your platform.  Care
to work to figure out what it is set to?

thanks,

greg k-h
--
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