From 25bb101ea02e2146fc8555bb54b19c3ca8a39155 Mon Sep 17 00:00:00 2001 From: Alexander Pevzner Date: Mon, 18 Nov 2024 14:16:57 +0300 Subject: [PATCH] WSD: workaround for ADF Duplex on Brother MFC-9370CDW (closes #346) This device reports ADFSupportsDuplex as 0 but returns both ADFFront and ADFBack elements. As a workaround, we assume that if both ADFFront and ADFBack are present, the scanner supports ADF duplex mode, regardless of the value returned by ADFSupportsDuplex. --- airscan-wsd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/airscan-wsd.c b/airscan-wsd.c index 551045a..f0eaf5a 100644 --- a/airscan-wsd.c +++ b/airscan-wsd.c @@ -535,6 +535,20 @@ wsd_devcaps_parse_configuration (proto_handler_wsd *wsd, } } + /* Workaround for Brother MFC-9340CDW + * + * This device reports ADFSupportsDuplex as 0, but returns both + * ADFFront and ADFBack elements. + * + * As a workaround, we assume that if both ADFFront and ADFBack are + * present (temporary saved under the ID_SOURCE_ADF_SIMPLEX and + * ID_SOURCE_ADF_DUPLEX slots), scanner supports duplex mode, + * regardless of the ADFSupportsDuplex value it returns + */ + if (adf && caps->src[ID_SOURCE_ADF_DUPLEX] != NULL) { + duplex = true; + } + /* Please note that the standard model for SANE and for our implementation * involves having two separate configurations for the duplex ADF: one for * simplex mode and another for duplex mode. In duplex mode, it is assumed @@ -553,8 +567,8 @@ wsd_devcaps_parse_configuration (proto_handler_wsd *wsd, * assumed to be the same as ADFFront. * * During the decoding process, we temporarily store the ADF front - * information under the IDSOURCEADFSIMPLEX and the ADF back information - * under the IDSOURCEADFDUPLEX slots, and then make adjustments. + * information under the ID_SOURCE_ADF_SIMPLEX and the ADF back information + * under the ID_SOURCE_ADF_DUPLEX slots, and then make adjustments. * * When adjusting, we assume that the ADF front applies to both simplex and * duplex modes, while the ADF back applies only to duplex mode.