/* takes a usbfs/descriptors fd seeked to the start of a configuration, and
* seeks to the next one. */
-static int seek_to_next_config(struct libusb_context *ctx, int fd)
+static int seek_to_next_config(struct libusb_context *ctx, int fd,
+ int host_endian)
{
struct libusb_config_descriptor config;
unsigned char tmp[6];
}
/* seek forward to end of config */
- usbi_parse_descriptor(tmp, "bbwbb", &config, 0);
+ usbi_parse_descriptor(tmp, "bbwbb", &config, host_endian);
off = lseek(fd, config.wTotalLength - sizeof(tmp), SEEK_CUR);
if (off < 0) {
usbi_err(ctx, "seek failed ret=%d errno=%d", off, errno);
if (off < 0)
return LIBUSB_ERROR_IO;
- r = seek_to_next_config(DEVICE_CTX(dev), fd);
+ r = seek_to_next_config(DEVICE_CTX(dev), fd, 1);
if (r < 0)
return r;
}
/* might need to skip some configuration descriptors to reach the
* requested configuration */
while (config_index > 0) {
- r = seek_to_next_config(ctx, fd);
+ r = seek_to_next_config(ctx, fd, 0);
if (r < 0)
return r;
config_index--;