- The IPP backend now retries Validate-Job requests (Issue #132)
- Reverted USB read limit enforcement change from CUPS 2.2.12 (Issue #72)
- Now use a 60 second timeout for reading USB backchannel data (Issue #160)
+- The USB backend now tries harder to find a serial number (Issue #170)
- Documentation fixes (Issue #92, Issue #163)
- Localization updates (Issue #123, Issue #129, Issue #134, Issue #146,
Issue #164)
/*
* LIBUSB interface code for CUPS.
*
- * Copyright 2007-2019 by Apple Inc.
+ * Copyright © 2021 by OpenPrinting.
+ * Copyright © 2007-2019 by Apple Inc.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
- if ((sern = cupsGetOption("SN", num_values, values)) == NULL &&
- ((libusb_get_device_descriptor(printer->device, &devdesc) >= 0) &&
- devdesc.iSerialNumber))
- {
- /*
- * Try getting the serial number from the device itself...
- */
+ sern = cupsGetOption("SN", num_values, values);
- int length =
- libusb_get_string_descriptor_ascii(printer->handle,
- devdesc.iSerialNumber,
- (unsigned char *)tempsern,
- sizeof(tempsern) - 1);
- if (length > 0)
- {
- tempsern[length] = '\0';
- sern = tempsern;
- }
- }
+ if ((!sern || !*sern) && ((libusb_get_device_descriptor(printer->device, &devdesc) >= 0) && devdesc.iSerialNumber))
+ {
+ /*
+ * Try getting the serial number from the device itself...
+ */
+
+ int length = libusb_get_string_descriptor_ascii(printer->handle, devdesc.iSerialNumber, (unsigned char *)tempsern, sizeof(tempsern) - 1);
+ if (length > 0)
+ {
+ tempsern[length] = '\0';
+ sern = tempsern;
+ }
+ }
if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL)
mfg = cupsGetOption("MFG", num_values, values);