Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/org.cups.usb-quirks
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
0x04e8 0x344f whitelist

# Samsung M337x 387x 407x Series works without quirks
0x04e8 0x3460 whitelist
0x04e8 0x3460 whitelist no-alt-set

# Samsung ML-2160 Series (https://bugzilla.redhat.com/show_bug.cgi?id=873123)
0x04e8 0x330f unidir
Expand Down
13 changes: 10 additions & 3 deletions backend/usb-libusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ typedef struct usb_globals_s /* Global USB printer information */
#define USB_QUIRK_VENDOR_CLASS 0x0020 /* Descriptor uses vendor-specific
Class or SubClass */
#define USB_QUIRK_DELAY_CLOSE 0x0040 /* Delay close */
#define USB_QUIRK_NO_ALT_SET 0x0080 /* Some USB printers do not
like set_configuration and
set_interface */
#define USB_QUIRK_WHITELIST 0x0000 /* no quirks */


Expand Down Expand Up @@ -692,7 +695,8 @@ close_device(usb_printer_t *printer) /* I - Printer */
* If we have changed the configuration from one valid configuration
* to another, restore the old one
*/
if (printer->origconf > 0 && printer->origconf != number2)

if (printer->origconf > 0 && printer->origconf != number2 && !(printer->quirks & USB_QUIRK_NO_ALT_SET))
{
fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n",
number2, printer->origconf);
Expand Down Expand Up @@ -1339,6 +1343,9 @@ load_quirks(void)
if (strstr(line, " vendor-class"))
quirk->quirks |= USB_QUIRK_VENDOR_CLASS;

if (strstr(line, " no-alt-set"))
quirk->quirks |= USB_QUIRK_NO_ALT_SET;

cupsArrayAdd(all_quirks, quirk);
}

Expand Down Expand Up @@ -1597,7 +1604,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
}
number1 = confptr->bConfigurationValue;

if (number1 != current)
if (number1 != current && !(printer->quirks & USB_QUIRK_NO_ALT_SET))
{
fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n",
current, number1);
Expand Down Expand Up @@ -1649,7 +1656,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
* printers (e.g., Samsung) don't like usb_set_altinterface.
*/

if (confptr->interface[printer->iface].num_altsetting > 1)
if (confptr->interface[printer->iface].num_altsetting > 1 && !(printer->quirks & USB_QUIRK_NO_ALT_SET))
{
number1 = confptr->interface[printer->iface].
altsetting[printer->altset].bInterfaceNumber;
Expand Down
Loading