core: Kill the 'host_endian' argument for most functions

The 'host_endian' argument exists only for a special case in the Linux
backend, that being when the device descriptor is read using usbfs
rather than sysfs. It does not apply to any other descriptor types nor
any other backends, so remove it.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/libusb/descriptor.c b/libusb/descriptor.c
index 95a6cd7..e4f376f 100644
--- a/libusb/descriptor.c
+++ b/libusb/descriptor.c
@@ -30,10 +30,7 @@
  * for detected devices
  */
 
-/* set host_endian if the w values are already in host endian format,
- * as opposed to bus endian. */
-static void parse_descriptor(const unsigned char *source, const char *descriptor,
-	void *dest, int host_endian)
+static void parse_descriptor(const unsigned char *source, const char *descriptor, void *dest)
 {
 	const unsigned char *sp = source;
 	unsigned char *dp = dest;
@@ -49,25 +46,17 @@
 			case 'w':	/* 16-bit word, convert from little endian to CPU */
 				dp += ((uintptr_t)dp & 1);	/* Align to word boundary */
 
-				if (host_endian) {
-					memcpy(dp, sp, 2);
-				} else {
-					w = (uint16_t)((sp[1] << 8) | sp[0]);
-					*((uint16_t *)dp) = w;
-				}
+				w = (uint16_t)((sp[1] << 8) | sp[0]);
+				*((uint16_t *)dp) = w;
 				sp += 2;
 				dp += 2;
 				break;
 			case 'd':	/* 32-bit word, convert from little endian to CPU */
 				dp += ((uintptr_t)dp & 1);	/* Align to word boundary */
 
-				if (host_endian) {
-					memcpy(dp, sp, 4);
-				} else {
-					d = (uint32_t)((sp[3] << 24) | (sp[2] << 16) |
-								   (sp[1] << 8) | sp[0]);
-					*((uint32_t *)dp) = d;
-				}
+				d = (uint32_t)((sp[3] << 24) | (sp[2] << 16) |
+							   (sp[1] << 8) | sp[0]);
+				*((uint32_t *)dp) = d;
 				sp += 4;
 				dp += 4;
 				break;
@@ -86,8 +75,7 @@
 }
 
 static int parse_endpoint(struct libusb_context *ctx,
-	struct libusb_endpoint_descriptor *endpoint, unsigned char *buffer,
-	int size, int host_endian)
+	struct libusb_endpoint_descriptor *endpoint, unsigned char *buffer, int size)
 {
 	struct usbi_descriptor_header *header;
 	unsigned char *extra;
@@ -112,9 +100,9 @@
 		return parsed;
 	}
 	if (header->bLength >= LIBUSB_DT_ENDPOINT_AUDIO_SIZE)
-		parse_descriptor(buffer, "bbbbwbbb", endpoint, host_endian);
+		parse_descriptor(buffer, "bbbbwbbb", endpoint);
 	else if (header->bLength >= LIBUSB_DT_ENDPOINT_SIZE)
