From 8ca187b01405d789c2e1c6c885e3e071097db4a7 Mon Sep 17 00:00:00 2001
From: Hector Martin <hector@marcansoft.com>
Date: Wed, 25 Aug 2010 03:21:57 +0200
Subject: [PATCH] Linux: Fix endian handling for usbfs/sysfs

usbfs endian-swaps, sysfs doesn't, not the other way around. This fixes
configurator descriptors in big-endian systems when using sysfs. usbfs
is untested.

Signed-off-by: Hector Martin <hector@marcansoft.com>
---
 libusb/os/linux_usbfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index d0db7e2..ed1ce13 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -484,7 +484,7 @@ static int sysfs_get_active_config_descriptor(struct libusb_device *dev,
 		if (off < 0)
 			return LIBUSB_ERROR_IO;
 
-		r = seek_to_next_config(DEVICE_CTX(dev), fd, 1);
+		r = seek_to_next_config(DEVICE_CTX(dev), fd, 0);
 		if (r < 0)
 			return r;
 	}
@@ -539,7 +539,7 @@ static int get_config_descriptor(struct libusb_context *ctx, int fd,
 	/* might need to skip some configuration descriptors to reach the
 	 * requested configuration */
 	while (config_index > 0) {
-		r = seek_to_next_config(ctx, fd, 0);
+		r = seek_to_next_config(ctx, fd, 1);
 		if (r < 0)
 			return r;
 		config_index--;
-- 
1.7.1


