On Tue, 2011-03-22 at 07:07 -0700, Greg KH wrote: > On Tue, Mar 22, 2011 at 05:26:01PM +1100, Benjamin Herrenschmidt wrote: > > Hi Greg ! > > > > I recently noticed that the output from lsusb was utterly wrong on PPC > > for 16-bit fields (like bad endianess :) > > > > Digging a bit I noticed a couple of things: > > > > - My distro (ubuntu, yeah I know how much you love them) variant of > > lsusb does: > > > > if (__BYTE_ORDER == __LITTLE_ENDIAN) > > #define le16_to_cpu(x) (x) > > #elif (__BYTE_ORDER == __BIG_ENDIAN) > > #define le16_to_cpu(x) bswap_16(x) > > #else > > #error missing BYTE_ORDER > > #endif > > What version of usbutils is this? Ubuntu says 0.87-4. Once you've "fixed" it properly upstream, I can point them (and debian while at it) to it and get them to "backport" the fix. Cheers, Ben. > > when reading a 16-bit field from a descriptor > > > > - "Upstream" usbutils does: > > > > #define le16_to_cpu(x) libusb_cpu_to_le16(libusb_cpu_to_le16(x)) > > > > Now, the later is obviously crackpot :-) It's really basically a nop > > right ? > > Yes it is. :) > > I commented on this a while ago but I got the report that it worked, and > no one else had a BE system, I didn't know what to do, so I left it. > > > The fun thing is, this is the -right- thing to do (tho I haven't built & > > tried that version yet). The trick is that descriptor structures parsed > > by libusb using usb_parse_descriptor and the "w" format will already > > have been appropriately byteswapped by libusb itself. > > > > So lsusb should never have to do that swapping again (and gives a bad > > example to other programs). > > Good point, I'll drop this entirely from the current version as we > should be fine now. > > 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