-		parse_descriptor(buffer, "bbbbwb", endpoint, host_endian);
+		parse_descriptor(buffer, "bbbbwb", endpoint);
 	else {
 		usbi_err(ctx, "invalid endpoint bLength (%d)", header->bLength);
 		return LIBUSB_ERROR_IO;
@@ -198,8 +186,7 @@
 }
 
 static int parse_interface(libusb_context *ctx,
-	struct libusb_interface *usb_interface, unsigned char *buffer, int size,
-	int host_endian)
+	struct libusb_interface *usb_interface, unsigned char *buffer, int size)
 {
 	int i;
 	int len;
@@ -225,7 +212,7 @@
 		usb_interface->altsetting = altsetting;
 
 		ifp = altsetting + usb_interface->num_altsetting;
-		parse_descriptor(buffer, "bbbbbbbbb", ifp, 0);
+		parse_descriptor(buffer, "bbbbbbbbb", ifp);
 		if (ifp->bDescriptorType != LIBUSB_DT_INTERFACE) {
 			usbi_err(ctx, "unexpected descriptor %x (expected %x)",
 				 ifp->bDescriptorType, LIBUSB_DT_INTERFACE);
@@ -314,8 +301,7 @@
 			}
 
 			for (i = 0; i < ifp->bNumEndpoints; i++) {
-				r = parse_endpoint(ctx, endpoint + i, buffer, size,
-					host_endian);
+				r = parse_endpoint(ctx, endpoint + i, buffer, size);
 				if (r < 0)
 					goto err;
 				if (r == 0) {
@@ -356,8 +342,7 @@
 }
 
 static int parse_configuration(struct libusb_context *ctx,
-	struct libusb_config_descriptor *config, unsigned char *buffer,
-	int size, int host_endian)
+	struct libusb_config_descriptor *config, unsigned char *buffer, int size)
 {
 	int i;
 	int r;
@@ -370,7 +355,7 @@
 		return LIBUSB_ERROR_IO;
 	}
 
-	parse_descriptor(buffer, "bbwbbbbb", config, host_endian);
+	parse_descriptor(buffer, "bbwbbbbb", config);
 	if (config->bDescriptorType != LIBUSB_DT_CONFIG) {
 		usbi_err(ctx, "unexpected descriptor %x (expected %x)",
 			 config->bDescriptorType, LIBUSB_DT_CONFIG);
@@ -453,7 +438,7 @@
 			}
 		}
 
