Re: lsusb.c relies on Linux-specific byte-swap call
Joe Peterson <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
David Brownell wrote: > On Monday 05 November 2007, Joe Peterson wrote: >> David Brownell wrote: >>> On Thursday 01 November 2007, Joe Peterson wrote: >>>> the byte order issue in the compile. BTW, attached is a new patch, >>>> which fixes the problem in configure.in, thereby making use of autotools >>>> rather than hard-coding the arch ifdef in the code: >>> Please submit a patch against current cvs for usbutils, which includes >>> your earlier patch... >>> >> Forgive my ignorance, but how to I access the CVS repo? > > Goto http://sourceforge.net/projects/linux-usb/ and follow > the "code -> cvs" link; use "usbutils" for the modulename. OK, great - thanks! Attached is the patch against your CVS that uses autotools instead of hard-coded __FreeBSD__. Thanks, Joe ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
byteorder.patch
(text/x-patch, 1.2 KB)
diff -Nur old/configure.in new/configure.in --- old/configure.in 2007-11-05 11:47:16.000000000 -0700 +++ new/configure.in 2007-11-05 11:47:24.000000000 -0700 @@ -20,7 +20,7 @@ AC_FUNC_ALLOCA AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h getopt.h errno.h ]) +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h getopt.h errno.h asm/byteorder.h machine/endian.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff -Nur old/lsusb.c new/lsusb.c --- old/lsusb.c 2007-11-05 11:47:04.000000000 -0700 +++ new/lsusb.c 2007-11-05 11:49:44.000000000 -0700 @@ -35,23 +35,17 @@ #include <errno.h> #include <stdio.h> #include <stdarg.h> - -#ifdef __FreeBSD__ - +#if defined(HAVE_ASM_BYTEORDER_H) +#include <asm/byteorder.h> +#define le16_to_cpu __le16_to_cpu +#elif defined(HAVE_MACHINE_ENDIAN_H) #include <machine/endian.h> #if _BYTE_ORDER == _LITTLE_ENDIAN #define le16_to_cpu(x) (x) #else #define le16_to_cpu __bswap16 #endif - -#else /* Linux */ - -#include <asm/byteorder.h> -#define le16_to_cpu __le16_to_cpu - #endif - #include <usb.h> /* NOTE: that should be <libusb.h> and it should include