diff --git a/README b/README index 3089ad3..2908f8c 100644 --- a/README +++ b/README @@ -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 diff --git a/backend_common.c b/backend_common.c index 97991d4..11ef0d3 100644 --- a/backend_common.c +++ b/backend_common.c @@ -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); } diff --git a/backend_common.h b/backend_common.h index 8ac96b6..f41aeaf 100644 --- a/backend_common.h +++ b/backend_common.h @@ -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)