@@ -97,6 +97,9 @@ typedef struct usb_globals_s /* Global USB printer information */
9797#define USB_QUIRK_VENDOR_CLASS 0x0020 /* Descriptor uses vendor-specific
9898 Class or SubClass */
9999#define USB_QUIRK_DELAY_CLOSE 0x0040 /* Delay close */
100+ #define USB_QUIRK_NO_ALT_SET 0x0080 /* Some USB printers do not
101+ like set_configuration and
102+ set_interface */
100103#define USB_QUIRK_WHITELIST 0x0000 /* no quirks */
101104
102105
@@ -692,7 +695,8 @@ close_device(usb_printer_t *printer) /* I - Printer */
692695 * If we have changed the configuration from one valid configuration
693696 * to another, restore the old one
694697 */
695- if (printer -> origconf > 0 && printer -> origconf != number2 )
698+
699+ if (printer -> origconf > 0 && printer -> origconf != number2 && !(printer -> quirks & USB_QUIRK_NO_ALT_SET ))
696700 {
697701 fprintf (stderr , "DEBUG: Restoring USB device configuration: %d -> %d\n" ,
698702 number2 , printer -> origconf );
@@ -1339,6 +1343,9 @@ load_quirks(void)
13391343 if (strstr (line , " vendor-class" ))
13401344 quirk -> quirks |= USB_QUIRK_VENDOR_CLASS ;
13411345
1346+ if (strstr (line , " no-alt-set" ))
1347+ quirk -> quirks |= USB_QUIRK_NO_ALT_SET ;
1348+
13421349 cupsArrayAdd (all_quirks , quirk );
13431350 }
13441351
@@ -1597,7 +1604,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
15971604 }
15981605 number1 = confptr -> bConfigurationValue ;
15991606
1600- if (number1 != current )
1607+ if (number1 != current && !( printer -> quirks & USB_QUIRK_NO_ALT_SET ) )
16011608 {
16021609 fprintf (stderr , "DEBUG: Switching USB device configuration: %d -> %d\n" ,
16031610 current , number1 );
@@ -1649,7 +1656,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
16491656 * printers (e.g., Samsung) don't like usb_set_altinterface.
16501657 */
16511658
1652- if (confptr -> interface [printer -> iface ].num_altsetting > 1 )
1659+ if (confptr -> interface [printer -> iface ].num_altsetting > 1 && !( printer -> quirks & USB_QUIRK_NO_ALT_SET ) )
16531660 {
16541661 number1 = confptr -> interface [printer -> iface ].
16551662 altsetting [printer -> altset ].bInterfaceNumber ;
0 commit comments