common: Re-add the libusb < 1.0.13 workarounds.

It comes with a GIANT WARNING if you are affected by the workaround.
This commit is contained in:
Solomon Peachy 2014-02-08 18:41:29 -05:00
parent 29bfe527de
commit 2e3cf70dba
3 changed files with 12 additions and 3 deletions

3
README
View File

@ -93,7 +93,8 @@
***************************************************************************
Compilation:
You will need libusb/libusbx v1.0.13 (or newer) to build this tool.
You will need libusb/libusbx 1.0 to build this tool.
We recommend v1.0.13 (or newer) for full functionality.
Fedora/RedHat:
yum install libusbx-devel

View File

@ -27,13 +27,14 @@
#include "backend_common.h"
#define BACKEND_VERSION "0.33"
#define BACKEND_VERSION "0.34"
#ifndef URI_PREFIX
#error "Must Define URI_PREFIX"
#endif
#if !defined(LIBUSBX_API_VERSION) && !defined(LIBUSB_API_VERSION)
#error "We need libusb >= 1.0.13!"
#define OLDLIBUSB_WORKAROUND
#warning "We HIGHLY recommend using libusb >= 1.0.13!"
#endif
/* Support Functions */
@ -232,7 +233,13 @@ static int print_scan_output(struct libusb_device *device,
uint8_t port_num;
bus_num = libusb_get_bus_number(device);
#ifdef OLDLIBUSB_WORKAROUND
WARNING("**** THIS PRINTER DOES NOT EXPORT A SERIAL NUMBER AND YOU ARE USING LIBUSB < 1.0.13\n");
WARNING("**** We cannot identify individual printers of this type without a newer version of libusb!\n");
port_num = 255;
#else
port_num = libusb_get_port_number(device);
#endif
sprintf((char*)serial, "NONE_B%03d_D%03d", bus_num, port_num);
}

View File

@ -45,6 +45,7 @@
#define DEBUG( ... ) fprintf(stderr, "DEBUG: " __VA_ARGS__ )
#define DEBUG2( ... ) fprintf(stderr, __VA_ARGS__ )
#define INFO( ... ) fprintf(stderr, "INFO: " __VA_ARGS__ )
#define WARNING( ... ) fprintf(stderr, "WARNING: " __VA_ARGS__ )
#define ERROR( ... ) do { fprintf(stderr, "ERROR: " __VA_ARGS__ ); sleep(1); } while (0)
#if (__BYTE_ORDER == __LITTLE_ENDIAN)