-		r = parse_interface(ctx, usb_interface + i, buffer, size, host_endian);
+		r = parse_interface(ctx, usb_interface + i, buffer, size);
 		if (r < 0)
 			goto err;
 		if (r == 0) {
@@ -473,8 +458,7 @@
 }
 
 static int raw_desc_to_config(struct libusb_context *ctx,
-	unsigned char *buf, int size, int host_endian,
-	struct libusb_config_descriptor **config)
+	unsigned char *buf, int size, struct libusb_config_descriptor **config)
 {
 	struct libusb_config_descriptor *_config = malloc(sizeof(*_config));
 	int r;
@@ -482,7 +466,7 @@
 	if (!_config)
 		return LIBUSB_ERROR_NO_MEM;
 
-	r = parse_configuration(ctx, _config, buf, size, host_endian);
+	r = parse_configuration(ctx, _config, buf, size);
 	if (r < 0) {
 		usbi_err(ctx, "parse_configuration failed with error %d", r);
 		free(_config);
@@ -555,11 +539,9 @@
 	struct libusb_config_descriptor _config;
 	unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
 	unsigned char *buf = NULL;
-	int host_endian = 0;
 	int r;
 
-	r = usbi_backend.get_active_config_descriptor(dev, tmp,
-		LIBUSB_DT_CONFIG_SIZE, &host_endian);
+	r = usbi_backend.get_active_config_descriptor(dev, tmp, sizeof(tmp));
 	if (r < 0)
 		return r;
 	if (r < LIBUSB_DT_CONFIG_SIZE) {
@@ -568,15 +550,14 @@
 		return LIBUSB_ERROR_IO;
 	}
 
-	parse_descriptor(tmp, "bbw", &_config, host_endian);
+	parse_descriptor(tmp, "bbw", &_config);
 	buf = malloc(_config.wTotalLength);
 	if (!buf)
 		return LIBUSB_ERROR_NO_MEM;
 
-	r = usbi_backend.get_active_config_descriptor(dev, buf,
-		_config.wTotalLength, &host_endian);
+	r = usbi_backend.get_active_config_descriptor(dev, buf, _config.wTotalLength);
 	if (r >= 0)
-		r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
+		r = raw_desc_to_config(dev->ctx, buf, r, config);
 
 	free(buf);
 	return r;
@@ -604,15 +585,13 @@
 	struct libusb_config_descriptor _config;
 	unsigned char tmp[LIBUSB_DT_CONFIG_SIZE];
 	unsigned char *buf = NULL;
-	int host_endian = 0;
 	int r;
 
 	usbi_dbg("index %d", config_index);
 	if (config_index >= dev->device_descriptor.bNumConfigurations)
 		return LIBUSB_ERROR_NOT_FOUND;
 
-	r = usbi_backend.get_config_descriptor(dev, config_index, tmp,
-		LIBUSB_DT_CONFIG_SIZE, &host_endian);
+	r = usbi_backend.get_config_descriptor(dev, config_index, tmp, sizeof(tmp));
 	if (r < 0)
 		return r;
 	if (r < LIBUSB_DT_CONFIG_SIZE) {
@@ -621,15 +600,14 @@
 		return LIBUSB_ERROR_IO;
 	}
 
-	parse_descriptor(tmp, "bbw", &_config, host_endian);
+	parse_descriptor(tmp, "bbw", &_config);
 	buf = malloc(_config.wTotalLength);
 	if (!buf)
 		return LIBUSB_ERROR_NO_MEM;
 
-	r = usbi_backend.get_config_descriptor(dev, config_index, buf,
-		_config.wTotalLength, &host_endian);
+	r = usbi_backend.get_config_descriptor(dev, config_index, buf, _config.wTotalLength);
 	if (r >= 0)
-		r = raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
+		r = raw_desc_to_config(dev->ctx, buf, r, config);
 
 	free(buf);
 	return r;
@@ -648,9 +626,8 @@
 	usbi_dbg("value %d", bConfigurationValue);
 	for (i = 0; i < dev->device_descriptor.bNumConfigurations; i++) {
 		unsigned char tmp[6];
-		int host_endian;
-		int r = usbi_backend.get_config_descriptor(dev, i, tmp, sizeof(tmp),
-			&host_endian);
+		int r = usbi_backend.get_config_descriptor(dev, i, tmp, sizeof(tmp));
+
 		if (r < 0) {
 			*idx = -1;
 			return r;
@@ -685,15 +662,15 @@
 int API_EXPORTED libusb_get_config_descriptor_by_value(libusb_device *dev,
 	uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
 {
-	int r, idx, host_endian;
+	int r, idx;
 	unsigned char *buf = NULL;
 
 	if (usbi_backend.get_config_descriptor_by_value) {
 		r = usbi_backend.get_config_descriptor_by_value(dev,
-			bConfigurationValue, &buf, &host_endian);
+			bConfigurationValue, &buf);
 		if (r < 0)
 			return r;
-		return raw_desc_to_config(dev->ctx, buf, r, host_endian, config);
+		return raw_desc_to_config(dev->ctx, buf, r, config);
 	}
 
 	r = usbi_get_config_index_by_value(dev, bConfigurationValue, &idx);
@@ -767,7 +744,7 @@
 		*ep_comp = malloc(sizeof(**ep_comp));
 		if (*ep_comp == NULL)
 			return LIBUSB_ERROR_NO_MEM;
-		parse_descriptor(buffer, "bbbbw", *ep_comp, 0);
+		parse_descriptor(buffer, "bbbbw", *ep_comp);
 		return LIBUSB_SUCCESS;
 	}
 	return LIBUSB_ERROR_NOT_FOUND;
@@ -789,7 +766,7 @@
 
 static int parse_bos(struct libusb_context *ctx,
 	struct libusb_bos_descriptor **bos,
-	unsigned char *buffer, int size, int host_endian)
+	unsigned char *buffer, int size)
 {
 	struct libusb_bos_descriptor bos_header, *_bos;
 	struct libusb_bos_dev_capability_descriptor dev_cap;
@@ -801,7 +778,7 @@
 		return LIBUSB_ERROR_IO;
 	}
 
-	parse_descriptor(buffer, "bbwb", &bos_header, host_endian);
+	parse_descriptor(buffer, "bbwb", &bos_header);
 	if (bos_header.bDescriptorType != LIBUSB_DT_BOS) {
 		usbi_err(ctx, "unexpected descriptor %x (expected %x)",
 			 bos_header.bDescriptorType, LIBUSB_DT_BOS);
@@ -822,7 +799,7 @@
 	if (!_bos)
 		return LIBUSB_ERROR_NO_MEM;
 
-	parse_descriptor(buffer, "bbwb", _bos, host_endian);
+	parse_descriptor(buffer, "bbwb", _bos);
 	buffer += bos_header.bLength;
 	size -= bos_header.bLength;
 
@@ -833,7 +810,7 @@
 				  size, LIBUSB_DT_DEVICE_CAPABILITY_SIZE);
 			break;
 		}
-		parse_descriptor(buffer, "bbb", &dev_cap, host_endian);
+		parse_descriptor(buffer, "bbb", &dev_cap);
 		if (dev_cap.bDescriptorType != LIBUSB_DT_DEVICE_CAPABILITY) {
 			usbi_warn(ctx, "unexpected descriptor %x (expected %x)",
 				  dev_cap.bDescriptorType, LIBUSB_DT_DEVICE_CAPABILITY);
@@ -883,7 +860,6 @@
 	struct libusb_bos_descriptor _bos;
 	uint8_t bos_header[LIBUSB_DT_BOS_SIZE] = {0};
 	unsigned char *bos_data = NULL;
-	const int host_endian = 0;
 	int r;
 
 	/* Read the BOS. This generates 2 requests on the bus,
@@ -901,7 +877,7 @@
 		return LIBUSB_ERROR_IO;
 	}
 
-	parse_descriptor(bos_header, "bbwb", &_bos, host_endian);
+	parse_descriptor(bos_header, "bbwb", &_bos);
 	usbi_dbg("found BOS descriptor: size %d bytes, %d capabilities",
 		 _bos.wTotalLength, _bos.bNumDeviceCaps);
 	bos_data = calloc(_bos.wTotalLength, 1);
@@ -911,7 +887,7 @@
 	r = libusb_get_descriptor(dev_handle, LIBUSB_DT_BOS, 0, bos_data,
 				  _bos.wTotalLength);
 	if (r >= 0)
-		r = parse_bos(HANDLE_CTX(dev_handle), bos, bos_data, r, host_endian);
+		r = parse_bos(HANDLE_CTX(dev_handle), bos, bos_data, r);
 	else
 		usbi_err(HANDLE_CTX(dev_handle), "failed to read BOS (%d)", r);
 
@@ -957,7 +933,6 @@
 	struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension)
 {
 	struct libusb_usb_2_0_extension_descriptor *_usb_2_0_extension;
-	const int host_endian = 0;
 
 	if (dev_cap->bDevCapabilityType != LIBUSB_BT_USB_2_0_EXTENSION) {
 		usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
@@ -975,8 +950,7 @@
 	if (!_usb_2_0_extension)
 		return LIBUSB_ERROR_NO_MEM;
 
-	parse_descriptor((unsigned char *)dev_cap, "bbbd",
-			 _usb_2_0_extension, host_endian);
+	parse_descriptor((unsigned char *)dev_cap, "bbbd", _usb_2_0_extension);
 
 	*usb_2_0_extension = _usb_2_0_extension;
 	return LIBUSB_SUCCESS;
@@ -1015,7 +989,6 @@
 	struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap)
 {
 	struct libusb_ss_usb_device_capability_descriptor *_ss_usb_device_cap;
-	const int host_endian = 0;
 
 	if (dev_cap->bDevCapabilityType != LIBUSB_BT_SS_USB_DEVICE_CAPABILITY) {
 		usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
@@ -1033,8 +1006,7 @@
 	if (!_ss_usb_device_cap)
 		return LIBUSB_ERROR_NO_MEM;
 
-	parse_descriptor((unsigned char *)dev_cap, "bbbbwbbw",
-			 _ss_usb_device_cap, host_endian);
+	parse_descriptor((unsigned char *)dev_cap, "bbbbwbbw", _ss_usb_device_cap);
 
 	*ss_usb_device_cap = _ss_usb_device_cap;
 	return LIBUSB_SUCCESS;
@@ -1073,7 +1045,6 @@
 	struct libusb_container_id_descriptor **container_id)
 {
 	struct libusb_container_id_descriptor *_container_id;
-	const int host_endian = 0;
 
 	if (dev_cap->bDevCapabilityType != LIBUSB_BT_CONTAINER_ID) {
 		usbi_err(ctx, "unexpected bDevCapabilityType %x (expected %x)",
@@ -1091,8 +1062,7 @@
 	if (!_container_id)
 		return LIBUSB_ERROR_NO_MEM;
 
-	parse_descriptor((unsigned char *)dev_cap, "bbbbu",
-			 _container_id, host_endian);
+	parse_descriptor((unsigned char *)dev_cap, "bbbbu", _container_id);
 
 	*container_id = _container_id;
 	return LIBUSB_SUCCESS;
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index a0bb1b4..9d1528f 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -887,8 +887,7 @@
 	 * return an error code.
 	 *
 	 * This function is expected to return the descriptor in bus-endian format
-	 * (LE). If it returns the multi-byte values in host-endian format,
-	 * set the host_endian output parameter to "1".
+	 * (LE).
 	 *
 	 * Return:
 	 * - 0 on success
@@ -896,7 +895,7 @@
 	 * - another LIBUSB_ERROR code on other failure
 	 */
 	int (*get_active_config_descriptor)(struct libusb_device *device,
-		unsigned char *buffer, size_t len, int *host_endian);
+		unsigned char *buffer, size_t len);
 
 	/* Get a specific configuration descriptor for a device.
 	 *
@@ -914,14 +913,12 @@
 	 * return an error code.
 	 *
 	 * This function is expected to return the descriptor in bus-endian format
-	 * (LE). If it returns the multi-byte values in host-endian format,
-	 * set the host_endian output parameter to "1".
+	 * (LE).
 	 *
 	 * Return the length read on success or a LIBUSB_ERROR code on failure.
 	 */
 	int (*get_config_descriptor)(struct libusb_device *device,
-		uint8_t config_index, unsigned char *buffer, size_t len,
-		int *host_endian);
+		uint8_t config_index, unsigned char *buffer, size_t len);
 
 	/* Like get_config_descriptor but then by bConfigurationValue instead
 	 * of by index.
@@ -936,8 +933,7 @@
 	 * or a LIBUSB_ERROR code on failure.
 	 */
 	int (*get_config_descriptor_by_value)(struct libusb_device *device,
-		uint8_t bConfigurationValue, unsigned char **buffer,
-		int *host_endian);
+		uint8_t bConfigurationValue, unsigned char **buffer);
 
 	/* Get the bConfigurationValue for the active configuration for a device.
 	 * Optional. This should only be implemented if you can retrieve it from
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 9c639c1..bbac912 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -75,7 +75,7 @@
 /* async event thread */
 static pthread_t libusb_darwin_at;
 
