Fix problem with "usb <vendor> <product> syntax in config file

merge-requests/1/head
Karl Heinz Kremer 2003-02-15 18:18:58 +00:00
rodzic e273cc36f9
commit aae28825db
4 zmienionych plików z 41 dodań i 10 usunięć

Wyświetl plik

@ -1,3 +1,8 @@
2003-02-15 Karl Heinz Kremer <khk@khk.net>
* backend/epson.c backend/epson_usb.[ch]: Fix problem with
"usb <vendor> <product> syntax in config file
2003-02-13 Henning Meier-Geinitz <henning@meier-geinitz.de> 2003-02-13 Henning Meier-Geinitz <henning@meier-geinitz.de>
* doc/descriptions/unsupported.desc: Updated Canon, Fujitsu, and * doc/descriptions/unsupported.desc: Updated Canon, Fujitsu, and

Wyświetl plik

@ -16,8 +16,8 @@
*/ */
#define SANE_EPSON_VERSION "SANE Epson Backend v0.2.32 - 2002-12-28" #define SANE_EPSON_VERSION "SANE Epson Backend v0.2.33 - 2003-02-15"
#define SANE_EPSON_BUILD 232 #define SANE_EPSON_BUILD 233
/* /*
This file is part of the SANE package. This file is part of the SANE package.
@ -59,6 +59,7 @@
If you do not wish that, delete this exception notice. */ If you do not wish that, delete this exception notice. */
/* /*
2003-02-15 Fix problem with "usb <vendor> <product> syntax in config file
2002-12-28 Added advanced option to display only short resolution list for 2002-12-28 Added advanced option to display only short resolution list for
displays that can not show the complete list. displays that can not show the complete list.
2002-11-23 Fixed problem with dropout color. 2002-11-23 Fixed problem with dropout color.
@ -75,7 +76,8 @@
2002-04-13 Check if scanner needs to be opened for the reset call. 2002-04-13 Check if scanner needs to be opened for the reset call.
(Thanks to Thomas Wenrich for pointing this out) (Thanks to Thomas Wenrich for pointing this out)
Added product IDs for Perfection 1650 and 2450 Added product IDs for Perfection 1650 and 2450
2002-01-18 Recognize GT-xxxx type scanners also when using the SCSI or IEEE-1394 interface 2002-01-18 Recognize GT-xxxx type scanners also when using the SCSI
or IEEE-1394 interface
2002-01-06 Disable TEST_IOCTL again, which was enabled by accident. Also 2002-01-06 Disable TEST_IOCTL again, which was enabled by accident. Also
protect the ioctl portion with an #ifdef __linux__ protect the ioctl portion with an #ifdef __linux__
2002-01-05 Version 0.2.17 2002-01-05 Version 0.2.17
@ -1788,8 +1790,11 @@ attach(const char * dev_name, Epson_Device * * devp, int type)
if ((!isLibUSB) && (strlen(dev_name) == 0)) if ((!isLibUSB) && (strlen(dev_name) == 0))
{ {
int i; int i;
i = 0; int numIds;
while (sanei_epson_usb_product_ids[i] != 0)
numIds = sanei_epson_getNumberOfUSBProductIds();
for (i = 0; i < numIds; i++)
{ {
product = sanei_epson_usb_product_ids[i]; product = sanei_epson_usb_product_ids[i];
vendor = 0x4b8; vendor = 0x4b8;
@ -1816,6 +1821,7 @@ attach(const char * dev_name, Epson_Device * * devp, int type)
if (sanei_usb_get_vendor_product (s->fd, &vendor, &product) == SANE_STATUS_GOOD) if (sanei_usb_get_vendor_product (s->fd, &vendor, &product) == SANE_STATUS_GOOD)
{ {
int i; /* loop variable */ int i; /* loop variable */
int numIds;
SANE_Bool is_valid; SANE_Bool is_valid;
/* check the vendor ID to see if we are dealing with an EPSON device */ /* check the vendor ID to see if we are dealing with an EPSON device */
@ -1829,11 +1835,13 @@ attach(const char * dev_name, Epson_Device * * devp, int type)
return SANE_STATUS_INVAL; return SANE_STATUS_INVAL;
} }
i = 0; /* start with the first element */ numIds = sanei_epson_getNumberOfUSBProductIds();
is_valid = SANE_FALSE; is_valid = SANE_FALSE;
i = 0;
/* check all known product IDs to verify that we know about the device */ /* check all known product IDs to verify that we know
while (sanei_epson_usb_product_ids[i] != 0 && !is_valid) about the device */
while (i != numIds && !is_valid)
{ {
if (product == sanei_epson_usb_product_ids[i]) if (product == sanei_epson_usb_product_ids[i])
is_valid = SANE_TRUE; is_valid = SANE_TRUE;
@ -2231,8 +2239,17 @@ sane_init(SANE_Int * version_code, SANE_Auth_Callback authorize)
if( !len) if( !len)
continue; /* ignore empty lines */ continue; /* ignore empty lines */
if (sscanf(line, "usb %d %d", &vendor, &product) == 2) if (sscanf(line, "usb %i %i", &vendor, &product) == 2)
{ {
int numIds;
/* add the vendor and product IDs to the list of
known devices before we call the attach function */
numIds = sanei_epson_getNumberOfUSBProductIds();
if (vendor != 0x4b8)
continue; /* this is not an EPSON device */
sanei_epson_usb_product_ids[numIds-1] = product;
sanei_usb_attach_matching_devices(line, attach_one_usb); sanei_usb_attach_matching_devices(line, attach_one_usb);
} }
else if (strncmp(line, "usb", 3) == 0) else if (strncmp(line, "usb", 3) == 0)

Wyświetl plik

@ -21,6 +21,13 @@ SANE_Word sanei_epson_usb_product_ids [] =
0x11e, /* Perfection 1660 */ 0x11e, /* Perfection 1660 */
0x801, /* CX-5200 */ 0x801, /* CX-5200 */
0x802, /* CX-3200 */ 0x802, /* CX-3200 */
0 /* last entry */ 0 /* last entry - this is used for devices that are specified
in the config file as "usb <vendor> <product>" */
}; };
int sanei_epson_getNumberOfUSBProductIds()
{
return sizeof(sanei_epson_usb_product_ids)/sizeof(SANE_Word);
}

Wyświetl plik

@ -6,4 +6,6 @@
extern SANE_Word sanei_epson_usb_product_ids []; extern SANE_Word sanei_epson_usb_product_ids [];
extern int sanei_epson_getNumberOfUSBProductIds();
#endif #endif