Ticket #51 (closed defect: fixed)

Opened 18 months ago

Last modified 13 months ago

[PATCH] Descriptor endian parsing is backwards on big-endian hosts

Reported by: marcan Owned by: marcan
Component: libusb-1.0 Keywords:
Cc: Blocked By:
Blocks:

Description

Commit 9bea500b attempted to fix descriptor handling by using a flag to determine whether endianness is pre-swapped or not, since apparently usbfs descriptors are in host-endian order, while sysfs descriptors are always in bus-endian order. However, it got it backwards, parsing sysfs descriptors as host-endian order and usbfs descriptors as bus-endian.

The attached patch fixes the issue and solves issues getting configuration descriptors on big-endian targets. It has been tested on sysfs, but going by what information I've been able to find, it should be the correct behavior for usbfs too.

This does not affect little-endian hosts where host endian == bus endian and descriptor parsing never actually switches endianness.

Attachments

0001-Linux-Fix-endian-handling-for-usbfs-sysfs.patch (1.3 KB) - added by marcan 18 months ago.

Change History

comment:1 Changed 18 months ago by marcan

  • Summary changed from Descriptor endian parsing is backwards on big-endian hosts to [PATCH] Descriptor endian parsing is backwards on big-endian hosts

comment:2 Changed 13 months ago by marcan

  • Owner set to marcan
  • Status changed from new to closed
  • Resolution set to fixed

In [7f2e9f0776386997d2b4c4c47598ab88e3caeb7a/libusb]:

Linux: Fix usbfs/sysfs config descriptor handling on big-endian

usbfs endian-swaps, sysfs doesn't, not the other way around. Fixes #51;
descriptor endian parsing is backwards using sysfs on big-endian hosts.
usbfs is untested.

Signed-off-by: Hector Martin <hector@…>

[stuge: checked against Documentation/usb/proc_usb_info.txt]

Note: See TracTickets for help on using tickets.