-static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian);
+static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len);
 static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int iface);
 static int darwin_release_interface(struct libusb_device_handle *dev_handle, int iface);
 static int darwin_reset_device(struct libusb_device_handle *dev_handle);
@@ -667,8 +667,6 @@
   /* return cached copy */
   memmove (buffer, &(priv->dev_descriptor), LIBUSB_DT_DEVICE_SIZE);
 
-  *host_endian = 0;
-
   return LIBUSB_SUCCESS;
 }
 
@@ -694,7 +692,7 @@
   return LIBUSB_ERROR_NOT_FOUND;
 }
 
-static int darwin_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len, int *host_endian) {
+static int darwin_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len) {
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
   int config_index;
 
@@ -706,10 +704,10 @@
     return config_index;
 
   assert(config_index >= 0 && config_index <= UINT8_MAX);
-  return darwin_get_config_descriptor (dev, (UInt8)config_index, buffer, len, host_endian);
+  return darwin_get_config_descriptor (dev, (UInt8)config_index, buffer, len);
 }
 
-static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian) {
+static int darwin_get_config_descriptor(struct libusb_device *dev, uint8_t config_index, unsigned char *buffer, size_t len) {
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
   IOUSBConfigurationDescriptorPtr desc;
   IOReturn kresult;
@@ -725,9 +723,6 @@
       len = libusb_le16_to_cpu(desc->wTotalLength);
 
     memmove (buffer, desc, len);
-
-    /* GetConfigurationDescriptorPtr returns the descriptor in USB bus order */
-    *host_endian = 0;
   }
 
   ret = darwin_to_libusb (kresult);
diff --git a/libusb/os/haiku_usb_raw.cpp b/libusb/os/haiku_usb_raw.cpp
index 087b227..e0a8c9a 100644
--- a/libusb/os/haiku_usb_raw.cpp
+++ b/libusb/os/haiku_usb_raw.cpp
@@ -30,7 +30,7 @@
 int32 gInitCount = 0;
 
 static int haiku_get_config_descriptor(struct libusb_device *, uint8_t,
-    unsigned char *, size_t, int *);
+    unsigned char *, size_t);
 
 static int
 haiku_init(struct libusb_context *ctx)
