discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Re: libusb error on Mac OS X when building uhd driver


From: Elvis Dowson
Subject: [Discuss-gnuradio] Re: libusb error on Mac OS X when building uhd driver
Date: Sun, 05 Sep 2010 12:11:28 +0400

Hi,
      More specifically, there is a problem with calls to libusb_cpu_to_le16(x) in libusb.h

/** \def libusb_cpu_to_le16
 * \ingroup misc
 * Convert a 16-bit value from host-endian to little-endian format. On
 * little endian systems, this function does nothing. On big endian systems,
 * the bytes are swapped.
 * \param x the host-endian value to convert
 * \returns the value in little-endian byte order
 */
#define libusb_cpu_to_le16(x) ({ \
union { \
uint8_t  b8[2]; \
uint16_t b16; \
} _tmp; \
uint16_t _tmp2 = (uint16_t)(x); \
_tmp.b8[1] = _tmp2 >> 8; \
_tmp.b8[0] = _tmp2 & 0xff; \
_tmp.b16; \
})


This is called 4 times at line number 886,887,888 and 936 in libusb.h. I just commented it in the following code fragments , which allowed me to complete the build:

static inline void libusb_fill_control_setup(unsigned char *buffer,
uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
uint16_t wLength)
{
struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer;
setup->bmRequestType = bmRequestType;
setup->bRequest = bRequest;
// setup->wValue = libusb_cpu_to_le16(wValue);
// setup->wIndex = libusb_cpu_to_le16(wIndex);
// setup->wLength = libusb_cpu_to_le16(wLength);
}


static inline void libusb_fill_control_transfer(
struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
unsigned int timeout)
{
struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer;
transfer->dev_handle = dev_handle;
transfer->endpoint = 0;
transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
transfer->timeout = timeout;
transfer->buffer = buffer;
if (setup) {
// transfer->length = LIBUSB_CONTROL_SETUP_SIZE
// + libusb_le16_to_cpu(setup->wLength);
}
transfer->user_data = user_data;
transfer->callback = callback;
}


The gcc compiler version is the default one supplied with the latest version of xcode (3.2.3)

i686-apple-darwin10-gcc-4.2.1:


Best regards,

Elvis 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]