diff options
Diffstat (limited to 'backend/pixma/pixma_common.c')
-rw-r--r-- | backend/pixma/pixma_common.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/backend/pixma/pixma_common.c b/backend/pixma/pixma_common.c index 436311a..6bce4bc 100644 --- a/backend/pixma/pixma_common.c +++ b/backend/pixma/pixma_common.c @@ -17,9 +17,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + along with this program. If not, see <https://www.gnu.org/licenses/>. As a special exception, the authors of SANE give permission for additional uses of the libraries contained in this release of SANE. @@ -56,8 +54,6 @@ #if defined(HAVE_LIBXML2) # include <libxml/parser.h> -#else -# error "The pixma backend requires libxml2" #endif #include "pixma_rename.h" @@ -682,7 +678,7 @@ pixma_cmd_transaction (pixma_t * s, const void *cmd, unsigned cmdlen, going back to the home position after the last scan session has been cancelled, you won't get the response before it arrives home. This takes about 5 seconds. If the last session was succeeded, the scanner will - immediatly answer with PIXMA_STATUS_BUSY. + immediately answer with PIXMA_STATUS_BUSY. Is 8 seconds timeout enough? This affects ALL commands that use pixma_cmd_transaction(). Default value set in pixma_open(). */ @@ -814,6 +810,7 @@ pixma_open (unsigned devnr, pixma_t ** handle) strncpy (s->id, pixma_get_device_id (devnr), sizeof (s->id) - 1); s->ops = s->cfg->ops; s->scanning = 0; + s->last_source = PIXMA_SOURCE_NONE; error = s->ops->open (s); if (error < 0) goto rollback; @@ -967,6 +964,8 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len) if (result == 0) { /* end of image? */ s->ops->finish_scan (s); + /* set last source after successful scan */ + s->last_source = s->param->source; if ((s->cur_image_size != s->param->image_size) && !s->param->mode_jpeg) { pixma_dbg (1, "WARNING:image size mismatches\n"); @@ -1140,6 +1139,9 @@ pixma_check_scan_param (pixma_t * s, pixma_scan_param_t * sp) sp->source)); } break; + case PIXMA_SOURCE_NONE: + /* this source can not be selected */ + break; } if (sp->depth == 0) @@ -1241,6 +1243,22 @@ pixma_get_device_status (pixma_t * s, pixma_device_status_t * status) return s->ops->get_status (s, status); } +unsigned +pixma_calc_calibrate (pixma_t * p) +{ + pixma_scan_param_t * sp = p->param; + if (sp->calibrate == PIXMA_CALIBRATE_ALWAYS) + return 0x01; + if (sp->calibrate == PIXMA_CALIBRATE_NEVER) + return 0x00; + /* sp->calibrate == PIXMA_CALIBRATE_ONCE */ + if (sp->source == PIXMA_SOURCE_ADF || sp->source == PIXMA_SOURCE_ADFDUP) + return sp->adf_pageid == 0 ? 0x01 : 0x00; + /* sp->source == PIXMA_SOURCE_FLATBED | TPU */ + return sp->source == p->last_source ? 0x00 : 0x01; +} + +#if defined(HAVE_LIBXML2) static const char * format_xml_response(const char *resp_details) { @@ -1334,3 +1352,4 @@ clean: xmlFreeDoc(doc); return status; } +#endif |