Public bug reported:

Binary package hint: usbutils

There's an endian bug in the lsusb version used in Ubuntu. At the top of
the lsusb.c file you can read:


#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

Which is then used whenever reading some 16-bit fields off descriptors.

This is incorrect. All the descriptor data structures are parsed by libusb 
using usb_parse_descriptor() which
already converts the endian of >8-bit fields. Hence, all pre-parsed descriptors 
coming into libusb should
-not- be swapped again.

Note that the "upstream" lsusb is even more funny, it does:

#define le16_to_cpu(x) libusb_cpu_to_le16(libusb_cpu_to_le16(x))

IE. It swaps -twice- which is stupid ... but probably works :-)

The right thing to do is to rip all of that out including the two call sites of 
le16_to_cpu()
as it's all in native endian already when coming out of libusb.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: usbutils 0.87-4
Uname: Linux 2.6.37 ppc64
Architecture: powerpc
Date: Tue Mar 22 17:35:44 2011
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=en_AU.utf8
 LANGUAGE=en_AU:en
SourcePackage: usbutils

** Affects: usbutils (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug maverick powerpc

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/739991

Title:
  Endian bug in lsusb

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to