@@ -79,19 +79,18 @@
 {
 	USBDevice *dev = *((USBDevice **)usbi_get_device_priv(device));
 	memcpy(buffer, dev->Descriptor(), LIBUSB_DT_DEVICE_SIZE);
-	*host_endian = 0;
 	return LIBUSB_SUCCESS;
 }
 
 static int
-haiku_get_active_config_descriptor(struct libusb_device *device, unsigned char *buffer, size_t len, int *host_endian)
+haiku_get_active_config_descriptor(struct libusb_device *device, unsigned char *buffer, size_t len)
 {
 	USBDevice *dev = *((USBDevice **)usbi_get_device_priv(device));
-	return haiku_get_config_descriptor(device, dev->ActiveConfigurationIndex(), buffer, len, host_endian);
+	return haiku_get_config_descriptor(device, dev->ActiveConfigurationIndex(), buffer, len);
 }
 
 static int
-haiku_get_config_descriptor(struct libusb_device *device, uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
+haiku_get_config_descriptor(struct libusb_device *device, uint8_t config_index, unsigned char *buffer, size_t len)
 {
 	USBDevice *dev = *((USBDevice **)usbi_get_device_priv(device));
 	const usb_configuration_descriptor *config = dev->ConfigurationDescriptor(config_index);
@@ -103,7 +102,6 @@
 		len = config->total_length;
 	}
 	memcpy(buffer, config, len);
-	*host_endian = 0;
 	return len;
 }
 
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index a1662e4..435a38b 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -694,7 +694,7 @@
 }
 
 static int op_get_config_descriptor_by_value(struct libusb_device *dev,
-	uint8_t value, unsigned char **buffer, int *host_endian)
+	uint8_t value, unsigned char **buffer)
 {
 	struct linux_device_priv *priv = usbi_get_device_priv(dev);
 	unsigned char *descriptors = priv->descriptors;
@@ -702,8 +702,6 @@
 	struct usbi_configuration_descriptor *config;
 
 	*buffer = NULL;
-	/* Unlike the device desc. config descs. are always in raw format */
-	*host_endian = 0;
 
 	/* Skip device header */
 	descriptors += LIBUSB_DT_DEVICE_SIZE;
@@ -726,7 +724,7 @@
 }
 
 static int op_get_active_config_descriptor(struct libusb_device *dev,
-	unsigned char *buffer, size_t len, int *host_endian)
+	unsigned char *buffer, size_t len)
 {
 	struct linux_device_priv *priv = usbi_get_device_priv(dev);
 	int r, config;
@@ -743,8 +741,7 @@
 	if (config == -1)
 		return LIBUSB_ERROR_NOT_FOUND;
 
-	r = op_get_config_descriptor_by_value(dev, config, &config_desc,
-					      host_endian);
+	r = op_get_config_descriptor_by_value(dev, config, &config_desc);
 	if (r < 0)
 		return r;
 
@@ -754,15 +751,12 @@
 }
 
 static int op_get_config_descriptor(struct libusb_device *dev,
-	uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
+	uint8_t config_index, unsigned char *buffer, size_t len)
 {
 	struct linux_device_priv *priv = usbi_get_device_priv(dev);
 	unsigned char *descriptors = priv->descriptors;
 	int i, r, size = priv->descriptors_len;
 
-	/* Unlike the device desc. config descs. are always in raw format */
-	*host_endian = 0;
-
 	/* Skip device header */
 	descriptors += LIBUSB_DT_DEVICE_SIZE;
 	size -= LIBUSB_DT_DEVICE_SIZE;
diff --git a/libusb/os/netbsd_usb.c b/libusb/os/netbsd_usb.c
index 49f4439..dab7692 100644
--- a/libusb/os/netbsd_usb.c
+++ b/libusb/os/netbsd_usb.c
@@ -55,9 +55,9 @@
 static int netbsd_get_device_descriptor(struct libusb_device *, unsigned char *,
     int *);
 static int netbsd_get_active_config_descriptor(struct libusb_device *,
-    unsigned char *, size_t, int *);
+    unsigned char *, size_t);
 static int netbsd_get_config_descriptor(struct libusb_device *, uint8_t,
-    unsigned char *, size_t, int *);
+    unsigned char *, size_t);
 
 static int netbsd_get_configuration(struct libusb_device_handle *, int *);
 static int netbsd_set_configuration(struct libusb_device_handle *, int);
