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

"Xiaofan Chen" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On 11/1/07, Joe Peterson <[email protected]> wrote:
> 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>
>

Thanks for the patch. I've always wanted to look for such a utility under
FreeBSD and I do not know that usbutils work under FreeBSD. The
function is a bit different though since hubs are not found.

Xiaofan
http://mcuee.blogspot.com

-------------------------------------------------------------------------
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.