diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-05-28 05:47:52 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-05-28 05:47:52 +0200 |
commit | f6019e643b0d510d267344a0a74f85f4c0a9187c (patch) | |
tree | b87554587285d010e2c43b4a70cf85c5852023b2 | |
parent | f1a78dec1fea8834a7fa849e5c6792fe1ba5128d (diff) |
New git20150528
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | backend/epson2.c | 67 | ||||
-rw-r--r-- | backend/epsonds-cmd.c | 2 | ||||
-rw-r--r-- | backend/epsonds.c | 105 | ||||
-rw-r--r-- | backend/epsonds.h | 1 | ||||
-rw-r--r-- | backend/pixma.h | 2 | ||||
-rw-r--r-- | backend/pixma_imageclass.c | 6 | ||||
-rw-r--r-- | doc/descriptions/pixma.desc | 8 | ||||
-rw-r--r-- | doc/sane-pixma.man | 4 |
9 files changed, 78 insertions, 122 deletions
@@ -1,3 +1,8 @@ +2015-05-18 Rolf Bensch <rolf at bensch hyphen online dot de> + * backend/pixma_imageclass.c, doc/descriptions/pixma.desc, doc/sane-pixma.man: + New scanner Canon i-SENSYS MF8300 Series, reported by Florian Nierhaus. + * backend/pixma.h, doc/descriptions/pixma.desc: Pixma backend version 0.17.18 + 2015-04-12 Stéphane Voltz <stef.dev@free.fr> * doc/sane-genesys.man backend/genesys.[ch] backend/genesys_low.c: fix calibration cleared when calibration file loaded, diff --git a/backend/epson2.c b/backend/epson2.c index b1eda33..63ab045 100644 --- a/backend/epson2.c +++ b/backend/epson2.c @@ -356,10 +356,12 @@ print_params(const SANE_Parameters params) static void close_scanner(Epson_Scanner *s) { + int i; + DBG(7, "%s: fd = %d\n", __func__, s->fd); if (s->fd == -1) - return; + goto free; /* send a request_status. This toggles w_cmd_count and r_cmd_count */ if (r_cmd_count % 2) @@ -381,6 +383,14 @@ close_scanner(Epson_Scanner *s) } s->fd = -1; + +free: + for (i = 0; i < LINES_SHUFFLE_MAX; i++) { + if (s->line_buffer[i] != NULL) + free(s->line_buffer[i]); + } + + free(s); } static void @@ -577,12 +587,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 @@ -604,19 +614,20 @@ 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++; } if (is_valid == SANE_FALSE) { - DBG(1, "the device at %s is not a supported (product id=0x%x)\n", + DBG(1, "the device at %s is not supported (product id=0x%x)\n", s->hw->sane.name, product); return SANE_STATUS_INVAL; } @@ -650,7 +661,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; @@ -703,7 +714,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) @@ -749,7 +760,6 @@ device_detect(const char *name, int type, SANE_Status *status) close: close_scanner(s); - free(s); return NULL; } @@ -762,12 +772,11 @@ 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; close_scanner(s); - free(s); return status; } @@ -814,6 +823,7 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) DBG(7, "%s: len = %d, line = %s\n", __func__, len, line); if (sscanf(line, "usb %i %i", &vendor, &product) == 2) { + /* add the vendor and product IDs to the list of known devices before we call the attach function */ @@ -1456,6 +1466,8 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) DBG(7, "%s: name = %s\n", __func__, name); + *handle = NULL; + /* probe if empty device name provided */ if (l == 0) { @@ -1467,7 +1479,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); @@ -1477,15 +1489,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 { @@ -1498,7 +1510,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; @@ -1513,8 +1525,6 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) init_options(s); - *handle = (SANE_Handle) s; - status = open_scanner(s); if (status != SANE_STATUS_GOOD) { free(s); @@ -1522,16 +1532,19 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) } status = esci_reset(s); - if (status != SANE_STATUS_GOOD) + if (status != SANE_STATUS_GOOD) { close_scanner(s); + return status; + } + + *handle = (SANE_Handle)s; - return status; + return SANE_STATUS_GOOD; } void sane_close(SANE_Handle handle) { - int i; Epson_Scanner *s; DBG(1, "* %s\n", __func__); @@ -1543,15 +1556,7 @@ sane_close(SANE_Handle handle) s = (Epson_Scanner *) handle; - if (s->fd != -1) - close_scanner(s); - - for (i = 0; i < LINES_SHUFFLE_MAX; i++) { - if (s->line_buffer[i] != NULL) - free(s->line_buffer[i]); - } - - free(s); + close_scanner(s); } const SANE_Option_Descriptor * diff --git a/backend/epsonds-cmd.c b/backend/epsonds-cmd.c index 5fb1f9d..ba80c23 100644 --- a/backend/epsonds-cmd.c +++ b/backend/epsonds-cmd.c @@ -607,11 +607,13 @@ static SANE_Status capa_cb(void *userdata, char *token, int len) if (strncmp("ADFDFL1", token, 3 + 4) == 0) { DBG(1, " ADF: double feed detection\n"); + s->hw->adf_has_dfd = 1; } } if (len == 8 && strncmp("ADFDFL1DFL2", token, 3 + 4) == 0) { DBG(1, " ADF: double feed detection (high sensitivity)\n"); + s->hw->adf_has_dfd = 2; } if (strncmp("FMT", token, 3) == 0) { diff --git a/backend/epsonds.c b/backend/epsonds.c index d16744f..8db070b 100644 --- a/backend/epsonds.c +++ b/backend/epsonds.c @@ -133,7 +133,7 @@ close_scanner(epsonds_scanner *s) DBG(7, "%s: fd = %d\n", __func__, s->fd); if (s->fd == -1) - return; + goto free; if (s->locked) { DBG(7, " unlocking scanner\n"); @@ -144,6 +144,8 @@ close_scanner(epsonds_scanner *s) sanei_usb_close(s->fd); } +free: + free(s->front.ring); free(s->back.ring); free(s->line_buffer); @@ -189,57 +191,6 @@ open_scanner(epsonds_scanner *s) return status; } -static SANE_Status -validate_usb(struct epsonds_scanner *s) -{ - DBG(1, "%s\n", __func__); - - SANE_Status status; - int vendor, product; - int i = 0, numIds; - - SANE_Bool is_valid = SANE_FALSE; - - /* if the sanei_usb_get_vendor_product call is not supported, - * then we just ignore this and rely on the user to config - * the correct device. - */ - status = sanei_usb_get_vendor_product(s->fd, &vendor, &product); - if (status != SANE_STATUS_GOOD) { - DBG(1, "the device cannot be verified - will continue\n"); - return SANE_STATUS_GOOD; - } - - /* check the vendor ID to see if we are dealing with an EPSON device */ - if (vendor != SANE_EPSONDS_VENDOR_ID) { - /* this is not a supported vendor ID */ - DBG(1, "not an Epson device at %s (vendor id=0x%x)\n", - s->hw->sane.name, vendor); - return SANE_STATUS_INVAL; - } - - numIds = epsonds_get_number_of_ids(); - - /* check all known product IDs to verify that we know - about the device */ - while (i != numIds && !is_valid) { - if (product == epsonds_usb_product_ids[i]) - is_valid = SANE_TRUE; - i++; - } - - if (is_valid == SANE_FALSE) { - DBG(1, "the device at %s is not a supported (product id=0x%x)\n", - s->hw->sane.name, product); - return SANE_STATUS_INVAL; - } - - DBG(1, "found valid Epson ESC/I-2 scanner: 0x%x/0x%x at %s\n", - vendor, product, s->hw->sane.name); - - return SANE_STATUS_GOOD; -} - static int num_devices; /* number of scanners attached to backend */ static epsonds_device *first_dev; /* first EPSON scanner in list */ @@ -311,13 +262,6 @@ device_detect(const char *name, int type, SANE_Status *status) return NULL; } - if (dev->connection == SANE_EPSONDS_USB) { - *status = validate_usb(s); - } - - if (*status != SANE_STATUS_GOOD) - goto close; - eds_dev_init(dev); /* lock scanner */ @@ -415,19 +359,11 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) 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 */ - DBG(7, " user configured device\n"); - numIds = epsonds_get_number_of_ids(); - if (vendor != 0x4b8) - return SANE_STATUS_INVAL; /* this is not an EPSON device */ + if (vendor != SANE_EPSONDS_VENDOR_ID) + return SANE_STATUS_INVAL; /* this is not an Epson device */ - /* add to last slot */ - epsonds_usb_product_ids[numIds - 1] = product; sanei_usb_attach_matching_devices(line, attach_one_usb); } else if (strncmp(line, "usb", 3) == 0 && len == 3) { @@ -439,9 +375,10 @@ attach_one_config(SANEI_Config __sane_unused__ *config, const char *line) numIds = epsonds_get_number_of_ids(); for (i = 0; i < numIds; i++) { - sanei_usb_find_devices(0x4b8, + sanei_usb_find_devices(SANE_EPSONDS_VENDOR_ID, epsonds_usb_product_ids[i], attach_one_usb); } + } else { DBG(0, "unable to parse config line: %s\n", line); } @@ -709,12 +646,10 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) SANE_Status status; epsonds_scanner *s = NULL; - int l = strlen(name); - - DBG(7, "** %s: name = %s\n", __func__, name); + DBG(7, "** %s: name = '%s'\n", __func__, name); /* probe if empty device name provided */ - if (l == 0) { + if (name[0] == '\0') { probe_devices(); @@ -738,20 +673,8 @@ sane_open(SANE_String_Const name, SANE_Handle *handle) if (s == NULL) return status; } else { - - /* as a last resort, check for a match - * in the device list. This should handle SCSI - * devices and platforms without libusb. - */ - - if (first_dev == NULL) - probe_devices(); - - s = device_detect(name, SANE_EPSONDS_NODEV, &status); - if (s == NULL) { - DBG(1, "invalid device name: %s\n", name); - return SANE_STATUS_INVAL; - } + DBG(1, "invalid device name: %s\n", name); + return SANE_STATUS_INVAL; } } @@ -1189,6 +1112,12 @@ sane_start(SANE_Handle handle) s->val[OPT_ADF_MODE].w ? "DPLX" : "", s->val[OPT_ADF_SKEW].w ? "SKEW" : ""); + if (s->hw->adf_has_dfd == 2) { + strcat(buf, "DFL2"); + } else if (s->hw->adf_has_dfd == 1) { + strcat(buf, "DFL1"); + } + } else if (strcmp(source_list[s->val[OPT_SOURCE].w], FBF_STR) == 0) { strcpy(buf, "#FB "); diff --git a/backend/epsonds.h b/backend/epsonds.h index 2c2e422..024773b 100644 --- a/backend/epsonds.h +++ b/backend/epsonds.h @@ -138,6 +138,7 @@ struct epsonds_device SANE_Bool adf_has_load; /* supports load command */ SANE_Bool adf_has_eject; /* supports eject command */ SANE_Byte adf_alignment; /* left, center, right */ + SANE_Byte adf_has_dfd; /* supports double feed detection */ SANE_Bool has_tpu; /* tpu */ SANE_Range tpu_x_range; /* transparency unit x range */ diff --git a/backend/pixma.h b/backend/pixma.h index eedf74d..4be43bd 100644 --- a/backend/pixma.h +++ b/backend/pixma.h @@ -114,7 +114,7 @@ typedef uint32_t uint32_t; /**@{*/ #define PIXMA_VERSION_MAJOR 0 #define PIXMA_VERSION_MINOR 17 -#define PIXMA_VERSION_BUILD 17 +#define PIXMA_VERSION_BUILD 18 /**@}*/ /** \name Error codes */ diff --git a/backend/pixma_imageclass.c b/backend/pixma_imageclass.c index 3995805..f4bad37 100644 --- a/backend/pixma_imageclass.c +++ b/backend/pixma_imageclass.c @@ -80,6 +80,7 @@ #define MF3200_PID 0x2684 #define MF6500_PID 0x2686 /* generation 2 scanners (>=0x2707) */ +#define MF8300_PID 0x2708 #define MF4500_PID 0x2736 #define MF4410_PID 0x2737 #define MF3010_PID 0x2759 @@ -208,6 +209,7 @@ activate (pixma_t * s, uint8_t x) case D420_PID: case MF4360_PID: case MF4100_PID: + case MF8300_PID: return iclass_exec (s, &mf->cb, 1); break; default: @@ -239,6 +241,7 @@ select_source (pixma_t * s) case D420_PID: case MF4360_PID: case MF4100_PID: + case MF8300_PID: return iclass_exec (s, &mf->cb, 0); break; default: @@ -273,6 +276,7 @@ send_scan_param (pixma_t * s) case D420_PID: case MF4360_PID: case MF4100_PID: + case MF8300_PID: return iclass_exec (s, &mf->cb, 0); break; default: @@ -369,6 +373,7 @@ read_error_info (pixma_t * s, void *buf, unsigned size) case D420_PID: case MF4360_PID: case MF4100_PID: + case MF8300_PID: error = iclass_exec (s, &mf->cb, 0); break; default: @@ -795,6 +800,7 @@ const pixma_config_t pixma_iclass_devices[] = { DEV ("Canon i-SENSYS MF4800 Series", "MF4800", MF4800_PID, 600, 0, 640, 1050, PIXMA_CAP_ADF), DEV ("Canon imageCLASS MF4570dw", "MF4570dw", MF4570_PID, 600, 0, 640, 877, 0), DEV ("Canon i-SENSYS MF8200C Series", "MF8200C", MF8200_PID, 600, 300, 640, 1050, PIXMA_CAP_ADF), + DEV ("Canon i-SENSYS MF8300 Series", "MF8300", MF8300_PID, 600, 0, 640, 1050, PIXMA_CAP_ADF), DEV ("Canon imageCLASS D530", "D530", D530_PID, 600, 0, 640, 877, 0), /* FIXME: the following capabilities all need updating/verifying */ DEV ("Canon imageCLASS MF5630", "MF5630", MF5630_PID, 600, 0, 640, 877, PIXMA_CAP_ADF), diff --git a/doc/descriptions/pixma.desc b/doc/descriptions/pixma.desc index 51c3bec..d34859a 100644 --- a/doc/descriptions/pixma.desc +++ b/doc/descriptions/pixma.desc @@ -11,7 +11,7 @@ ; See doc/descriptions.txt for details. :backend "pixma" ; name of backend -:version "0.17.17" ; version of backend (or "unmaintained") +:version "0.17.18" ; version of backend (or "unmaintained") :manpage "sane-pixma" ; name of manpage (if it exists) ;:comment "Devices marked as experimantal are disabled by default. See the manual page for how to enable them." @@ -989,6 +989,12 @@ :status :complete :comment "Flatbed and ADF scan. All resolutions supported (up to 600DPI). Note: document feeder does not have 600DPI capability." +:model "i-SENSYS MF8300 Series" +:interface "USB Ethernet" +:usbid "0x04a9" "0x2708" +:status :complete +:comment "Flatbed and ADF scan. All resolutions supported (up to 600DPI)." + :model "i-SENSYS MF8500C Series" :interface "USB Ethernet" :usbid "0x04a9" "0x277a" diff --git a/doc/sane-pixma.man b/doc/sane-pixma.man index c72cbda..ac1627e 100644 --- a/doc/sane-pixma.man +++ b/doc/sane-pixma.man @@ -1,4 +1,4 @@ -.TH "sane\-pixma" "5" "03 Apr 2015" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" +.TH "sane\-pixma" "5" "18 Mai 2015" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" .IX sane\-pixma .SH NAME sane\-pixma \- SANE backend for Canon Multi-Function Printers and CanoScan Scanners @@ -59,6 +59,8 @@ i-SENSYS MF3010, MF4320d, MF4330d, MF4500 Series .br i-SENSYS MF4700 Series, MF4800 Series, MF8200C Series .br +i-SENSYS MF8300 Series +.br imageRUNNER 1020/1024/1025 .br CanoScan 8800F, 9000F, 9000F Mark II |