@@ -230,14 +230,12 @@
 
 	memcpy(buf, &dpriv->ddesc, LIBUSB_DT_DEVICE_SIZE);
 
-	*host_endian = 0;
-
 	return (LIBUSB_SUCCESS);
 }
 
 int
 netbsd_get_active_config_descriptor(struct libusb_device *dev,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	struct device_priv *dpriv = usbi_get_device_priv(dev);
 	usb_config_descriptor_t *ucd;
@@ -249,14 +247,12 @@
 
 	memcpy(buf, dpriv->cdesc, len);
 
-	*host_endian = 0;
-
 	return len;
 }
 
 int
 netbsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	struct device_priv *dpriv = usbi_get_device_priv(dev);
 	struct usb_full_desc ufd;
@@ -287,8 +283,6 @@
 	if (dpriv->fd < 0)
 		close(fd);
 
-	*host_endian = 0;
-
 	return len;
 }
 
diff --git a/libusb/os/null_usb.c b/libusb/os/null_usb.c
index 7893b0c..bb6d981 100644
--- a/libusb/os/null_usb.c
+++ b/libusb/os/null_usb.c
@@ -45,14 +45,14 @@
 
 static int
 null_get_active_config_descriptor(struct libusb_device *dev,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	return LIBUSB_ERROR_NOT_SUPPORTED;
 }
 
 static int
 null_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	return LIBUSB_ERROR_NOT_SUPPORTED;
 }
