On Tue, 12 May 2015 09:21:37 +0900
Olaf Meeuwissen <[email protected]> wrote:

> This is a bug in the epson2 backend.  When you explicitly specify the
> device, it skips the probe for connected devices step which is the only
> place that looks at the configuration file.

 patch attached!

-- 

 Best regards,

 Alessandro Zummo - CEO,
  Tower Technologies - Torino, Italy

  http://www.towertech.it

diff --git a/backend/epson2.c b/backend/epson2.c
index f5bec71..13fe49d 100644
--- a/backend/epson2.c
+++ b/backend/epson2.c
@@ -586,12 +586,12 @@ static SANE_Status detect_scsi(struct Epson_Scanner *s)
 }
 
 static SANE_Status
-detect_usb(struct Epson_Scanner *s)
+detect_usb(struct Epson_Scanner *s, SANE_Bool assume_valid)
 {
 	SANE_Status status;
 	int vendor, product;
 	int i, numIds;
-	SANE_Bool is_valid;
+	SANE_Bool is_valid = assume_valid;
 
 	/* if the sanei_usb_get_vendor_product call is not supported,
 	 * then we just ignore this and rely on the user to config
@@ -613,14 +613,15 @@ detect_usb(struct Epson_Scanner *s)
 	}
 
 	numIds = sanei_epson_getNumberOfUSBProductIds();
-	is_valid = SANE_FALSE;
 	i = 0;
 
 	/* check all known product IDs to verify that we know
 	   about the device */
-	while (i != numIds && !is_valid) {
-		if (product == sanei_epson_usb_product_ids[i])
+	while (i != numIds) {
+		if (product == sanei_epson_usb_product_ids[i]) {
 			is_valid = SANE_TRUE;
+			break;
+		}
 		i++;
 	}
 
@@ -659,7 +660,7 @@ scanner_create(struct Epson_Device *dev, SANE_Status *status)
 }
 
 static struct Epson_Scanner *
-device_detect(const char *name, int type, SANE_Status *status)
+device_detect(const char *name, int type, SANE_Bool assume_valid, SANE_Status *status)
 {
 	struct Epson_Scanner *s;
 	struct Epson_Device *dev;
@@ -712,7 +713,7 @@ device_detect(const char *name, int type, SANE_Status *status)
 
 	} else if (dev->connection == SANE_EPSON_USB) {
 
-		*status = detect_usb(s);
+		*status = detect_usb(s, assume_valid);
 	}
 
 	if (*status != SANE_STATUS_GOOD)
@@ -770,7 +771,7 @@ attach(const char *name, int type)
 
 	DBG(7, "%s: devname = %s, type = %d\n", __func__, name, type);
 
-	s = device_detect(name, type, &status);
+	s = device_detect(name, type, 0, &status);
 	if(s == NULL)
 		return status;
 
@@ -1477,7 +1478,7 @@ sane_open(SANE_String_Const name, SANE_Handle *handle)
 		}
 
 		s = device_detect(first_dev->sane.name, first_dev->connection,
-					&status);
+					0, &status);
 		if (s == NULL) {
 			DBG(1, "cannot open a perfectly valid device (%s),"
 				" please report to the authors\n", name);
@@ -1487,15 +1488,15 @@ sane_open(SANE_String_Const name, SANE_Handle *handle)
 	} else {
 
 		if (strncmp(name, "net:", 4) == 0) {
-			s = device_detect(name, SANE_EPSON_NET, &status);
+			s = device_detect(name, SANE_EPSON_NET, 0, &status);
 			if (s == NULL)
 				return status;
 		} else if (strncmp(name, "libusb:", 7) == 0) {
-			s = device_detect(name, SANE_EPSON_USB, &status);
+			s = device_detect(name, SANE_EPSON_USB, 1, &status);
 			if (s == NULL)
 				return status;
 		} else if (strncmp(name, "pio:", 4) == 0) {
-			s = device_detect(name, SANE_EPSON_PIO, &status);
+			s = device_detect(name, SANE_EPSON_PIO, 0, &status);
 			if (s == NULL)
 				return status;
 		} else {
@@ -1508,7 +1509,7 @@ sane_open(SANE_String_Const name, SANE_Handle *handle)
 			if (first_dev == NULL)
 				probe_devices();
 
-			s = device_detect(name, SANE_EPSON_NODEV, &status);
+			s = device_detect(name, SANE_EPSON_NODEV, 0, &status);
 			if (s == NULL) {
 				DBG(1, "invalid device name: %s\n", name);
 				return SANE_STATUS_INVAL;
-- 
sane-devel mailing list: [email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [email protected]

Reply via email to