lsusb.c relies on Linux-specific byte-swap call

Joe Peterson <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi all,

I am a developer at Gentoo, and I work on a subproject that uses the
FreeBSD kernel.

The latest version of usbutils in Gentoo (0.73) uses the call:
__le16_to_cpu (in asm/byteorder.h).  This is not in FreeBSD, so it does
not build on the fbsd port.  I have patched it to work, but it might be
good to get this compatibility fix upstream.  Let me know if I should
contact the devel list instead.

						Thanks, Joe

Here is the patch:

--- usbutils-0.73/lsusb.c.old	2007-10-23 15:04:32 -0600
+++ usbutils-0.73/lsusb.c	2007-10-31 13:50:37 -0600
@@ -35,8 +35,17 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdarg.h>
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define le16_to_cpu(x) (x)
+#else
+#define le16_to_cpu	__bswap16
+#endif
+#else
 #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

-------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.