diff --git a/libusb/os/openbsd_usb.c b/libusb/os/openbsd_usb.c
index 55db699..e10d656 100644
--- a/libusb/os/openbsd_usb.c
+++ b/libusb/os/openbsd_usb.c
@@ -55,9 +55,9 @@
 static int obsd_get_device_descriptor(struct libusb_device *, unsigned char *,
     int *);
 static int obsd_get_active_config_descriptor(struct libusb_device *,
-    unsigned char *, size_t, int *);
+    unsigned char *, size_t);
 static int obsd_get_config_descriptor(struct libusb_device *, uint8_t,
-    unsigned char *, size_t, int *);
+    unsigned char *, size_t);
 
 static int obsd_get_configuration(struct libusb_device_handle *, int *);
 static int obsd_set_configuration(struct libusb_device_handle *, int);
@@ -265,14 +265,12 @@
 
 	memcpy(buf, &dpriv->ddesc, LIBUSB_DT_DEVICE_SIZE);
 
-	*host_endian = 0;
-
 	return (LIBUSB_SUCCESS);
 }
 
 int
 obsd_get_active_config_descriptor(struct libusb_device *dev,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	struct device_priv *dpriv = usbi_get_device_priv(dev);
 	usb_config_descriptor_t *ucd = (usb_config_descriptor_t *)dpriv->cdesc;
@@ -283,14 +281,12 @@
 
 	memcpy(buf, dpriv->cdesc, len);
 
-	*host_endian = 0;
-
 	return (len);
 }
 
 int
 obsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
-    unsigned char *buf, size_t len, int *host_endian)
+    unsigned char *buf, size_t len)
 {
 	struct usb_device_fdesc udf;
 	int fd, err;
@@ -313,8 +309,6 @@
 	}
 	close(fd);
 
-	*host_endian = 0;
-
 	return (len);
 }
 
