Attachments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #51: 0001-Linux-Fix-endian-handling-for-usbfs-sysfs.patch

File 0001-Linux-Fix-endian-handling-for-usbfs-sysfs.patch, 1.3 KB (added by marcan, 21 months ago)
  • libusb/os/linux_usbfs.c

    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 b static int sysfs_get_active_config_descriptor(struct libusb_device *dev, 
    484484                if (off < 0) 
    485485                        return LIBUSB_ERROR_IO; 
    486486 
    487                 r = seek_to_next_config(DEVICE_CTX(dev), fd, 1); 
     487                r = seek_to_next_config(DEVICE_CTX(dev), fd, 0); 
    488488                if (r < 0) 
    489489                        return r; 
    490490        } 
    static int get_config_descriptor(struct libusb_context *ctx, int fd, 
    539539        /* might need to skip some configuration descriptors to reach the 
    540540         * requested configuration */ 
    541541        while (config_index > 0) { 
    542                 r = seek_to_next_config(ctx, fd, 0); 
     542                r = seek_to_next_config(ctx, fd, 1); 
    543543                if (r < 0) 
    544544                        return r; 
    545545                config_index--;