diff --git a/libusb/os/sunos_usb.c b/libusb/os/sunos_usb.c
index bc66859..0d8198f 100644
--- a/libusb/os/sunos_usb.c
+++ b/libusb/os/sunos_usb.c
@@ -63,11 +63,11 @@
 static int sunos_open(struct libusb_device_handle *);
 static void sunos_close(struct libusb_device_handle *);
 static int sunos_get_device_descriptor(struct libusb_device *,
-    uint8_t*, int *);
+    uint8_t *, int *);
 static int sunos_get_active_config_descriptor(struct libusb_device *,
-    uint8_t*, size_t, int *);
+    uint8_t *, size_t);
 static int sunos_get_config_descriptor(struct libusb_device *, uint8_t,
-    uint8_t*, size_t, int *);
+    uint8_t *, size_t);
 static int sunos_get_configuration(struct libusb_device_handle *, int *);
 static int sunos_set_configuration(struct libusb_device_handle *, int);
 static int sunos_claim_interface(struct libusb_device_handle *, int);
@@ -1026,14 +1026,13 @@
 	sunos_dev_priv_t *dpriv = usbi_get_device_priv(dev);
 
 	memcpy(buf, &dpriv->dev_descr, LIBUSB_DT_DEVICE_SIZE);
-	*host_endian = 0;
 
 	return (LIBUSB_SUCCESS);
 }
 
 int
 sunos_get_active_config_descriptor(struct libusb_device *dev,
-    uint8_t *buf, size_t len, int *host_endian)
+    uint8_t *buf, size_t len)
 {
 	sunos_dev_priv_t *dpriv = usbi_get_device_priv(dev);
 	struct libusb_config_descriptor *cfg;
@@ -1070,7 +1069,6 @@
 	cfg = (struct libusb_config_descriptor *)dpriv->raw_cfgdescr;
 	len = MIN(len, libusb_le16_to_cpu(cfg->wTotalLength));
 	memcpy(buf, dpriv->raw_cfgdescr, len);
-	*host_endian = 0;
 	usbi_dbg("path:%s len %" PRIuPTR, dpriv->phypath, len);
 
 	return (len);
@@ -1078,10 +1076,10 @@
 
 int
 sunos_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
-    uint8_t *buf, size_t len, int *host_endian)
+    uint8_t *buf, size_t len)
 {
 	/* XXX */
-	return(sunos_get_active_config_descriptor(dev, buf, len, host_endian));
+	return(sunos_get_active_config_descriptor(dev, buf, len));
 }
 
 int
diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c
index 418b6b7..3d1175d 100644
--- a/libusb/os/windows_common.c
+++ b/libusb/os/windows_common.c
@@ -602,31 +602,27 @@
 	unsigned char *buffer, int *host_endian)
 {
 	struct windows_context_priv *priv = usbi_get_context_priv(DEVICE_CTX(dev));
-	*host_endian = 0;
 	return priv->backend->get_device_descriptor(dev, buffer);
 }
 
 static int windows_get_active_config_descriptor(struct libusb_device *dev,
-	unsigned char *buffer, size_t len, int *host_endian)
+	unsigned char *buffer, size_t len)
 {
 	struct windows_context_priv *priv = usbi_get_context_priv(DEVICE_CTX(dev));
-	*host_endian = 0;
 	return priv->backend->get_active_config_descriptor(dev, buffer, len);
 }
 
 static int windows_get_config_descriptor(struct libusb_device *dev,
-	uint8_t config_index, unsigned char *buffer, size_t len, int *host_endian)
+	uint8_t config_index, unsigned char *buffer, size_t len)
 {
 	struct windows_context_priv *priv = usbi_get_context_priv(DEVICE_CTX(dev));
-	*host_endian = 0;
 	return priv->backend->get_config_descriptor(dev, config_index, buffer, len);
 }
 
 static int windows_get_config_descriptor_by_value(struct libusb_device *dev,
-	uint8_t bConfigurationValue, unsigned char **buffer, int *host_endian)
+	uint8_t bConfigurationValue, unsigned char **buffer)
 {
 	struct windows_context_priv *priv = usbi_get_context_priv(DEVICE_CTX(dev));
-	*host_endian = 0;
 	return priv->backend->get_config_descriptor_by_value(dev, bConfigurationValue, buffer);
 }
 
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 88eb388..f2e5eaa 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11505
+#define LIBUSB_NANO 11506