diff -Naur sane-backends-1.0.15.orig/AUTHORS sane-backends-1.0.15/AUTHORS --- sane-backends-1.0.15.orig/AUTHORS 2004-10-12 09:45:48.000000000 +0000 +++ sane-backends-1.0.15/AUTHORS 2005-04-04 00:42:54.000000000 +0000 @@ -31,6 +31,7 @@ epson: Karl Heinz Kremer (*) fujitsu: Randolph Bentson, Frederik Ramm, Oliver Schirrmeister (*), m. allan noah (*) + geniusvp2: Anderson Lizardo gphoto2: Peter Fales (*) gt68xx: Sergey Vlasov, Andreas Nowack, David Stevenson, and Henning Meier-Geinitz (*) @@ -112,6 +113,7 @@ Email addresses: Abel Deuring <a.deuring@satzbau-gmbh.de> +Anderson Lizardo <lizardo@users.sourceforge.net> Andras Major <andras@users.sourceforge.net> Andreas Beck <becka@uni-duesseldorf.de> Andreas Bolsch <ab@maths.nott.ac.uk> diff -Naur sane-backends-1.0.15.orig/backend/Makefile.in sane-backends-1.0.15/backend/Makefile.in --- sane-backends-1.0.15.orig/backend/Makefile.in 2004-10-10 12:43:42.000000000 +0000 +++ sane-backends-1.0.15/backend/Makefile.in 2005-04-04 00:42:54.000000000 +0000 @@ -93,6 +93,11 @@ epson.c epson_scsi.c epson_usb.c epson.conf epson.h epson_scsi.h \ epson_usb.h \ fujitsu.c fujitsu.conf fujitsu.h fujitsu-scsi.h \ + geniusvp2-adc.c geniusvp2-adc.h geniusvp2-asic.c geniusvp2-asic.h \ + geniusvp2-image.c geniusvp2-image.h geniusvp2-misc.c geniusvp2-misc.h \ + geniusvp2-parport.c geniusvp2-parport.h geniusvp2-registers.h \ + geniusvp2-switcher.c geniusvp2-switcher.h \ + geniusvp2.c geniusvp2.conf geniusvp2.h \ gphoto2.c gphoto2.conf gphoto2.h \ gt68xx.c gt68xx.h gt68xx_high.c gt68xx_high.h gt68xx_mid.c gt68xx_mid.h \ gt68xx_gt6801.c gt68xx_gt6801.h gt68xx_gt6816.c gt68xx_gt6816.h \ @@ -252,6 +257,8 @@ # additional dependencies EXTRA_canon_pp = canon_pp-io canon_pp-dev +EXTRA_geniusvp2 = geniusvp2-adc geniusvp2-asic geniusvp2-image geniusvp2-misc \ + geniusvp2-parport geniusvp2-switcher EXTRA_hp = hp-accessor hp-device hp-handle hp-hpmem hp-option hp-scl EXTRA_umax_pp = umax_pp_low umax_pp_mid EXTRA_epson = epson_scsi epson_usb @@ -320,6 +327,9 @@ libsane-fujitsu.la: ../sanei/sanei_scsi.lo libsane-fujitsu.la: ../sanei/sanei_usb.lo libsane-fujitsu.la: ../sanei/sanei_thread.lo +libsane-geniusvp2.la: $(addsuffix .lo,$(EXTRA_geniusvp2)) +libsane-geniusvp2.la: ../sanei/sanei_constrain_value.lo +libsane-geniusvp2.la: ../sanei/sanei_thread.lo libsane-gphoto2.la: ../sanei/sanei_constrain_value.lo ../sanei/sanei_jpeg.lo libsane-gt68xx.la: ../sanei/sanei_constrain_value.lo libsane-gt68xx.la: ../sanei/sanei_usb.lo diff -Naur sane-backends-1.0.15.orig/backend/dll.conf sane-backends-1.0.15/backend/dll.conf --- sane-backends-1.0.15.orig/backend/dll.conf 2004-08-03 16:22:25.000000000 +0000 +++ sane-backends-1.0.15/backend/dll.conf 2005-04-04 00:42:54.000000000 +0000 @@ -19,6 +19,7 @@ dmc epson fujitsu +geniusvp2 #gphoto2 gt68xx hp diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-adc.c sane-backends-1.0.15/backend/geniusvp2-adc.c --- sane-backends-1.0.15.orig/backend/geniusvp2-adc.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-adc.c 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,218 @@ +/* adc.c - WM8143-12 ADC I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +#include "geniusvp2-adc.h" +#include "geniusvp2-asic.h" +#include "geniusvp2-misc.h" + +#define DARK_REF_LINES 5 + +/* + * Write data to the specified ADC register + */ +static void +adc_write (unsigned char reg, unsigned char data) +{ + int bit; + + reg13.w = 0x80; + sane_geniusvp2_reg_write (13, reg13.w); + + for (bit = 5; bit >= 0; bit--) + { + if (reg & (1 << bit)) + reg13.r.SDO = 1; + else + reg13.r.SDO = 0; + sane_geniusvp2_reg_write (13, reg13.w); + reg13.r.SCLK = 1; + sane_geniusvp2_reg_write (13, reg13.w); + reg13.r.SCLK = 0; + sane_geniusvp2_reg_write (13, reg13.w); + } + for (bit = 7; bit >= 0; bit--) + { + if (data & (1 << bit)) + reg13.r.SDO = 1; + else + reg13.r.SDO = 0; + sane_geniusvp2_reg_write (13, reg13.w); + reg13.r.SCLK = 1; + sane_geniusvp2_reg_write (13, reg13.w); + reg13.r.SCLK = 0; + sane_geniusvp2_reg_write (13, reg13.w); + } + reg13.r.SEN = 1; + sane_geniusvp2_reg_write (13, reg13.w); + reg13.r.SDO = 0; + reg13.r.SEN = 0; + sane_geniusvp2_reg_write (13, reg13.w); +} + +/* + * Set offset value + * xoff = -255 .. +255 + */ +static void +set_adc_offset (int roff, int goff, int boff) +{ + /* Set DAC Signs register */ + if (roff < 0) + adc_write (0x24, 1); + else + adc_write (0x24, 0); + if (goff < 0) + adc_write (0x25, 1); + else + adc_write (0x25, 0); + if (boff < 0) + adc_write (0x26, 1); + else + adc_write (0x26, 0); + + if (roff < 0) + roff = -roff; + if (goff < 0) + goff = -goff; + if (boff < 0) + boff = -boff; + + /* Set DAC Values register */ + adc_write (0x20, roff & 0xff); + adc_write (0x21, goff & 0xff); + adc_write (0x22, boff & 0xff); + + sane_geniusvp2_reg_write (13, 0x20); +} + +/* + * Set Programmable Gain Amplifier + */ +void +sane_geniusvp2_set_adc_gain (int rgain, int ggain, int bgain) +{ + adc_write (0x28, rgain & 0x1f); + adc_write (0x29, ggain & 0x1f); + adc_write (0x2a, bgain & 0x1f); + sane_geniusvp2_reg_write (13, 0x20); +} + +/* + * Initialize ADC + */ +void +sane_geniusvp2_init_adc (void) +{ + sane_geniusvp2_reg_write (5, 0x90); + sane_geniusvp2_reg_write (25, 0x0f); + + /* Clear panel button */ + sane_geniusvp2_reg_read (12, ®12.w); + reg12.r.KeyButton = 0; + sane_geniusvp2_reg_write (12, reg12.w); + + adc_write (0x01, 0x03); + adc_write (0x02, 0x04); + adc_write (0x03, 0x22); + adc_write (0x05, 0x10); + set_adc_offset (190, 190, 190); + sane_geniusvp2_set_adc_gain (2, 2, 2); +} + +/* + * Adjust offset to get a reading in the range 1 to 10 + */ +void +sane_geniusvp2_adjust_offset (void) +{ + int offsetr = 0; + int offsetg = 0; + int offsetb = 0; + int mask, rtmp, gtmp, btmp; + + set_adc_offset (offsetr, offsetg, offsetb); + + for (mask = 0x80; mask != 0x00; mask = mask >> 1) + { + sane_geniusvp2_get_avg_reading (&rtmp, >mp, &btmp); + + if (rtmp < 1) + offsetr = offsetr - mask; + else if (rtmp > 10) + offsetr = offsetr + mask; + + if (gtmp < 1) + offsetg = offsetg - mask; + else if (gtmp > 10) + offsetg = offsetg + mask; + + if (btmp < 1) + offsetb = offsetb - mask; + else if (btmp > 10) + offsetb = offsetb + mask; + + set_adc_offset (offsetr, offsetg, offsetb); + } +} + +/* + * Get an average color reading + */ +void +sane_geniusvp2_get_avg_reading (int *red, int *green, int *blue) +{ + int i, j; + ScanArea area; + + area.top = 0; + area.left = 6; + area.height = DARK_REF_LINES; + area.width = 7; + + /*sane_geniusvp2_lamp_off (); */ + + sane_geniusvp2_set_scan_area (area); + sane_geniusvp2_set_scan_params (600); + sane_geniusvp2_reset_fifo (); + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_set_operation_mode (mScanMotorOff); + + /* Read ADC to get average values */ + *red = *green = *blue = 0; + for (i = 0; i < DARK_REF_LINES; i++) + { + sane_geniusvp2_wait_fifo (area.width); + for (j = 0; j < area.width; j++) + { + sane_geniusvp2_reg_read (17, ®17.w); + *red += reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + *green += reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + *blue += reg17.w; + } + } + *red /= (area.width * DARK_REF_LINES); + *green /= (area.width * DARK_REF_LINES); + *blue /= (area.width * DARK_REF_LINES); + + sane_geniusvp2_set_operation_mode (mStop); + + /*sane_geniusvp2_lamp_on (); */ +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-adc.h sane-backends-1.0.15/backend/geniusvp2-adc.h --- sane-backends-1.0.15.orig/backend/geniusvp2-adc.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-adc.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,23 @@ +/* adc.h - WM8143-12 ADC I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +extern void sane_geniusvp2_set_adc_gain (int rgain, int ggain, int bgain); +extern void sane_geniusvp2_init_adc (void); +extern void sane_geniusvp2_adjust_offset (void); +extern void sane_geniusvp2_get_avg_reading (int *red, int *green, int *blue); diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-asic.c sane-backends-1.0.15/backend/geniusvp2-asic.c --- sane-backends-1.0.15.orig/backend/geniusvp2-asic.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-asic.c 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,88 @@ +/* asic.c - ASIC registers I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +#include <linux/parport.h> + +#include "geniusvp2-asic.h" +#include "geniusvp2-parport.h" + +int +sane_geniusvp2_reg_read (unsigned char reg, unsigned char *data) +{ + return sane_geniusvp2_reg_read_buf (reg, data, 1); +} + +int +sane_geniusvp2_reg_read_buf (unsigned char reg, unsigned char *data, size_t size) +{ + sane_geniusvp2_epp_set_mode (IEEE1284_ADDR); + sane_geniusvp2_epp_write (®, 1); + sane_geniusvp2_epp_set_mode (IEEE1284_DATA); + return sane_geniusvp2_epp_read (data, size); +} + +int +sane_geniusvp2_reg_write (unsigned char reg, unsigned char data) +{ + return sane_geniusvp2_reg_write_buf (reg, &data, 1); +} + +int +sane_geniusvp2_reg_write_buf (unsigned char reg, unsigned char *data, size_t size) +{ + sane_geniusvp2_epp_set_mode (IEEE1284_ADDR); + sane_geniusvp2_epp_write (®, 1); + sane_geniusvp2_epp_set_mode (IEEE1284_DATA); + return sane_geniusvp2_epp_write (data, size); +} + +void +sane_geniusvp2_init_regs (void) +{ + reg0.w = 0xe1; + reg1.w = 0x5a; + reg2.w = 0x00; + reg3.w = 0x0f; + reg4.w = 0x32; + reg5.w = 0x00; + reg6.w = 0x94; + reg7.w = 0x09; + reg8.w = 0xc4; + reg9.w = 0x0a; + reg10.w = 0x17; + reg11.w = 0x70; + reg12.w = 0x44; + reg13.w = 0x91; + reg14.w = 0x07; + reg15.w = 0xff; + reg16.w = 0xff; + reg17.w = 0x00; + reg18.w = 0x00; + reg19.w = 0x00; + reg20.w = 0x00; + reg21.w = 0x00; + reg22.w = 0x13; + reg23.w = 0xec; + reg24.w = 0x86; + reg25.w = 0xf0; + reg26.w = 0x18; + reg27.w = 0x22; + reg28.w = 0x58; + reg29.w = 0x58; +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-asic.h sane-backends-1.0.15/backend/geniusvp2-asic.h --- sane-backends-1.0.15.orig/backend/geniusvp2-asic.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-asic.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,29 @@ +/* asic.h - ASIC registers I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +#include <unistd.h> + +#include "geniusvp2-registers.h" + +extern int sane_geniusvp2_reg_read (unsigned char reg, unsigned char *data); +extern int sane_geniusvp2_reg_read_buf (unsigned char reg, unsigned char *data, size_t size); +extern int sane_geniusvp2_reg_write (unsigned char reg, unsigned char data); +extern int sane_geniusvp2_reg_write_buf (unsigned char reg, unsigned char *data, + size_t size); +extern void sane_geniusvp2_init_regs (void); diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-image.c sane-backends-1.0.15/backend/geniusvp2-image.c --- sane-backends-1.0.15.orig/backend/geniusvp2-image.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-image.c 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,361 @@ +/* image.c - Calibration and image handling functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +/* Disabled by now, until code gets fixed */ +#if 0 +#include <stdlib.h> +#include <math.h> + +#include "geniusvp2-adc.h" +#include "geniusvp2-asic.h" +#include "geniusvp2-image.h" +#include "geniusvp2-misc.h" + +const int color_table_size = 4096; + +int redmax, greenmax, bluemax, redmin, greenmin, bluemin; + +/* + * Calculate the color matrix + */ +void +calc_color_table (scan_image * image) +{ + int i; + double midin, val, m, b; + int maxin = color_table_size - 1; + int maxout = 255; + + /* do the gamma correction observing the actual range of input data */ + + midin = (double) (redmin + redmax) / 2.0; + b = (1.0 + image->color[0].brightness / 100.0) * midin; + m = 1.0 + image->color[0].contrast / 100.0; + for (i = 0; i <= maxin; i++) + { + val = ((double) i - midin) * m + b; + if ((int) val < redmin) + image->color_table[0][i] = 0; + else + { + if ((int) val > redmax) + image->color_table[0][i] = 255; + else + { + image->color_table[0][i] = + maxout * pow ((val - (double) redmin) / + (double) (redmax - redmin), + (1.0 / image->color[0].gamma)); + } + } + } + + midin = (double) (greenmin + greenmax) / 2.0; + b = (1.0 + image->color[1].brightness / 100.0) * midin; + m = 1.0 + image->color[1].contrast / 100.0; + for (i = 0; i <= maxin; i++) + { + val = ((double) i - midin) * m + b; + if ((int) val < greenmin) + image->color_table[1][i] = 0; + else + { + if ((int) val > greenmax) + image->color_table[1][i] = 255; + else + { + image->color_table[1][i] = + maxout * pow ((val - (double) greenmin) / + (double) (greenmax - greenmin), + (1.0 / image->color[1].gamma)); + } + } + } + + midin = (double) (bluemin + bluemax) / 2.0; + b = (1.0 + image->color[2].brightness / 100.0) * midin; + m = 1.0 + image->color[2].contrast / 100.0; + for (i = 0; i <= maxin; i++) + { + val = ((double) i - midin) * m + b; + if ((int) val < bluemin) + image->color_table[2][i] = 0; + else + { + if ((int) val > bluemax) + image->color_table[2][i] = 255; + else + { + image->color_table[2][i] = + maxout * pow ((val - (double) bluemin) / + (double) (bluemax - bluemin), + (1.0 / image->color[2].gamma)); + } + } + } + + DBG (2, "min = %i %i %i max = %i %i %i \n", redmin, greenmin, + bluemin, redmax, greenmax, bluemax); +} + +void +init_image (scan_image ** image) +{ + int i; + + *image = malloc (sizeof (scan_image)); + + (*image)->width = 100; + (*image)->height = 100; + (*image)->resolution = 100; + (*image)->from_top = 0; + (*image)->from_left = 0; + (*image)->num_colors = 3; + + for (i = 0; i < 3; i++) + { + ((*image)->color)[i].gamma = 1.0; + ((*image)->color)[i].contrast = 0; + ((*image)->color)[i].brightness = 0; + (*image)->color_table[i] = malloc (color_table_size); + } + + (*image)->filename = malloc (100); + (*image)->filename = "test.tiff"; +} + +/* FIXME: Calibration code is broken */ +void +calibrate (scan_image * image) +{ + int i, j; + int *whiteline, redlow, greenlow, bluelow; + ScanArea area; + + /* Adjust offsets */ + sane_geniusvp2_adjust_offset (); + + area.top = 0; + area.left = 0; + area.height = 200; + area.width = 800; + + sane_geniusvp2_set_scan_area (area); + sane_geniusvp2_set_scan_params (200); + sane_geniusvp2_reset_fifo (); + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_set_operation_mode (mScan); + + /* + * here we are to find out the location of the calibration area and hence the window + */ + { + int k, w, ystart; + + ystart = 0; + for (j = 0; j < 50; j++) + { + sane_geniusvp2_wait_fifo (200); + for (k = 0; k < 200; k++) + sane_geniusvp2_reg_read (17, ®17.w); /* skip over the x-calibration strip */ + + w = 0; + for (i = 0; i < 3; i++) + { + sane_geniusvp2_wait_fifo (200); + for (k = 0; k < 200; k++) + { + sane_geniusvp2_reg_read (17, ®17.w); + w = w + reg17.w; + } + } + if (ystart == 0 && w > 0x78 * 600) + ystart = j; + } + } + + /*sane_geniusvp2_set_operation_mode (mStop); + ScanSpeed = 7; + sane_geniusvp2_set_scan_speed (ScanSpeed); + + StepTime = max_exposure_time / (ScanSpeed + 1); + if (StepTime < min_exposure_time) + StepTime = min_exposure_time; + sane_geniusvp2_set_step_time (StepTime); + + sane_geniusvp2_set_distance (0x0006); + + sane_geniusvp2_reg_read (6, ®6.w); + reg6.r.MotorPower = 1; + reg6.r.HalfFull = 1; + sane_geniusvp2_reg_write (6, reg6.w); + sane_geniusvp2_set_operation_mode (mBackward); + + sane_geniusvp2_poll_12 (0x08, 0x08); + + if (StepTime >= motor_change) + sane_geniusvp2_reg_write (25, 0x00); + else + sane_geniusvp2_reg_write (25, 0x0f); */ + + sane_geniusvp2_go_home (); + sane_geniusvp2_poll_12 (0x04, 0x04); + + /* Set location of the white area */ + area.top = 236; + sane_geniusvp2_move_carriage_forward (area.top); + area.left = 131; + area.height = 10; + area.width = 8.5 * 600; + + sane_geniusvp2_set_scan_area (area); + sane_geniusvp2_set_scan_params (600); + sane_geniusvp2_reset_fifo (); + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_set_operation_mode (mScan); + + /* Find max reading for each color */ + { + float redgain, greengain, bluegain; + + redgain = greengain = bluegain = 0.0; + for (j = 0; j < area.height; j++) + { + sane_geniusvp2_wait_fifo (area.width); + for (i = 0; i < area.width; i++) + { + sane_geniusvp2_reg_read (17, ®17.w); + if (reg17.w > redgain) + redgain = reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + if (reg17.w > greengain) + greengain = reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + if (reg17.w > bluegain) + bluegain = reg17.w; + } + } + /* Convert color gains to ADC register codes */ + redgain = ((210 / redgain) - 0.5) / 0.25; + greengain = ((225 / greengain) - 0.5) / 0.25; + bluegain = ((225 / bluegain) - 0.5) / 0.25; + + /* From the read above we can set max gain for each color */ + sane_geniusvp2_set_adc_gain (redgain, greengain, bluegain); + } + /* Try out a new set of offsets for the current gain settings */ + sane_geniusvp2_adjust_offset (); + + /* Do an extra read to see the final result */ + sane_geniusvp2_get_avg_reading (&redmin, &greenmin, &bluemin); + + area.top = 0; + area.left = 131; + area.height = 40; + area.width = 8.5 * 600; + sane_geniusvp2_set_scan_area (area); + sane_geniusvp2_set_scan_params (600); + sane_geniusvp2_reset_fifo (); + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_set_operation_mode (mScan); + + /* Test of calibration */ + whiteline = calloc (5100 * 3, sizeof (int)); + + for (j = 0; j < 10; j++) + { + sane_geniusvp2_wait_fifo (5100); + for (i = 0; i < 5100 * 3; i += 3) + { + sane_geniusvp2_reg_read (17, ®17.w); + whiteline[i] = whiteline[i] + reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + whiteline[i + 1] = whiteline[i + 1] + reg17.w; + sane_geniusvp2_reg_read (17, ®17.w); + whiteline[i + 2] = whiteline[i + 2] + reg17.w; + } + + } + + for (i = 0; i < 5100 * 3; i++) + whiteline[i] = whiteline[i] / 10; + + /* Find the highest reading for each color */ + redlow = greenlow = bluelow = 0; + for (i = 0; i < 5100 * 3; i += 3) + { + if (whiteline[i] > redlow) + redlow = whiteline[i]; + if (whiteline[i + 1] > greenlow) + greenlow = whiteline[i + 1]; + if (whiteline[i + 2] > bluelow) + bluelow = whiteline[i + 2]; + } + + /* Load the x-direction map */ + sane_geniusvp2_set_memory_addr (0x006000); + + redmax = 32 * (redlow - 124); + greenmax = 32 * (greenlow - 124); + bluemax = 32 * (bluelow - 124); + + for (i = 0; i < 132; i++) + sane_geniusvp2_reg_write (17, 0); + for (i = 0; i < 5100; i++) + sane_geniusvp2_reg_write (17, (redlow - whiteline[i * 3]) * 3); + for (i = 0; i < 912; i++) + sane_geniusvp2_reg_write (17, 0); + + for (i = 0; i < 132; i++) + sane_geniusvp2_reg_write (17, 0); + for (i = 0; i < 1916; i++) + sane_geniusvp2_reg_write (17, (redlow - whiteline[i * 3]) * 3); + + for (i = 0; i < 132; i++) + sane_geniusvp2_reg_write (17, 0); + for (i = 0; i < 5100; i++) + sane_geniusvp2_reg_write (17, (greenlow - whiteline[i * 3 + 1]) * 3); + for (i = 0; i < 912; i++) + sane_geniusvp2_reg_write (17, 0); + + for (i = 0; i < 132; i++) + sane_geniusvp2_reg_write (17, 0); + for (i = 0; i < 5100; i++) + sane_geniusvp2_reg_write (17, (bluelow - whiteline[i * 3 + 2]) * 3); + for (i = 0; i < 912; i++) + sane_geniusvp2_reg_write (17, 0); + + free (whiteline); + + sane_geniusvp2_set_memory_addr (0x003000); + for (i = 0; i < 12 * 1024; i += 2) + { + sane_geniusvp2_reg_write (17, 0x80); + sane_geniusvp2_reg_write (17, 0x00); + } + + calc_color_table (image); /* Set up the final color-matrix */ + + /* Send colormap */ + sane_geniusvp2_set_memory_addr (0x000000); + for (i = 0; i < 3; i++) + for (j = 0; j < color_table_size; j++) + sane_geniusvp2_reg_write (17, (char) (image->color_table[i][j])); +} +#endif diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-image.h sane-backends-1.0.15/backend/geniusvp2-image.h --- sane-backends-1.0.15.orig/backend/geniusvp2-image.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-image.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,54 @@ +/* image.h - Image handling functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +/* Disabled by now, until code gets fixed */ +#if 0 +#ifndef _IMAGE_H +#define _IMAGE_H + +typedef struct +{ + double brightness; + double contrast; + double gamma; +} color_setting; + +typedef struct +{ + int width; /* image width (pixels) */ + int height; /* image height (pixels) */ + float from_top; /* distance from top (inch) */ + float from_left; /* distance from left side (inch) */ + int resolution; + int num_colors; /* number of colors */ + color_setting color[3]; /* b/c/g of all colors */ + unsigned char *color_table[3]; + char *filename; +} scan_image; + +extern const int color_table_size; + +extern int redmax, greenmax, bluemax, redmin, greenmin, bluemin; + +extern void calc_color_table (scan_image * image); +extern void calibrate (scan_image * image); +extern void init_image (scan_image ** image); + +#endif /* _IMAGE_H */ +#endif diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-misc.c sane-backends-1.0.15/backend/geniusvp2-misc.c --- sane-backends-1.0.15.orig/backend/geniusvp2-misc.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-misc.c 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,462 @@ +/* misc.c - Various functions that do not have a proper file (yet) + * + * Author: Anderson Lizardo <lizardo@users.sourceforge.net> + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +#include <stdlib.h> +#include <sys/time.h> +#include <unistd.h> + +#include "geniusvp2-adc.h" +#include "geniusvp2-asic.h" +#include "geniusvp2-image.h" +#include "geniusvp2-misc.h" +#include "tiff.h" + +/* Default values from e1.ini */ +const int max_exposure_time = 13800; +const int min_exposure_time = 2200; +const int motor_change = 3000; +const float left_leading = 0.22; +const int back_step = 20; + +const unsigned char ccd_line_offset = 4; + +static void +init_timer (struct timeval *timer, unsigned long sec) +{ + gettimeofday (timer, NULL); + timer->tv_sec += sec; +} + +static int +check_timer (struct timeval *timer) +{ + struct timeval current_time; + + gettimeofday (¤t_time, NULL); + + if (timercmp (¤t_time, timer, >)) + return TIMEOUT; + else + return NO_TIMEOUT; +} + +/* + * Status (reg. 12) polling routine. + * NOTE: Always start with waiting! + */ +void +sane_geniusvp2_poll_12 (unsigned char val, unsigned char mask) +{ + do + { + usleep (5000); + sane_geniusvp2_reg_read (12, ®12.w); + } + while ((reg12.w & mask) != val); +} + +ssize_t +sane_geniusvp2_wait_fifo (size_t count) +{ + size_t fifo_count = 0; + struct timeval timer; + + /* set timeout to 10 sec. */ + init_timer (&timer, 10); + do + { + usleep (5000); + sane_geniusvp2_reg_read (18, ®18.w); + sane_geniusvp2_reg_read (19, ®19.w); + sane_geniusvp2_reg_read (12, ®12.w); + /*fifo_count = (reg18.w << 8) | reg19.w; */ + fifo_count = (reg18.w * 2048 + reg19.w * 8 + 8) * 3; + DBG (1, "sane_geniusvp2_wait_fifo: FIFO = %lu, FinishFlag = %d\n", + (unsigned long) fifo_count, reg12.r.FinishFlag); + if (check_timer (&timer)) + { + DBG (1, "sane_geniusvp2_wait_fifo: TIMEOUT\n"); + return -1; + } + } + while (!((fifo_count > 2 * count) || reg12.r.FinishFlag)); + + if (reg12.r.FinishFlag) + DBG (1, "sane_geniusvp2_wait_fifo: FinishFlag is set\n"); + + return count; +} + +#if 0 +void +get_fifo_count (size_t * count) +{ + do + { + sane_geniusvp2_reg_read (18, ®18.w); + sane_geniusvp2_reg_read (19, ®19.w); + sane_geniusvp2_reg_read (12, ®12.w); + *count = (reg18.w << 8) | reg19.w; + } + while (!(*count /* || reg12.r.FinishFlag */ )); + + DBG (1, "get_fifo_count: FIFO has %lu bytes\n", (unsigned long) *count); + + if (reg12.r.FinishFlag) + { + DBG (1, "get_fifo_count: FinishFlag is set\n"); + *count = 0; + } +} +#endif + +void +sane_geniusvp2_set_operation_mode (operation_mode mode) +{ + sane_geniusvp2_reg_read (6, ®6.w); + if (mode == mScanMotorOff) + reg6.r.Operation = mScan; + else + reg6.r.Operation = mode; + if (mode == mStop || mode == mScanMotorOff) + reg6.r.MotorPower = 0; + else + reg6.r.MotorPower = 1; + sane_geniusvp2_reg_write (6, reg6.w); +} + +void +sane_geniusvp2_reset_fifo (void) +{ + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_reg_read (3, ®3.w); + reg3.r.FiFoReset = 0; + sane_geniusvp2_reg_write (3, reg3.w); + reg3.r.FiFoReset = 1; + sane_geniusvp2_reg_write (3, reg3.w); + + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_reg_read (3, ®3.w); + reg3.r.FiFoReset = 0; + sane_geniusvp2_reg_write (3, reg3.w); + reg3.r.FiFoReset = 1; + sane_geniusvp2_reg_write (3, reg3.w); +} + +void +sane_geniusvp2_set_memory_addr (int addr) +{ + reg14.w = (addr & 0x1f0000) >> 16; + reg15.w = (addr & 0x00ff00) >> 8; + reg16.w = (addr & 0x0000ff); + + sane_geniusvp2_reg_write (14, reg14.w); + sane_geniusvp2_reg_write (15, reg15.w); + sane_geniusvp2_reg_write (16, reg16.w); +} + +static void +sane_geniusvp2_set_line_start (int start) +{ + reg20.w = (start & 0x3f00) >> 8; + reg21.w = (start & 0x00ff); + + sane_geniusvp2_reg_write (20, reg20.w); + sane_geniusvp2_reg_write (21, reg21.w); +} + +static void +sane_geniusvp2_set_line_width (int width) +{ + reg22.w = (width & 0x3f00) >> 8; + reg23.w = (width & 0x00ff); + + sane_geniusvp2_reg_write (22, reg22.w); + sane_geniusvp2_reg_write (23, reg23.w); +} + +/* + * Set the distance of carriage's next movement. + */ +static void +sane_geniusvp2_set_distance (int distance) +{ + reg7.w = (distance & 0xff00) >> 8; + reg8.w = (distance & 0x00ff); + + sane_geniusvp2_reg_write (7, reg7.w); + sane_geniusvp2_reg_write (8, reg8.w); +} + +/* + * Set for how long the carriage stays on each step. + */ +static void +sane_geniusvp2_set_step_time (int time) +{ + reg10.w = (time & 0xff00) >> 8; + reg11.w = (time & 0x00ff); + + sane_geniusvp2_reg_write (10, reg10.w); + sane_geniusvp2_reg_write (11, reg11.w); +} + +static void +sane_geniusvp2_set_scan_speed (int speed) +{ + speed &= 0x07; + sane_geniusvp2_reg_read (3, ®3.w); + reg3.r.ScanSpeed = speed; + sane_geniusvp2_reg_write (3, reg3.w); +} + +/* + * Move carriage forward. + */ +void +sane_geniusvp2_move_carriage_forward (int distance) +{ + int StepTime; + unsigned char ScanSpeed; + + sane_geniusvp2_set_operation_mode (mStop); + ScanSpeed = 7; + sane_geniusvp2_set_scan_speed (ScanSpeed); + + StepTime = max_exposure_time / (ScanSpeed + 1); + if (StepTime < min_exposure_time) + StepTime = min_exposure_time; + sane_geniusvp2_set_step_time (StepTime); + + sane_geniusvp2_set_distance (distance); + + sane_geniusvp2_reg_read (6, ®6.w); + reg6.r.MotorPower = 1; + reg6.r.HalfFull = 1; + sane_geniusvp2_reg_write (6, reg6.w); + sane_geniusvp2_set_operation_mode (mForward); + + sane_geniusvp2_poll_12 (0x08, 0x08); +} + +static void +sane_geniusvp2_set_line_offset (int offset) +{ + sane_geniusvp2_reg_read (6, ®6.w); + sane_geniusvp2_reg_read (4, ®4.w); + + if (offset < 0) + reg4.r.NoLineOffset = 0; + else + reg4.r.NoLineOffset = 1; + reg6.r.LineOffset = offset & 0x07; + + sane_geniusvp2_reg_write (6, reg6.w); + sane_geniusvp2_reg_write (4, reg4.w); +} + +/* + * Set scanning resolution. + */ +static void +sane_geniusvp2_set_resolution (unsigned int res) +{ + sane_geniusvp2_reg_read (3, ®3.w); + sane_geniusvp2_reg_read (27, ®27.w); + sane_geniusvp2_reg_read (28, ®28.w); + sane_geniusvp2_reg_read (29, ®29.w); + + reg27.r.XRes = (res & 0x0700) >> 8; + reg28.r.XRes = (res & 0x00ff); + reg27.r.YRes = ((res * (reg3.r.ScanSpeed + 1)) & 0x0700) >> 8; + reg29.r.YRes = ((res * (reg3.r.ScanSpeed + 1)) & 0x00ff); + + sane_geniusvp2_reg_write (27, reg27.w); + sane_geniusvp2_reg_write (28, reg28.w); + sane_geniusvp2_reg_write (29, reg29.w); +} + +/* + * Return carriage to its home position. + */ +void +sane_geniusvp2_go_home (void) +{ + int ScanSpeed, StepTime; + + sane_geniusvp2_reg_read (12, ®12.w); + if (reg12.r.HomeSensor) + return; + + sane_geniusvp2_set_operation_mode (mStop); + ScanSpeed = 7; + sane_geniusvp2_set_scan_speed (ScanSpeed); + + StepTime = max_exposure_time / (ScanSpeed + 1); + if (StepTime < min_exposure_time) + StepTime = min_exposure_time; + sane_geniusvp2_set_step_time (StepTime); + + sane_geniusvp2_reg_read (6, ®6.w); + reg6.r.MotorPower = 1; + reg6.r.HalfFull = 1; + sane_geniusvp2_reg_write (6, reg6.w); + sane_geniusvp2_set_operation_mode (mAutoHome); +} + +SANE_Bool +sane_geniusvp2_is_lamp_on (void) +{ + sane_geniusvp2_reg_read (12, ®12.w); + return (reg12.r.Lamp ? SANE_TRUE : SANE_FALSE); +} + +SANE_Status +sane_geniusvp2_lamp_on (void) +{ + if (sane_geniusvp2_reg_read (12, ®12.w)) + return SANE_STATUS_IO_ERROR; + reg12.r.Lamp = 1; + if (sane_geniusvp2_reg_write (12, reg12.w)) + return SANE_STATUS_IO_ERROR; + + return SANE_STATUS_GOOD; +} + +SANE_Status +sane_geniusvp2_lamp_off (void) +{ + if (sane_geniusvp2_reg_read (12, ®12.w)) + return SANE_STATUS_IO_ERROR; + reg12.r.Lamp = 0; + if (sane_geniusvp2_reg_write (12, reg12.w)) + return SANE_STATUS_IO_ERROR; + + return SANE_STATUS_GOOD; +} + +int +sane_geniusvp2_read_scan_data (SANE_Byte * data, size_t size) +{ + return sane_geniusvp2_reg_read_buf (17, (unsigned char *) data, size); +} + +void +sane_geniusvp2_set_scan_area (ScanArea area) +{ + sane_geniusvp2_set_line_start (area.left); + sane_geniusvp2_set_line_width (area.width); + sane_geniusvp2_set_distance (area.height); +} + +void +sane_geniusvp2_set_scan_params (int res) +{ + int ScanSpeed, LineOffset, StepTime; + + /* FIXME: This value is not fixed; should be calculated */ + sane_geniusvp2_reg_write (26, 0x09); + + ScanSpeed = (OPT_RESOLUTION / res) - 1; + if (ScanSpeed > 7) + ScanSpeed = 7; + sane_geniusvp2_set_scan_speed (ScanSpeed); + + sane_geniusvp2_set_resolution (res); + + LineOffset = (ccd_line_offset / (ScanSpeed + 1)) - 1; + sane_geniusvp2_set_line_offset (LineOffset); + + StepTime = max_exposure_time / (ScanSpeed + 1); + if (StepTime < min_exposure_time) + StepTime = min_exposure_time; + sane_geniusvp2_set_step_time (StepTime * 2); + + sane_geniusvp2_reg_read (6, ®6.w); + reg6.r.HalfFull = 0; + sane_geniusvp2_reg_write (6, reg6.w); + + /* Set motor back steps */ + sane_geniusvp2_reg_write (9, back_step); + + if (StepTime >= motor_change) + sane_geniusvp2_reg_write (25, 0x00); + else + sane_geniusvp2_reg_write (25, 0x0f); +} + +SANE_Status +sane_geniusvp2_prepare_scan (ScanArea area, int res) +{ + int i, j; + unsigned char *memdata; + + sane_geniusvp2_go_home (); + sane_geniusvp2_poll_12 (0x04, 0x04); + + sane_geniusvp2_reg_write (0x06, 0x80); + sane_geniusvp2_init_adc (); + sane_geniusvp2_reg_write (0x06, 0x80); + + memdata = calloc (20 * 1024, sizeof (unsigned char)); + if (!memdata) + return SANE_STATUS_NO_MEM; + + /* Reset gain table */ + sane_geniusvp2_set_memory_addr (0x006000); + sane_geniusvp2_reg_write_buf (17, memdata, 20 * 1024); + + /* Reset dark table */ + sane_geniusvp2_set_memory_addr (0x003000); + sane_geniusvp2_reg_write_buf (17, memdata, 12 * 1024); + + /* Download linear LUT to scanner */ + sane_geniusvp2_set_memory_addr (0x000000); + for (i = 0; i <= 255; i++) + { + for (j = 0; j < 16; j++) + { + memdata[0 * 4096 + i * 16 + j] = i; + memdata[1 * 4096 + i * 16 + j] = i; + memdata[2 * 4096 + i * 16 + j] = i; + } + } + sane_geniusvp2_reg_write_buf (17, memdata, 12 * 1024); + + free (memdata); + + /* Disabled for now as it's broken */ + /*calibrate (image); */ + + sane_geniusvp2_go_home (); + sane_geniusvp2_poll_12 (0x04, 0x04); + + /* Move to start of scan area (with some offset to skip over calibration + * lines) */ + sane_geniusvp2_move_carriage_forward (area.top); + sane_geniusvp2_set_scan_area (area); + sane_geniusvp2_set_scan_params (res); + sane_geniusvp2_reset_fifo (); + sane_geniusvp2_set_operation_mode (mStop); + sane_geniusvp2_set_operation_mode (mScan); + + return SANE_STATUS_GOOD; +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-misc.h sane-backends-1.0.15/backend/geniusvp2-misc.h --- sane-backends-1.0.15.orig/backend/geniusvp2-misc.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-misc.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,77 @@ +/* misc.h - Various functions that do not have a proper file (yet) + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +#define DEBUG_DECLARE_ONLY +#include "geniusvp2.h" +#include "geniusvp2-image.h" + +#define TIMEOUT 1 +#define NO_TIMEOUT 0 + +#ifndef timercmp +#define timercmp(a, b, CMP) \ +(((a)->tv_sec == (b)->tv_sec) ? \ + ((a)->tv_usec CMP (b)->tv_usec) : \ + ((a)->tv_sec CMP (b)->tv_sec)) +#endif + +/* Optical resolution in dpi's */ +#define OPT_RESOLUTION 600 + +typedef struct +{ + int top, left; /* top-left corner coordinates, in pixels */ + int width, height; /* width and height, in pixels */ +} ScanArea; + +typedef enum +{ + mStop = 0, + mPause = 1, + mForward = 2, + mBackward = 3, + mScan = 4, + mAutoHome = 5, + mScanMotorOff /* mScan with motor power off, not an actual operation mode */ +} operation_mode; + +extern const unsigned char ccd_line_offset; + +/* Default values from e1.ini */ +extern const int max_exposure_time; +extern const int min_exposure_time; +extern const int motor_change; +extern const float left_leading; +extern const int back_step; + +extern void get_fifo_count (size_t * count); +extern void sane_geniusvp2_go_home (void); +extern SANE_Bool sane_geniusvp2_is_lamp_on (void); +extern SANE_Status sane_geniusvp2_lamp_off (void); +extern SANE_Status sane_geniusvp2_lamp_on (void); +extern void sane_geniusvp2_move_carriage_forward (int distance); +extern void sane_geniusvp2_poll_12 (unsigned char val, unsigned char mask); +extern int sane_geniusvp2_read_scan_data (SANE_Byte * data, size_t size); +extern void sane_geniusvp2_reset_fifo (void); +extern SANE_Status sane_geniusvp2_prepare_scan (ScanArea area, int res); +extern void sane_geniusvp2_set_memory_addr (int addr); +extern void sane_geniusvp2_set_operation_mode (operation_mode mode); +extern void sane_geniusvp2_set_scan_area (ScanArea area); +extern void sane_geniusvp2_set_scan_params (int res); +extern ssize_t sane_geniusvp2_wait_fifo (size_t count); diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-parport.c sane-backends-1.0.15/backend/geniusvp2-parport.c --- sane-backends-1.0.15.orig/backend/geniusvp2-parport.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-parport.c 2005-04-04 00:43:19.000000000 +0000 @@ -0,0 +1,201 @@ +/* parport.c - Parallel port I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +#include <errno.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ioctl.h> +#include <unistd.h> + +#define DEBUG_DECLARE_ONLY +#include "geniusvp2.h" +#include "geniusvp2-parport.h" + +static int port_fd; + +int +sane_geniusvp2_parport_open (const char *pp_device) +{ + int retval; + unsigned int port_feature; + + port_fd = open (pp_device, O_RDWR); + if (port_fd == -1) + { + DBG (1, "sane_geniusvp2_parport_open: could not open %s (%s)\n", + pp_device, strerror (errno)); + return 1; + } + retval = ioctl (port_fd, PPCLAIM); + if (retval == -1) + { + DBG (1, "sane_geniusvp2_parport_open: could not claim port access (%s)\n", + strerror (errno)); + retval = close (port_fd); + if (retval == -1) + DBG (1, "sane_geniusvp2_parport_open: could not close port (%s)\n", + strerror (errno)); + return 1; + } + retval = ioctl (port_fd, PPGETMODES, &port_feature); + if (retval == -1) + { + DBG (1, "sane_geniusvp2_parport_open: warning: could not get port capabilities " + "(%s), assuming EPP is present\n", strerror (errno)); + } + else if (!(port_feature & PARPORT_MODE_EPP)) + { + DBG (1, "sane_geniusvp2_parport_open: this port does not support EPP mode, " + "please enable EPP or EPP+ECP mode\n"); + retval = ioctl (port_fd, PPRELEASE); + if (retval == -1) + DBG (1, "sane_geniusvp2_parport_open: could not release port (%s)\n", + strerror (errno)); + retval = close (port_fd); + if (retval == -1) + DBG (1, "sane_geniusvp2_parport_open: could not close port (%s)\n", + strerror (errno)); + return 1; + } + + return 0; +} + +int +sane_geniusvp2_parport_close (void) +{ + int retval; + const int compat = IEEE1284_MODE_COMPAT; + + retval = ioctl (port_fd, PPNEGOT, &compat); + if (retval == -1) + DBG (1, "sane_geniusvp2_parport_close: warning: could not negotiate " + "compatibility mode (%s)\n", strerror (errno)); + retval = ioctl (port_fd, PPRELEASE); + if (retval == -1) + DBG (1, "sane_geniusvp2_parport_close: could not release port (%s)\n", + strerror (errno)); + retval = close (port_fd); + if (retval == -1) + { + DBG (1, "sane_geniusvp2_parport_close: could not close port (%s)\n", + strerror (errno)); + return 1; + } + + return 0; +} + +int +sane_geniusvp2_epp_read (unsigned char *data, int size) +{ + int returned; + + while (size > 0) + { + returned = read (port_fd, data, size); + if (returned < 0) + { + DBG (1, "sane_geniusvp2_epp_read: %s\n", strerror (errno)); + return 1; + } + data += returned; + size -= returned; + } + + return 0; +} + +int +sane_geniusvp2_epp_write (unsigned char *data, int size) +{ + int written; + + while (size > 0) + { + written = write (port_fd, data, size); + if (written < 0) + { + DBG (1, "sane_geniusvp2_epp_write: %s\n", strerror (errno)); + return 1; + } + data += written; + size -= written; + } + + return 0; +} + +int +sane_geniusvp2_epp_set_mode (int mode) +{ + int retval; + + mode |= IEEE1284_MODE_EPP; + retval = ioctl (port_fd, PPSETMODE, &mode); + if (retval == -1) + { + DBG (1, "sane_geniusvp2_epp_set_mode: %s\n", strerror (errno)); + return 1; + } + + return 0; +} + +int +sane_geniusvp2_pp_write (unsigned long int line, unsigned char data) +{ + switch (line) + { + case PP_DATA: + return ioctl (port_fd, PPWDATA, &data); + break; + + case PP_CONTROL: + return ioctl (port_fd, PPWCONTROL, &data); + break; + } + + return 0; +} + +int +sane_geniusvp2_pp_read (unsigned long int line, unsigned char *data) +{ + switch (line) + { + case PP_DATA: + return ioctl (port_fd, PPRDATA, data); + break; + + case PP_STATUS: + return ioctl (port_fd, PPRSTATUS, data); + break; + + case PP_CONTROL: + return ioctl (port_fd, PPRCONTROL, data); + break; + } + + return 0; +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-parport.h sane-backends-1.0.15/backend/geniusvp2-parport.h --- sane-backends-1.0.15.orig/backend/geniusvp2-parport.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-parport.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,29 @@ +/* parport.h - Parallel port I/O functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 +*/ + +enum +{ PP_DATA, PP_STATUS, PP_CONTROL }; + +extern int sane_geniusvp2_parport_open (const char *pp_device); +extern int sane_geniusvp2_parport_close (void); +extern int sane_geniusvp2_epp_read (unsigned char *data, int size); +extern int sane_geniusvp2_epp_write (unsigned char *data, int size); +extern int sane_geniusvp2_epp_set_mode (int mode); +extern int sane_geniusvp2_pp_read (unsigned long int line, unsigned char *data); +extern int sane_geniusvp2_pp_write (unsigned long int line, unsigned char data); diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-registers.h sane-backends-1.0.15/backend/geniusvp2-registers.h --- sane-backends-1.0.15.orig/backend/geniusvp2-registers.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-registers.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,427 @@ +/* registers.h - Register definition for E1 ASIC + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +/* FIXME: This code was initially taken from pxscan-0.41 and is based on the + * E3 ASIC definition. Probably some of the registers below are incorrect for + * E1 or even do not exist on it. + */ + +/* ASIC ID - R */ +struct REG0 +{ + unsigned AsicType:8; +}; + +/* General Register 0 - R/W */ +struct REG1 +{ + unsigned Data:8; +}; + +/* General Register 1 - R/W */ +struct REG2 +{ + unsigned Data:8; +}; + +/* Command Register 0 - R/W */ +struct REG3 +{ + unsigned SysReset:1; + unsigned FiFoReset:1; + unsigned EppUsb:1; + unsigned WatchDog:1; + unsigned SelfTest:1; + unsigned ScanSpeed:3; +}; + +/* Command Register 1 - R/W */ +struct REG4 +{ + unsigned AsicTest:1; + unsigned NoLineOffset:1; + unsigned Refresh:1; + unsigned RefreshForever:1; + unsigned WaitDelay:2; + unsigned ScanMode:2; +}; + +/* Command Register 2 - R/W */ +struct REG5 +{ + unsigned Sensor:2; + unsigned SensorRes:2; /* Sensor Resolution: 0 - 300 dpi; 1 - 600 dpi */ + unsigned Afe:3; + unsigned Adc1210:1; +}; + +/* Motor Control - R/W */ +struct REG6 +{ + unsigned MotorPower:1; + unsigned HalfFull:1; /* 0 - Full Step; 1 - Half Step */ + unsigned Operation:3; + unsigned LineOffset:3; +}; + +/* Motor Move Steps High Byte - R/W */ +struct REG7 +{ + unsigned Data:8; +}; + +/* Motor Move Steps Low Byte - R/W */ +struct REG8 +{ + unsigned Data:8; +}; + +/* Motor Back Steps (Scanning) - R/W */ +struct REG9 +{ + unsigned Data:8; +}; + +/* Motor Trigger Period High Byte (Unit: 0.5 us) - R/W */ +struct REG10 +{ + unsigned Data:8; +}; + +/* Motor Trigger Period Low Byte (Unit: 0.5 us) - R/W */ +struct REG11 +{ + unsigned Data:8; +}; + +/* Sensor Status - R/W */ +struct REG12 +{ + unsigned Lamp:1; + unsigned KeyButton:1; + unsigned HomeSensor:1; + unsigned FinishFlag:1; + unsigned FiFoEmpty:2; + unsigned Reserved:2; +}; + +/* AFE Programming Register - R/W */ +struct REG13 +{ + unsigned SDI:1; + unsigned SDO:1; /* Data to scanner's ADC ( = SDI of SDC ) */ + unsigned SCLK:1; + unsigned SEN:1; + unsigned Reserved:1; + unsigned VSMP:3; /* VSMP = Video SAMPle sync pulse */ +}; + +/* Memory Address Port (MSB) - R/W */ +struct REG14 +{ + unsigned Mem:5; + unsigned Reserved:2; + unsigned Mem_512_2048:1; +}; + +/* Memory Address Port High Byte - R/W */ +struct REG15 +{ + unsigned Data:8; +}; + +/* Memory Address Port Low Byte - R/W */ +struct REG16 +{ + unsigned Data:8; +}; + +/* Memory Data Port - R/W */ +struct REG17 +{ + unsigned Data:8; +}; + +/* Data Size High Byte - R/W */ +struct REG18 +{ + unsigned Data:8; +}; + +/* Data Size Low Byte - R/W */ +struct REG19 +{ + unsigned Data:8; +}; + +/* Scan Area Start Point High Byte - R/W */ +struct REG20 +{ + unsigned AreaStart:6; + unsigned Reserved:2; +}; + +/* Scan Area Start Point Low Byte - R/W */ +struct REG21 +{ + unsigned AreaStart:8; +}; + +/* Scan Area Width High Byte - R/W */ +struct REG22 +{ + unsigned AreaWidth:6; + unsigned Reserved:2; +}; + +/* Scan Area Width Low Byte - R/W */ +struct REG23 +{ + unsigned AreaWidth:8; +}; + +/* General Purpose I/O Register 0 - R */ +struct REG24 +{ + unsigned ProductID:5; + unsigned Gio5:1; + unsigned Gio6:1; + unsigned Reserved:1; +}; + +/* General Purpose I/O Register 1 - R/W */ +struct REG25 +{ + unsigned Gio11:1; + unsigned Gio12:1; + unsigned Gio13:1; + unsigned Gio14:1; + unsigned Gio11ctl:1; + unsigned Gio12ctl:1; + unsigned Gio13ctl:1; + unsigned Gio14ctl:1; +}; + +/* Buffer Bank R/W Difference Motor Start & Stop - R/W */ +struct REG26 +{ + unsigned Stop:4; + unsigned Start:4; +}; + +/* X-Direction & Y-Direction Resolution Control High Byte - R/W */ +struct REG27 +{ + unsigned YRes:3; + unsigned AutoPattern:1; + unsigned XRes:3; + unsigned True16Bit:1; +}; + +/* X-Direction Resolution Control Low Byte - R/W */ +struct REG28 +{ + unsigned XRes:8; +}; + +/* Y-Direction Resolution Control Low Byte - R/W */ +struct REG29 +{ + unsigned YRes:8; +}; + +union +{ + struct REG0 r; + unsigned char w; +} reg0; + +union +{ + struct REG1 r; + unsigned char w; +} reg1; + +union +{ + struct REG2 r; + unsigned char w; +} reg2; + +union +{ + struct REG3 r; + unsigned char w; +} reg3; + +union +{ + struct REG4 r; + unsigned char w; +} reg4; + +union +{ + struct REG5 r; + unsigned char w; +} reg5; + +union +{ + struct REG6 r; + unsigned char w; +} reg6; + +union +{ + struct REG7 r; + unsigned char w; +} reg7; + +union +{ + struct REG8 r; + unsigned char w; +} reg8; + +union +{ + struct REG9 r; + unsigned char w; +} reg9; + +union +{ + struct REG10 r; + unsigned char w; +} reg10; + +union +{ + struct REG11 r; + unsigned char w; +} reg11; + +union +{ + struct REG12 r; + unsigned char w; +} reg12; + +union +{ + struct REG13 r; + unsigned char w; +} reg13; + +union +{ + struct REG14 r; + unsigned char w; +} reg14; + +union +{ + struct REG15 r; + unsigned char w; +} reg15; + +union +{ + struct REG16 r; + unsigned char w; +} reg16; + +union +{ + struct REG17 r; + unsigned char w; +} reg17; + +union +{ + struct REG18 r; + unsigned char w; +} reg18; + +union +{ + struct REG19 r; + unsigned char w; +} reg19; + +union +{ + struct REG20 r; + unsigned char w; +} reg20; + +union +{ + struct REG21 r; + unsigned char w; +} reg21; + +union +{ + struct REG22 r; + unsigned char w; +} reg22; + +union +{ + struct REG23 r; + unsigned char w; +} reg23; + +union +{ + struct REG24 r; + unsigned char w; +} reg24; + +union +{ + struct REG25 r; + unsigned char w; +} reg25; + +union +{ + struct REG26 r; + unsigned char w; +} reg26; + +union +{ + struct REG27 r; + unsigned char w; +} reg27; + +union +{ + struct REG28 r; + unsigned char w; +} reg28; + +union +{ + struct REG29 r; + unsigned char w; +} reg29; diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-switcher.c sane-backends-1.0.15/backend/geniusvp2-switcher.c --- sane-backends-1.0.15.orig/backend/geniusvp2-switcher.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-switcher.c 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,65 @@ +/* switcher.c - on/off switcher functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +#include "geniusvp2-parport.h" +#include "geniusvp2-switcher.h" + +static int +switcher (unsigned char sequence, unsigned char onoff) +{ + int offset, bit; + + sane_geniusvp2_pp_write (PP_CONTROL, 0xc4); + sane_geniusvp2_pp_write (PP_DATA, 0xff); + sane_geniusvp2_pp_write (PP_DATA, 0xfe); + sane_geniusvp2_pp_write (PP_DATA, 0xff); + + for (bit = 7; bit >= 0; bit--) + { + offset = ((sequence >> bit) & 0x01) << 1; + offset |= onoff; + sane_geniusvp2_pp_write (PP_DATA, 0x71 + offset); /* send a double clock pulse */ + sane_geniusvp2_pp_write (PP_DATA, 0xf1 + offset); + sane_geniusvp2_pp_write (PP_DATA, 0x71 + offset); + sane_geniusvp2_pp_write (PP_DATA, 0xf1 + offset); + sane_geniusvp2_pp_write (PP_DATA, 0x71 + offset); + } + + sane_geniusvp2_pp_write (PP_DATA, 0xff); + + if (onoff == 0x04) + { /* scanner is online */ + sane_geniusvp2_pp_write (PP_DATA, 0xfe); /* let the ASIC work */ + sane_geniusvp2_pp_write (PP_DATA, 0xff); + } + + return 0; +} + +int +sane_geniusvp2_scanner_on (void) +{ + return switcher (0xf9, 0x04); +} + +int +sane_geniusvp2_scanner_off (void) +{ + return switcher (0xf0, 0x00); +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2-switcher.h sane-backends-1.0.15/backend/geniusvp2-switcher.h --- sane-backends-1.0.15.orig/backend/geniusvp2-switcher.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2-switcher.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,21 @@ +/* switcher.h - on/off switcher functions + * + * Copyright (C) 2004, 2005 Anderson Lizardo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 + */ + +extern int sane_geniusvp2_scanner_on (void); +extern int sane_geniusvp2_scanner_off (void); diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2.c sane-backends-1.0.15/backend/geniusvp2.c --- sane-backends-1.0.15.orig/backend/geniusvp2.c 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2.c 2005-04-04 01:19:17.000000000 +0000 @@ -0,0 +1,1690 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 2004, 2005 Anderson Lizardo <lizardo@users.sourceforge.net> + + This file is part of the SANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + 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. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. + + SANE backend for the Genius ColorPage-Vivid Pro II scanner. +*/ + +#define BUILD 0 + +#include "../include/sane/config.h" + +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <sys/types.h> +#include <time.h> +#include <unistd.h> +#include <fcntl.h> + +#include "geniusvp2.h" +#include "geniusvp2-asic.h" +#include "geniusvp2-misc.h" +#include "geniusvp2-parport.h" +#include "geniusvp2-switcher.h" + +#include "../include/sane/saneopts.h" +#include "../include/sane/sanei_thread.h" + +#define BACKEND_VERSION "0.2.1" + +#define VP2_CONFIG_FILE "geniusvp2.conf" + +#define VP2_DEFAULT_DEVICE "/dev/parport0" + +static SANE_Bool inited = SANE_FALSE; +static int num_devices = 0; +static SANE_Device **sane_device_list = NULL; +static VP2_Device *first_vp2_device = NULL; + +static SANE_Range x_geometry_range = { + SANE_FIX (0.0), + SANE_FIX (216.0), + SANE_FIX (1.0) +}; + +static SANE_Range y_geometry_range = { + SANE_FIX (0.0), + SANE_FIX (297.0), + SANE_FIX (1.0) +}; + +static SANE_Range resolution_range = { + 75, + 600, + 1 +}; + +static SANE_String_Const mode_list[] = { + SANE_VALUE_SCAN_MODE_COLOR, + 0 +}; + +static SANE_Int depth_list[] = { + 1, 8 +}; + +static void +swap_double (double *a, double *b) +{ + double c; + + c = *a; + *a = *b; + *b = c; + + return; +} + +static size_t +max_string_size (const SANE_String_Const strings[]) +{ + size_t size, max_size = 0; + SANE_Int i; + + for (i = 0; strings[i]; ++i) + { + size = strlen (strings[i]) + 1; + if (size > max_size) + max_size = size; + } + return max_size; +} + +static SANE_Bool +check_handle (SANE_Handle handle) +{ + VP2_Device *vp2_device = first_vp2_device; + + while (vp2_device) + { + if (vp2_device == (VP2_Device *) handle) + return SANE_TRUE; + vp2_device = vp2_device->next; + } + return SANE_FALSE; +} + +static SANE_Status +init_options (VP2_Device * vp2_device) +{ + SANE_Option_Descriptor *od; + + DBG (2, "init_options: vp2_device=%p\n", (void *) vp2_device); + + /* opt_num_opts */ + od = &vp2_device->opt[opt_num_opts]; + od->name = ""; + od->title = SANE_TITLE_NUM_OPTIONS; + od->desc = SANE_DESC_NUM_OPTIONS; + od->type = SANE_TYPE_INT; + od->unit = SANE_UNIT_NONE; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT; + od->constraint_type = SANE_CONSTRAINT_NONE; + od->constraint.range = 0; + vp2_device->val[opt_num_opts].w = num_options; + + /* opt_mode_group */ + od = &vp2_device->opt[opt_mode_group]; + od->name = ""; + od->title = SANE_I18N ("Scan Mode"); + od->desc = ""; + od->type = SANE_TYPE_GROUP; + od->unit = SANE_UNIT_NONE; + od->size = 0; + od->cap = 0; + od->constraint_type = SANE_CONSTRAINT_NONE; + od->constraint.range = 0; + vp2_device->val[opt_mode_group].w = 0; + + /* opt_mode */ + od = &vp2_device->opt[opt_mode]; + od->name = SANE_NAME_SCAN_MODE; + od->title = SANE_TITLE_SCAN_MODE; + od->desc = SANE_DESC_SCAN_MODE; + od->type = SANE_TYPE_STRING; + od->unit = SANE_UNIT_NONE; + od->size = max_string_size (mode_list); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_STRING_LIST; + od->constraint.string_list = mode_list; + vp2_device->val[opt_mode].s = malloc (od->size); + if (!vp2_device->val[opt_mode].s) + return SANE_STATUS_NO_MEM; + strcpy (vp2_device->val[opt_mode].s, "Color"); + + /* opt_depth */ + od = &vp2_device->opt[opt_depth]; + od->name = SANE_NAME_BIT_DEPTH; + od->title = SANE_TITLE_BIT_DEPTH; + od->desc = SANE_DESC_BIT_DEPTH; + od->type = SANE_TYPE_INT; + od->unit = SANE_UNIT_NONE; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_WORD_LIST; + od->constraint.word_list = depth_list; + vp2_device->val[opt_depth].w = 8; + + /* opt_resolution */ + od = &vp2_device->opt[opt_resolution]; + od->name = SANE_NAME_SCAN_RESOLUTION; + od->title = SANE_TITLE_SCAN_RESOLUTION; + od->desc = SANE_DESC_SCAN_RESOLUTION; + od->type = SANE_TYPE_INT; + od->unit = SANE_UNIT_DPI; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_RANGE; + od->constraint.range = &resolution_range; + vp2_device->val[opt_resolution].w = 200; + + /* opt_special_group */ + od = &vp2_device->opt[opt_special_group]; + od->name = ""; + od->title = SANE_I18N ("Special Options"); + od->desc = ""; + od->type = SANE_TYPE_GROUP; + od->unit = SANE_UNIT_NONE; + od->size = 0; + od->cap = 0; + od->constraint_type = SANE_CONSTRAINT_NONE; + od->constraint.range = 0; + vp2_device->val[opt_special_group].w = 0; + + /* opt_print_options */ + od = &vp2_device->opt[opt_print_options]; + od->name = "print-options"; + od->title = SANE_I18N ("Print options"); + od->desc = SANE_I18N ("Print a list of all options."); + od->type = SANE_TYPE_BUTTON; + od->unit = SANE_UNIT_NONE; + od->size = 0; + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_NONE; + od->constraint.string_list = 0; + vp2_device->val[opt_print_options].w = 0; + + /* opt_geometry_group */ + od = &vp2_device->opt[opt_geometry_group]; + od->name = ""; + od->title = SANE_I18N ("Geometry"); + od->desc = ""; + od->type = SANE_TYPE_GROUP; + od->unit = SANE_UNIT_NONE; + od->size = 0; + od->cap = 0; + od->constraint_type = SANE_CONSTRAINT_NONE; + od->constraint.range = 0; + vp2_device->val[opt_geometry_group].w = 0; + + /* opt_tl_x */ + od = &vp2_device->opt[opt_tl_x]; + od->name = SANE_NAME_SCAN_TL_X; + od->title = SANE_TITLE_SCAN_TL_X; + od->desc = SANE_DESC_SCAN_TL_X; + od->type = SANE_TYPE_FIXED; + od->unit = SANE_UNIT_MM; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_RANGE; + od->constraint.range = &x_geometry_range; + vp2_device->val[opt_tl_x].w = SANE_FIX (0.0); + + /* opt_tl_y */ + od = &vp2_device->opt[opt_tl_y]; + od->name = SANE_NAME_SCAN_TL_Y; + od->title = SANE_TITLE_SCAN_TL_Y; + od->desc = SANE_DESC_SCAN_TL_Y; + od->type = SANE_TYPE_FIXED; + od->unit = SANE_UNIT_MM; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_RANGE; + od->constraint.range = &y_geometry_range; + vp2_device->val[opt_tl_y].w = SANE_FIX (0.0); + + /* opt_br_x */ + od = &vp2_device->opt[opt_br_x]; + od->name = SANE_NAME_SCAN_BR_X; + od->title = SANE_TITLE_SCAN_BR_X; + od->desc = SANE_DESC_SCAN_BR_X; + od->type = SANE_TYPE_FIXED; + od->unit = SANE_UNIT_MM; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_RANGE; + od->constraint.range = &x_geometry_range; + vp2_device->val[opt_br_x].w = SANE_FIX (80.0); + + /* opt_br_y */ + od = &vp2_device->opt[opt_br_y]; + od->name = SANE_NAME_SCAN_BR_Y; + od->title = SANE_TITLE_SCAN_BR_Y; + od->desc = SANE_DESC_SCAN_BR_Y; + od->type = SANE_TYPE_FIXED; + od->unit = SANE_UNIT_MM; + od->size = sizeof (SANE_Word); + od->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + od->constraint_type = SANE_CONSTRAINT_RANGE; + od->constraint.range = &y_geometry_range; + vp2_device->val[opt_br_y].w = SANE_FIX (100.0); + + return SANE_STATUS_GOOD; +} + +static SANE_Status +read_option (SANE_String line, SANE_String option_string, + parameter_type p_type, void *value) +{ + SANE_String_Const cp; + SANE_Char *word, *end; + + word = NULL; + + cp = sanei_config_get_string (line, &word); + + if (!word) + return SANE_STATUS_INVAL; + + if (strcmp (word, option_string) != 0) + return SANE_STATUS_INVAL; + + free (word); + word = NULL; + + switch (p_type) + { + case param_none: + return SANE_STATUS_GOOD; + case param_bool: + { + cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; + if (strlen (word) == 0) + { + DBG (3, "read_option: option `%s' requires parameter\n", + option_string); + return SANE_STATUS_INVAL; + } + if (strcmp (word, "true") != 0 && strcmp (word, "false") != 0) + { + DBG (3, "read_option: option `%s' requires parameter " + "`true' or `false'\n", option_string); + return SANE_STATUS_INVAL; + } + else if (strcmp (word, "true") == 0) + *(SANE_Bool *) value = SANE_TRUE; + else + *(SANE_Bool *) value = SANE_FALSE; + DBG (3, "read_option: set option `%s' to %s\n", option_string, + *(SANE_Bool *) value == SANE_TRUE ? "true" : "false"); + break; + } + case param_int: + { + SANE_Int int_value; + + cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; + errno = 0; + int_value = (SANE_Int) strtol (word, &end, 0); + if (end == word) + { + DBG (3, "read_option: option `%s' requires parameter\n", + option_string); + return SANE_STATUS_INVAL; + } + else if (errno) + { + DBG (3, + "read_option: option `%s': can't parse parameter `%s' " + "(%s)\n", option_string, word, strerror (errno)); + return SANE_STATUS_INVAL; + } + else + { + DBG (3, "read_option: set option `%s' to %d\n", + option_string, int_value); + *(SANE_Int *) value = int_value; + } + break; + } + case param_fixed: + { + double double_value; + SANE_Fixed fixed_value; + + cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; + errno = 0; + double_value = strtod (word, &end); + if (end == word) + { + DBG (3, "read_option: option `%s' requires parameter\n", + option_string); + return SANE_STATUS_INVAL; + } + else if (errno) + { + DBG (3, + "read_option: option `%s': can't parse parameter `%s' " + "(%s)\n", option_string, word, strerror (errno)); + return SANE_STATUS_INVAL; + } + else + { + DBG (3, "read_option: set option `%s' to %.0f\n", + option_string, double_value); + fixed_value = SANE_FIX (double_value); + *(SANE_Fixed *) value = fixed_value; + } + break; + } + case param_string: + { + cp = sanei_config_get_string (cp, &word); + if (!word) + return SANE_STATUS_INVAL; + if (strlen (word) == 0) + { + DBG (3, "read_option: option `%s' requires parameter\n", + option_string); + return SANE_STATUS_INVAL; + } + else + { + DBG (3, "read_option: set option `%s' to `%s'\n", + option_string, word); + *(SANE_String *) value = strdup (word); + } + break; + } + default: + DBG (1, "read_option: unknown param_type %d\n", p_type); + return SANE_STATUS_INVAL; + } /* switch */ + + if (word) + free (word); + word = NULL; + return SANE_STATUS_GOOD; +} + +static SANE_Status +reader_process (VP2_Device * vp2_device, SANE_Int fd) +{ + SANE_Word byte_count = 0, bytes_total; + SANE_Byte *buffer = NULL, *buffer_ptr; + ssize_t bytes_written = 0, buffer_size = 0; + size_t write_count = 0; + + DBG (2, "(child) reader_process: vp2_device=%p, fd=%d\n", + (void *) vp2_device, fd); + + bytes_total = vp2_device->lines * vp2_device->bytes_per_line; + + buffer = malloc (vp2_device->bytes_per_line); + if (!buffer) + { + DBG (1, "(child) reader_process: could not malloc buffer\n"); + return SANE_STATUS_NO_MEM; + } + DBG (2, "(child) reader_process: buffer=%p\n", buffer); + + while (byte_count < bytes_total) + { + buffer_size = sane_geniusvp2_wait_fifo (vp2_device->bytes_per_line); + if (buffer_size > 0) + { + if (buffer_size > vp2_device->bytes_per_line) + buffer_size = vp2_device->bytes_per_line; + sane_geniusvp2_read_scan_data (buffer, buffer_size); + } + else if (buffer_size == 0) + { + DBG (1, "(child) reader_process: scanner returned EOF\n"); + /*write (fd, NULL, 0);*/ + close (fd); + break; + } + else + { + DBG (1, "(child) reader_process: scanner timed out\n"); + free (buffer); + close (fd); + return SANE_STATUS_IO_ERROR; + } + + write_count = buffer_size; + if (byte_count + (SANE_Word) write_count > bytes_total) + write_count = bytes_total - byte_count; + + buffer_ptr = buffer; + while (write_count > 0) + { + bytes_written = write (fd, buffer_ptr, write_count); + if (bytes_written < 0) + { + DBG (1, "(child) reader_process: write returned %s\n", + strerror (errno)); + return SANE_STATUS_IO_ERROR; + } + byte_count += bytes_written; + DBG (4, + "(child) reader_process: wrote %ld bytes of %lu (%d total)\n", + (long) bytes_written, (u_long) write_count, byte_count); + buffer_ptr += bytes_written; + write_count -= bytes_written; + } + } + + free (buffer); + + if (sanei_thread_is_forked ()) + { + DBG (4, + "(child) reader_process: finished, wrote %d bytes, expected %d " + "bytes, now waiting\n", byte_count, bytes_total); + while (SANE_TRUE) + sleep (10); + DBG (4, "(child) reader_process: this should have never happened..."); + close (fd); + } + else + { + DBG (4, + "(child) reader_process: finished, wrote %d bytes, expected %d " + "bytes\n", byte_count, bytes_total); + } + return SANE_STATUS_GOOD; +} + +/* + * this code either runs in child or thread context... + */ +static int +reader_task (void *data) +{ + SANE_Status status; + struct SIGACTION act; + struct VP2_Device *vp2_device = (struct VP2_Device *) data; + + DBG (2, "reader_task started\n"); + if (sanei_thread_is_forked ()) + { + DBG (3, "reader_task started (forked)\n"); + close (vp2_device->pipe); + vp2_device->pipe = -1; + + } + else + { + DBG (3, "reader_task started (as thread)\n"); + } + + memset (&act, 0, sizeof (act)); + sigaction (SIGTERM, &act, NULL); + + status = reader_process (vp2_device, vp2_device->reader_fds); + DBG (2, "(child) reader_task: reader_process finished (%s)\n", + sane_strstatus (status)); + return (int) status; +} + +static SANE_Status +finish_pass (VP2_Device * vp2_device) +{ + SANE_Status return_status = SANE_STATUS_GOOD; + + DBG (2, "finish_pass: vp2_device=%p\n", (void *) vp2_device); + vp2_device->scanning = SANE_FALSE; + if (vp2_device->pipe >= 0) + { + DBG (2, "finish_pass: closing pipe\n"); + close (vp2_device->pipe); + DBG (2, "finish_pass: pipe closed\n"); + vp2_device->pipe = -1; + } + if (vp2_device->reader_pid > 0) + { + int status; + int pid; + + DBG (2, "finish_pass: terminating reader process %d\n", + vp2_device->reader_pid); + sanei_thread_kill (vp2_device->reader_pid); + pid = sanei_thread_waitpid (vp2_device->reader_pid, &status); + if (pid < 0) + { + DBG (1, + "finish_pass: sanei_thread_waitpid failed, already terminated? (%s)\n", + strerror (errno)); + } + else + { + DBG (2, + "finish_pass: reader process terminated with status: %s\n", + sane_strstatus (status)); + } + vp2_device->reader_pid = 0; + } + /* this happens when running in thread context... */ + if (vp2_device->reader_fds >= 0) + { + DBG (2, "finish_pass: closing reader pipe\n"); + close (vp2_device->reader_fds); + DBG (2, "finish_pass: reader pipe closed\n"); + vp2_device->reader_fds = -1; + } + + sane_geniusvp2_go_home (); + + return return_status; +} + +static SANE_Status +lamp_warmup (int warmup_time) +{ + SANE_Status status = SANE_STATUS_GOOD; + static struct timeval last_warmup; + unsigned int remain_time; + + DBG (2, "lamp_warmup: warmup_time=%d\n", warmup_time); + + if (sane_geniusvp2_is_lamp_on ()) + { + struct timeval current_time; + + if (gettimeofday (¤t_time, NULL) == -1) + { + DBG (1, "lamp_warmup: gettimeofday returned %s\n", + strerror (errno)); + return SANE_STATUS_IO_ERROR; + } + if (current_time.tv_sec - last_warmup.tv_sec < warmup_time) + { + remain_time = warmup_time - (current_time.tv_sec - + last_warmup.tv_sec); + } + else + remain_time = 0; + } + else + { + status = sane_geniusvp2_lamp_on (); + if (gettimeofday (&last_warmup, NULL) == -1) + { + DBG (1, "lamp_warmup: gettimeofday returned %s\n", + strerror (errno)); + return SANE_STATUS_IO_ERROR; + } + remain_time = warmup_time; + } + + if (!remain_time) + DBG (2, "lamp_warmup: lamp warm up is not necessary\n"); + else + { + DBG (2, "lamp_warmup: lamp not completely warmed up, " + "remaining time = %d sec\n", remain_time); + sleep (remain_time); + } + + return status; +} + +static void +print_options (VP2_Device * vp2_device) +{ + SANE_Option_Descriptor *od; + SANE_Word option_number; + SANE_Char caps[1024]; + + for (option_number = 0; option_number < num_options; option_number++) + { + od = &vp2_device->opt[option_number]; + DBG (0, "-----> number: %d\n", option_number); + DBG (0, " name: `%s'\n", od->name); + DBG (0, " title: `%s'\n", od->title); + DBG (0, " description: `%s'\n", od->desc); + DBG (0, " type: %s\n", + od->type == SANE_TYPE_BOOL ? "SANE_TYPE_BOOL" : + od->type == SANE_TYPE_INT ? "SANE_TYPE_INT" : + od->type == SANE_TYPE_FIXED ? "SANE_TYPE_FIXED" : + od->type == SANE_TYPE_STRING ? "SANE_TYPE_STRING" : + od->type == SANE_TYPE_BUTTON ? "SANE_TYPE_BUTTON" : + od->type == SANE_TYPE_GROUP ? "SANE_TYPE_GROUP" : "unknown"); + DBG (0, " unit: %s\n", + od->unit == SANE_UNIT_NONE ? "SANE_UNIT_NONE" : + od->unit == SANE_UNIT_PIXEL ? "SANE_UNIT_PIXEL" : + od->unit == SANE_UNIT_BIT ? "SANE_UNIT_BIT" : + od->unit == SANE_UNIT_MM ? "SANE_UNIT_MM" : + od->unit == SANE_UNIT_DPI ? "SANE_UNIT_DPI" : + od->unit == SANE_UNIT_PERCENT ? "SANE_UNIT_PERCENT" : + od->unit == SANE_UNIT_MICROSECOND ? "SANE_UNIT_MICROSECOND" : + "unknown"); + DBG (0, " size: %d\n", od->size); + caps[0] = '\0'; + if (od->cap & SANE_CAP_SOFT_SELECT) + strcat (caps, "SANE_CAP_SOFT_SELECT "); + if (od->cap & SANE_CAP_HARD_SELECT) + strcat (caps, "SANE_CAP_HARD_SELECT "); + if (od->cap & SANE_CAP_SOFT_DETECT) + strcat (caps, "SANE_CAP_SOFT_DETECT "); + if (od->cap & SANE_CAP_EMULATED) + strcat (caps, "SANE_CAP_EMULATED "); + if (od->cap & SANE_CAP_AUTOMATIC) + strcat (caps, "SANE_CAP_AUTOMATIC "); + if (od->cap & SANE_CAP_INACTIVE) + strcat (caps, "SANE_CAP_INACTIVE "); + if (od->cap & SANE_CAP_ADVANCED) + strcat (caps, "SANE_CAP_ADVANCED "); + DBG (0, " capabilities: %s\n", caps); + DBG (0, "constraint type: %s\n", + od->constraint_type == SANE_CONSTRAINT_NONE ? + "SANE_CONSTRAINT_NONE" : + od->constraint_type == SANE_CONSTRAINT_RANGE ? + "SANE_CONSTRAINT_RANGE" : + od->constraint_type == SANE_CONSTRAINT_WORD_LIST ? + "SANE_CONSTRAINT_WORD_LIST" : + od->constraint_type == SANE_CONSTRAINT_STRING_LIST ? + "SANE_CONSTRAINT_STRING_LIST" : "unknown"); + } +} + +/***************************** SANE API ****************************/ + +SANE_Status +sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) +{ + FILE *fp; + SANE_Int linenumber; + SANE_Char line[PATH_MAX], *word; + SANE_String_Const cp; + SANE_String device_name = VP2_DEFAULT_DEVICE; + VP2_Device *vp2_device = NULL; + + DBG_INIT (); + sanei_thread_init (); + + DBG (2, "sane_init: version_code=%p, authorize=%p\n", + (void *) version_code, (void *) authorize); + DBG (1, "sane_init: SANE geniusvp2 backend version " BACKEND_VERSION + " from %s\n", PACKAGE_STRING); + + if (version_code) + *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD); + + if (inited) + DBG (3, "sane_init: warning: already inited\n"); + + fp = sanei_config_open (VP2_CONFIG_FILE); + if (fp) + { + linenumber = 0; + DBG (4, "sane_init: reading config file `%s'\n", VP2_CONFIG_FILE); + while (sanei_config_read (line, sizeof (line), fp)) + { + word = NULL; + linenumber++; + + cp = sanei_config_get_string (line, &word); + if (!word || cp == line) + { + DBG (5, + "sane_init: config file line %3d: ignoring empty line\n", + linenumber); + if (word) + free (word); + continue; + } + if (word[0] == '#') + { + DBG (5, + "sane_init: config file line %3d: ignoring comment line\n", + linenumber); + free (word); + continue; + } + + DBG (5, "sane_init: config file line %3d: `%s'\n", + linenumber, line); + if (read_option (line, "device", param_string, + &device_name) == SANE_STATUS_GOOD) + continue; + + DBG (3, "sane-init: I don't know how to handle option `%s'\n", + word); + } /* while */ + fclose (fp); + } /* if */ + else + { + DBG (3, "sane_init: couldn't find config file (%s), using default " + "settings\n", VP2_CONFIG_FILE); + } + + /* the scanner does not need to be detected on this stage, so sane_init + * always return success (except for "out of memory" errors) */ + if (!sane_geniusvp2_parport_open (device_name)) + { + sane_geniusvp2_scanner_on (); + sane_geniusvp2_reg_read (0, ®0.w); + sane_geniusvp2_reg_read (24, ®24.w); + DBG (4, "sane_init: ASIC ID = 0x%02x, Product ID = 0x%02x\n", + reg0.r.AsicType, reg24.r.ProductID); + sane_geniusvp2_scanner_off (); + sane_geniusvp2_parport_close (); + if (reg0.r.AsicType == VP2_ASIC_ID) + { + /* create device */ + vp2_device = malloc (sizeof (VP2_Device)); + if (!vp2_device) + return SANE_STATUS_NO_MEM; + switch (reg24.r.ProductID) + { + case VP2_PRODUCT_ID: + vp2_device->sane.vendor = "Genius"; + vp2_device->sane.model = "ColorPage-Vivid Pro II"; + break; + + default: + vp2_device->sane.vendor = "Unknown Vendor"; + vp2_device->sane.model = "Unknown Model"; + } + vp2_device->sane.type = "flatbed scanner"; + vp2_device->name = device_name; + vp2_device->sane.name = vp2_device->name; + vp2_device->open = SANE_FALSE; + vp2_device->scanning = SANE_FALSE; + vp2_device->cancelled = SANE_FALSE; + vp2_device->eof = SANE_FALSE; + vp2_device->reader_pid = -1; + vp2_device->pipe = -1; + + /* this is currently redundant as we don't support multiple devices yet */ + vp2_device->next = first_vp2_device; + first_vp2_device = vp2_device; + num_devices++; + + DBG (4, "sane_init: new device: `%s' is a %s %s %s\n", + vp2_device->sane.name, vp2_device->sane.vendor, + vp2_device->sane.model, vp2_device->sane.type); + } + else + { + DBG (1, "sane_init: scanner not found on %s or " + "ASIC is not supported\n", device_name); + } + } + + inited = SANE_TRUE; + return SANE_STATUS_GOOD; +} + +void +sane_exit (void) +{ + VP2_Device *vp2_device, *previous_device; + + DBG (2, "sane_exit\n"); + if (!inited) + { + DBG (1, "sane_exit: not inited, call sane_init() first\n"); + return; + } + + vp2_device = first_vp2_device; + while (vp2_device) + { + DBG (4, "sane_exit: freeing device %s\n", vp2_device->name); + previous_device = vp2_device; + vp2_device = vp2_device->next; + if (previous_device->name) + free (previous_device->name); + free (previous_device); + } + DBG (4, "sane_exit: freeing device list\n"); + if (sane_device_list) + free (sane_device_list); + sane_device_list = NULL; + first_vp2_device = NULL; + inited = SANE_FALSE; + return; +} + +SANE_Status +sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) +{ + int i; + VP2_Device *dev; + + DBG (2, "sane_get_devices: device_list=%p, local_only=%d\n", + (void *) device_list, local_only); + if (!inited) + { + DBG (1, "sane_get_devices: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + + /* already called, so cleanup */ + if (sane_device_list) + free (sane_device_list); + + sane_device_list = malloc ((num_devices + 1) * sizeof (SANE_Device *)); + if (!sane_device_list) + return SANE_STATUS_NO_MEM; + for (i = 0, dev = first_vp2_device; (i < num_devices) && dev; + i++, dev = dev->next) + sane_device_list[i] = &dev->sane; + sane_device_list[i] = NULL; + + *device_list = (const SANE_Device **) sane_device_list; + return SANE_STATUS_GOOD; +} + +SANE_Status +sane_open (SANE_String_Const devicename, SANE_Handle * handle) +{ + VP2_Device *vp2_device = first_vp2_device; + SANE_Status status; + + DBG (2, "sane_open: devicename = \"%s\", handle=%p\n", + devicename, (void *) handle); + if (!inited) + { + DBG (1, "sane_open: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + + if (!handle) + { + DBG (1, "sane_open: handle == NULL\n"); + return SANE_STATUS_INVAL; + } + + if (!devicename || strlen (devicename) == 0) + { + DBG (2, "sane_open: device name NULL or empty\n"); + } + else + { + for (vp2_device = first_vp2_device; vp2_device; + vp2_device = vp2_device->next) + { + if (strcmp (devicename, vp2_device->name) == 0) + break; + } + } + if (!vp2_device) + { + DBG (1, "sane_open: device `%s' not found\n", devicename); + return SANE_STATUS_INVAL; + } + if (vp2_device->open) + { + DBG (1, "sane_open: device `%s' already open\n", devicename); + return SANE_STATUS_DEVICE_BUSY; + } + DBG (2, "sane_open: opening device `%s', handle = %p\n", vp2_device->name, + (void *) vp2_device); + + status = init_options (vp2_device); + if (status != SANE_STATUS_GOOD) + return status; + + if (sane_geniusvp2_parport_open (devicename)) + return SANE_STATUS_IO_ERROR; + sane_geniusvp2_scanner_on (); + + sane_geniusvp2_lamp_off (); /* just in case lamp was left on */ + sane_geniusvp2_go_home (); + lamp_warmup (0); + + vp2_device->open = SANE_TRUE; + vp2_device->scanning = SANE_FALSE; + vp2_device->cancelled = SANE_FALSE; + vp2_device->eof = SANE_FALSE; + vp2_device->bytes_total = 0; + + *handle = vp2_device; + + return SANE_STATUS_GOOD; +} + +void +sane_close (SANE_Handle handle) +{ + VP2_Device *vp2_device = handle; + + DBG (2, "sane_close: handle=%p\n", (void *) handle); + + if (!inited) + { + DBG (1, "sane_close: not inited, call sane_init() first\n"); + return; + } + if (!check_handle (handle)) + { + DBG (1, "sane_close: handle %p unknown\n", (void *) handle); + return; + } + if (!vp2_device->open) + { + DBG (1, "sane_close: handle %p not open\n", (void *) handle); + return; + } + + sane_geniusvp2_lamp_off (); + sane_geniusvp2_scanner_off (); + sane_geniusvp2_parport_close (); + vp2_device->open = SANE_FALSE; + + return; +} + +const SANE_Option_Descriptor * +sane_get_option_descriptor (SANE_Handle handle, SANE_Int option) +{ + VP2_Device *vp2_device = handle; + + DBG (4, "sane_get_option_descriptor: handle=%p, option = %d\n", + (void *) handle, option); + if (!inited) + { + DBG (1, "sane_get_option_descriptor: not inited, call sane_init() " + "first\n"); + return 0; + } + + if (!check_handle (handle)) + { + DBG (1, "sane_get_option_descriptor: handle %p unknown\n", + (void *) handle); + return 0; + } + if (!vp2_device->open) + { + DBG (1, "sane_get_option_descriptor: not open\n"); + return 0; + } + if (option < 0 || option >= num_options) + { + DBG (3, "sane_get_option_descriptor: option < 0 || " + "option > num_options\n"); + return 0; + } + + return &vp2_device->opt[option]; +} + +SANE_Status +sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action, + void *value, SANE_Int * info) +{ + VP2_Device *vp2_device = handle; + SANE_Int myinfo = 0; + SANE_Status status; + + DBG (4, + "sane_control_option: handle=%p, opt=%d, act=%d, val=%p, info=%p\n", + (void *) handle, option, action, (void *) value, (void *) info); + if (!inited) + { + DBG (1, "sane_control_option: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + + if (!check_handle (handle)) + { + DBG (1, "sane_control_option: handle %p unknown\n", (void *) handle); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_control_option: not open\n"); + return SANE_STATUS_INVAL; + } + if (vp2_device->scanning) + { + DBG (1, "sane_control_option: is scanning\n"); + return SANE_STATUS_INVAL; + } + if (option < 0 || option >= num_options) + { + DBG (1, "sane_control_option: option < 0 || option > num_options\n"); + return SANE_STATUS_INVAL; + } + + if (!SANE_OPTION_IS_ACTIVE (vp2_device->opt[option].cap)) + { + DBG (1, "sane_control_option: option is inactive\n"); + return SANE_STATUS_INVAL; + } + + if (vp2_device->opt[option].type == SANE_TYPE_GROUP) + { + DBG (1, "sane_control_option: option is a group\n"); + return SANE_STATUS_INVAL; + } + + switch (action) + { + case SANE_ACTION_SET_AUTO: + if (!SANE_OPTION_IS_SETTABLE (vp2_device->opt[option].cap)) + { + DBG (1, "sane_control_option: option is not setable\n"); + return SANE_STATUS_INVAL; + } + if (!(vp2_device->opt[option].cap & SANE_CAP_AUTOMATIC)) + { + DBG (1, "sane_control_option: option is not automatically " + "setable\n"); + return SANE_STATUS_INVAL; + } + switch (option) + { + default: + DBG (1, "sane_control_option: trying to automatically set " + "unexpected option\n"); + return SANE_STATUS_INVAL; + } + break; + + case SANE_ACTION_SET_VALUE: + if (!SANE_OPTION_IS_SETTABLE (vp2_device->opt[option].cap)) + { + DBG (1, "sane_control_option: option is not setable\n"); + return SANE_STATUS_INVAL; + } + status = sanei_constrain_value (&vp2_device->opt[option], + value, &myinfo); + if (status != SANE_STATUS_GOOD) + { + DBG (3, + "sane_control_option: sanei_constrain_value returned %s\n", + sane_strstatus (status)); + return status; + } + switch (option) + { + case opt_tl_x: /* Fixed with parameter reloading */ + case opt_tl_y: + case opt_br_x: + case opt_br_y: + if (vp2_device->val[option].w == *(SANE_Fixed *) value) + { + DBG (4, + "sane_control_option: option %d (%s) not changed\n", + option, vp2_device->opt[option].name); + break; + } + vp2_device->val[option].w = *(SANE_Fixed *) value; + myinfo |= SANE_INFO_RELOAD_PARAMS; + DBG (4, + "sane_control_option: set option %d (%s) to %.0f %s\n", + option, vp2_device->opt[option].name, + SANE_UNFIX (*(SANE_Fixed *) value), + vp2_device->opt[option].unit == SANE_UNIT_MM ? "mm" : ""); + break; + case opt_resolution: /* Int */ + if (vp2_device->val[option].w == *(SANE_Int *) value) + { + DBG (4, + "sane_control_option: option %d (%s) not changed\n", + option, vp2_device->opt[option].name); + break; + } + vp2_device->val[option].w = *(SANE_Int *) value; + DBG (4, "sane_control_option: set option %d (%s) to %d\n", + option, vp2_device->opt[option].name, *(SANE_Int *) value); + break; + case opt_depth: /* Word list with parameter and options reloading */ + if (vp2_device->val[option].w == *(SANE_Int *) value) + { + DBG (4, + "sane_control_option: option %d (%s) not changed\n", + option, vp2_device->opt[option].name); + break; + } + vp2_device->val[option].w = *(SANE_Int *) value; + myinfo |= SANE_INFO_RELOAD_PARAMS; + myinfo |= SANE_INFO_RELOAD_OPTIONS; + DBG (4, "sane_control_option: set option %d (%s) to %d\n", + option, vp2_device->opt[option].name, *(SANE_Int *) value); + break; + /* options with side-effects */ + case opt_print_options: + DBG (4, "sane_control_option: set option %d (%s)\n", + option, vp2_device->opt[option].name); + print_options (vp2_device); + break; + case opt_mode: + if (strcmp (vp2_device->val[option].s, value) == 0) + { + DBG (4, + "sane_control_option: option %d (%s) not changed\n", + option, vp2_device->opt[option].name); + break; + } + strcpy (vp2_device->val[option].s, (SANE_String) value); + myinfo |= SANE_INFO_RELOAD_PARAMS; + myinfo |= SANE_INFO_RELOAD_OPTIONS; + DBG (4, "sane_control_option: set option %d (%s) to %s\n", + option, vp2_device->opt[option].name, (SANE_String) value); + break; + default: + DBG (1, "sane_control_option: trying to set unexpected option\n"); + return SANE_STATUS_INVAL; + } + break; + + case SANE_ACTION_GET_VALUE: + switch (option) + { + case opt_num_opts: + *(SANE_Word *) value = num_options; + DBG (4, "sane_control_option: get option 0, value = %d\n", + num_options); + break; + case opt_tl_x: /* Fixed options */ + case opt_tl_y: + case opt_br_x: + case opt_br_y: + { + *(SANE_Fixed *) value = vp2_device->val[option].w; + DBG (4, + "sane_control_option: get option %d (%s), value=%.1f %s\n", + option, vp2_device->opt[option].name, + SANE_UNFIX (*(SANE_Fixed *) value), + vp2_device->opt[option].unit == + SANE_UNIT_MM ? "mm" : ""); + break; + } + case opt_mode: /* String (list) options */ + strcpy (value, vp2_device->val[option].s); + DBG (4, + "sane_control_option: get option %d (%s), value=`%s'\n", + option, vp2_device->opt[option].name, (SANE_String) value); + break; + case opt_depth: /* Int + word list options */ + case opt_resolution: + *(SANE_Int *) value = vp2_device->val[option].w; + DBG (4, "sane_control_option: get option %d (%s), value=%d\n", + option, vp2_device->opt[option].name, *(SANE_Int *) value); + break; + default: + DBG (1, "sane_control_option: trying to get unexpected option\n"); + return SANE_STATUS_INVAL; + } + break; + default: + DBG (1, "sane_control_option: trying unexpected action %d\n", action); + return SANE_STATUS_INVAL; + } + if (info) + *info = myinfo; + DBG (4, "sane_control_option: finished, info=%s %s %s \n", + myinfo & SANE_INFO_INEXACT ? "inexact" : "", + myinfo & SANE_INFO_RELOAD_PARAMS ? "reload_parameters" : "", + myinfo & SANE_INFO_RELOAD_OPTIONS ? "reload_options" : ""); + return SANE_STATUS_GOOD; +} + + +SANE_Status +sane_get_parameters (SANE_Handle handle, SANE_Parameters * params) +{ + VP2_Device *vp2_device = handle; + SANE_Parameters *p; + double tl_x = 0, tl_y = 0, br_x = 0, br_y = 0; + SANE_String text_format, mode; + SANE_Int channels = 1, res; + + DBG (2, "sane_get_parameters: handle=%p, params=%p\n", + (void *) handle, (void *) params); + if (!inited) + { + DBG (1, "sane_get_parameters: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + if (!check_handle (handle)) + { + DBG (1, "sane_get_parameters: handle %p unknown\n", (void *) handle); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_get_parameters: handle %p not open\n", (void *) handle); + return SANE_STATUS_INVAL; + } + + res = vp2_device->val[opt_resolution].w; + mode = vp2_device->val[opt_mode].s; + p = &vp2_device->params; + p->depth = vp2_device->val[opt_depth].w; + + tl_x = SANE_UNFIX (vp2_device->val[opt_tl_x].w); + tl_y = SANE_UNFIX (vp2_device->val[opt_tl_y].w); + br_x = SANE_UNFIX (vp2_device->val[opt_br_x].w); + br_y = SANE_UNFIX (vp2_device->val[opt_br_y].w); + if (tl_x > br_x) + swap_double (&tl_x, &br_x); + if (tl_y > br_y) + swap_double (&tl_y, &br_y); + vp2_device->lines = (SANE_Word) (res * (br_y - tl_y) / MM_PER_INCH); + if (vp2_device->lines < 1) + vp2_device->lines = 1; + p->lines = vp2_device->lines; + + if (strcmp (mode, "Gray") == 0) + { + p->format = SANE_FRAME_GRAY; + p->last_frame = SANE_TRUE; + } + else /* Color */ + { + p->format = SANE_FRAME_RGB; + p->last_frame = SANE_TRUE; + } + + p->pixels_per_line = (SANE_Int) (res * (br_x - tl_x) / MM_PER_INCH); + if (p->pixels_per_line < 1) + p->pixels_per_line = 1; + + if (p->format == SANE_FRAME_RGB) + channels = 3; + + if (p->depth == 1) + p->bytes_per_line = channels * (int) ((p->pixels_per_line + 7) / 8); + else /* depth == 8 || depth == 16 */ + p->bytes_per_line = + channels * p->pixels_per_line * ((p->depth + 7) / 8); + + vp2_device->bytes_per_line = p->bytes_per_line; + + if (p->pixels_per_line < 1) + p->pixels_per_line = 1; + vp2_device->pixels_per_line = p->pixels_per_line; + + switch (p->format) + { + case SANE_FRAME_GRAY: + text_format = "gray"; + break; + case SANE_FRAME_RGB: + text_format = "rgb"; + break; + case SANE_FRAME_RED: + text_format = "red"; + break; + case SANE_FRAME_GREEN: + text_format = "green"; + break; + case SANE_FRAME_BLUE: + text_format = "blue"; + break; + default: + text_format = "unknown"; + break; + } + + DBG (3, "sane_get_parameters: format=%s\n", text_format); + DBG (3, "sane_get_parameters: last_frame=%s\n", + p->last_frame ? "true" : "false"); + DBG (3, "sane_get_parameters: lines=%d\n", p->lines); + DBG (3, "sane_get_parameters: depth=%d\n", p->depth); + DBG (3, "sane_get_parameters: pixels_per_line=%d\n", p->pixels_per_line); + DBG (3, "sane_get_parameters: bytes_per_line=%d\n", p->bytes_per_line); + + if (params) + *params = *p; + + return SANE_STATUS_GOOD; +} + +SANE_Status +sane_start (SANE_Handle handle) +{ + VP2_Device *vp2_device = handle; + SANE_Status status; + int pipe_descriptor[2]; + ScanArea area; + + DBG (2, "sane_start: handle=%p\n", handle); + if (!inited) + { + DBG (1, "sane_start: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + if (!check_handle (handle)) + { + DBG (1, "sane_start: handle %p unknown\n", handle); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_start: not open\n"); + return SANE_STATUS_INVAL; + } + if (vp2_device->scanning + && strcmp (vp2_device->val[opt_mode].s, "Color") == 0) + { + DBG (1, "sane_start: already scanning\n"); + return SANE_STATUS_INVAL; + } + + vp2_device->scanning = SANE_TRUE; + vp2_device->cancelled = SANE_FALSE; + vp2_device->eof = SANE_FALSE; + vp2_device->bytes_total = 0; + + sane_get_parameters (handle, 0); + + if (vp2_device->params.lines == 0) + { + DBG (1, "sane_start: lines == 0\n"); + vp2_device->scanning = SANE_FALSE; + return SANE_STATUS_INVAL; + } + if (vp2_device->params.pixels_per_line == 0) + { + DBG (1, "sane_start: pixels_per_line == 0\n"); + vp2_device->scanning = SANE_FALSE; + return SANE_STATUS_INVAL; + } + if (vp2_device->params.bytes_per_line == 0) + { + DBG (1, "sane_start: bytes_per_line == 0\n"); + vp2_device->scanning = SANE_FALSE; + return SANE_STATUS_INVAL; + } + + if (pipe (pipe_descriptor) < 0) + { + DBG (1, "sane_start: pipe failed (%s)\n", strerror (errno)); + return SANE_STATUS_IO_ERROR; + } + + status = lamp_warmup (35); + if (status != SANE_STATUS_GOOD) + { + DBG (1, "sane_start: lamp warm up failed (%s)\n", + sane_strstatus (status)); + } + + area.top = (SANE_UNFIX (vp2_device->val[opt_tl_y].w) / MM_PER_INCH + + 0.47) * OPT_RESOLUTION * 2; + /* Add some offset to skip over hidden left margin */ + area.left = (SANE_UNFIX (vp2_device->val[opt_tl_x].w) / MM_PER_INCH + + left_leading) * OPT_RESOLUTION; + area.height = vp2_device->lines * + (OPT_RESOLUTION / SANE_UNFIX (vp2_device->val[opt_resolution].w)); + area.width = vp2_device->pixels_per_line; + sane_geniusvp2_prepare_scan (area, vp2_device->val[opt_resolution].w); + + /* create reader routine as new process or thread */ + vp2_device->pipe = pipe_descriptor[0]; + vp2_device->reader_fds = pipe_descriptor[1]; + vp2_device->reader_pid = + sanei_thread_begin (reader_task, (void *) vp2_device); + + if (vp2_device->reader_pid < 0) + { + DBG (1, "sane_start: sanei_thread_begin failed (%s)\n", + strerror (errno)); + return SANE_STATUS_NO_MEM; + } + + if (sanei_thread_is_forked ()) + { + close (vp2_device->reader_fds); + vp2_device->reader_fds = -1; + } + + return SANE_STATUS_GOOD; +} + + +SANE_Status +sane_read (SANE_Handle handle, SANE_Byte * data, + SANE_Int max_length, SANE_Int * length) +{ + VP2_Device *vp2_device = handle; + ssize_t bytes_read; + SANE_Int bytes_total = vp2_device->lines * vp2_device->bytes_per_line; + + + DBG (4, "sane_read: handle=%p, data=%p, max_length=%d, length=%p\n", + handle, data, max_length, (void *) length); + if (!inited) + { + DBG (1, "sane_read: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + if (!check_handle (handle)) + { + DBG (1, "sane_read: handle %p unknown\n", handle); + return SANE_STATUS_INVAL; + } + if (!length) + { + DBG (1, "sane_read: length == NULL\n"); + return SANE_STATUS_INVAL; + } + + *length = 0; + + if (!data) + { + DBG (1, "sane_read: data == NULL\n"); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_read: not open\n"); + return SANE_STATUS_INVAL; + } + if (vp2_device->cancelled) + { + DBG (1, "sane_read: scan was cancelled\n"); + return SANE_STATUS_CANCELLED; + } + if (vp2_device->eof) + { + DBG (2, "sane_read: No more data available, sending EOF\n"); + return SANE_STATUS_EOF; + } + if (!vp2_device->scanning) + { + DBG (1, "sane_read: not scanning (call sane_start first)\n"); + return SANE_STATUS_INVAL; + } + + bytes_read = read (vp2_device->pipe, data, max_length); + if (bytes_read == 0 + || (bytes_read + vp2_device->bytes_total >= bytes_total)) + { + SANE_Status status; + DBG (2, "sane_read: EOF reached\n"); + status = finish_pass (vp2_device); + if (status != SANE_STATUS_GOOD) + { + DBG (1, "sane_read: finish_pass returned `%s'\n", + sane_strstatus (status)); + return status; + } + vp2_device->eof = SANE_TRUE; + if (bytes_read == 0) + return SANE_STATUS_EOF; + } + else if (bytes_read < 0) + { + if (errno == EAGAIN) + { + DBG (2, "sane_read: no data available, try again\n"); + return SANE_STATUS_GOOD; + } + else + { + DBG (1, "sane_read: read returned error: %s\n", strerror (errno)); + return SANE_STATUS_IO_ERROR; + } + } + *length = bytes_read; + vp2_device->bytes_total += bytes_read; + + DBG (2, "sane_read: read %ld bytes of %d, total %d\n", (long) bytes_read, + max_length, vp2_device->bytes_total); + return SANE_STATUS_GOOD; +} + +void +sane_cancel (SANE_Handle handle) +{ + VP2_Device *vp2_device = handle; + + DBG (2, "sane_cancel: handle = %p\n", handle); + if (!inited) + { + DBG (1, "sane_cancel: not inited, call sane_init() first\n"); + return; + } + if (!check_handle (handle)) + { + DBG (1, "sane_cancel: handle %p unknown\n", handle); + return; + } + if (!vp2_device->open) + { + DBG (1, "sane_cancel: not open\n"); + return; + } + if (vp2_device->cancelled) + { + DBG (1, "sane_cancel: scan already cancelled\n"); + return; + } + if (!vp2_device->scanning) + { + DBG (2, "sane_cancel: scan is already finished\n"); + return; + } + finish_pass (vp2_device); + vp2_device->cancelled = SANE_TRUE; + vp2_device->scanning = SANE_FALSE; + vp2_device->eof = SANE_FALSE; + return; +} + +SANE_Status +sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking) +{ + VP2_Device *vp2_device = handle; + + DBG (2, "sane_set_io_mode: handle = %p, non_blocking = %d\n", handle, + non_blocking); + if (!inited) + { + DBG (1, "sane_set_io_mode: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + if (!check_handle (handle)) + { + DBG (1, "sane_set_io_mode: handle %p unknown\n", handle); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_set_io_mode: not open\n"); + return SANE_STATUS_INVAL; + } + if (!vp2_device->scanning) + { + DBG (1, "sane_set_io_mode: not scanning\n"); + return SANE_STATUS_INVAL; + } + if (fcntl (vp2_device->pipe, + F_SETFL, non_blocking ? O_NONBLOCK : 0) < 0) + { + DBG (1, "sane_set_io_mode: can't set io mode"); + return SANE_STATUS_INVAL; + } + return SANE_STATUS_GOOD; +} + +SANE_Status +sane_get_select_fd (SANE_Handle handle, SANE_Int * fd) +{ + VP2_Device *vp2_device = handle; + + DBG (2, "sane_get_select_fd: handle = %p, fd %s 0\n", handle, + fd ? "!=" : "=="); + if (!inited) + { + DBG (1, "sane_get_select_fd: not inited, call sane_init() first\n"); + return SANE_STATUS_INVAL; + } + if (!check_handle (handle)) + { + DBG (1, "sane_get_select_fd: handle %p unknown\n", handle); + return SANE_STATUS_INVAL; + } + if (!vp2_device->open) + { + DBG (1, "sane_get_select_fd: not open\n"); + return SANE_STATUS_INVAL; + } + if (!vp2_device->scanning) + { + DBG (1, "sane_get_select_fd: not scanning\n"); + return SANE_STATUS_INVAL; + } + *fd = vp2_device->pipe; + return SANE_STATUS_GOOD; +} diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2.conf sane-backends-1.0.15/backend/geniusvp2.conf --- sane-backends-1.0.15.orig/backend/geniusvp2.conf 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2.conf 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,47 @@ +# geniusvp2 backend configuration file +######################################## + +# Parallel port where scanner is attached to +device /dev/parport0 + +# Default option values +######################################## + +# Scan mode (currently, only Color mode is supported) +mode Color + +# Bit depth (currently, only a bit depth of 8 is supported) +depth 8 + +# Resolution (75 - 600 dpi) +resolution 200 + +# Read-limit (true, false) +read-limit false + +# Read-limit size (1 - 65536 bytes) +read-limit-size 1 + +# Read-delay (true, false) +read-delay false + +# Read-delay duration (1000 - 200,000 microseconds) +read-delay-duration 1000 + +# Non-blocking io (true, false) +non-blocking false + +# Support select fd (true, false) +select-fd false + +# Top-left x position (mm) +tl_x 0.0 + +# Top-left y position (mm) +tl_y 0.0 + +# Bottom-right x position (mm) +br_x 80.0 + +# Bottom-right y position (mm) +br_y 100.0 diff -Naur sane-backends-1.0.15.orig/backend/geniusvp2.h sane-backends-1.0.15/backend/geniusvp2.h --- sane-backends-1.0.15.orig/backend/geniusvp2.h 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/backend/geniusvp2.h 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,113 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 2004, 2005 Anderson Lizardo <lizardo@users.sourceforge.net> + + This file is part of the SANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + 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. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. + + SANE backend for the Genius ColorPage-Vivid Pro II scanner. +*/ + +#ifndef geniusvp2_h +#define geniusvp2_h + +#undef BACKEND_NAME +#define BACKEND_NAME geniusvp2 + +#define DEBUG_NOT_STATIC + +#include "../include/sane/sane.h" +#include "../include/sane/sanei_config.h" +#include "../include/sane/sanei_backend.h" + +#define MM_PER_INCH 25.4 + +#define VP2_ASIC_ID 0xE1 /* EICI 091000 ASIC ID */ +#define VP2_PRODUCT_ID 0x06 /* Genius ColorPage-Vivid Pro II product ID */ + +typedef enum +{ + param_none = 0, + param_bool, + param_int, + param_fixed, + param_string +} +parameter_type; + +typedef enum +{ + opt_num_opts = 0, + opt_mode_group, + opt_mode, + opt_depth, + opt_resolution, + opt_special_group, + opt_print_options, + opt_geometry_group, + opt_tl_x, + opt_tl_y, + opt_br_x, + opt_br_y, + /* must come last: */ + num_options +} +geniusvp2_opts; + +typedef struct VP2_Device +{ + struct VP2_Device *next; + SANE_Device sane; + SANE_Option_Descriptor opt[num_options]; + Option_Value val[num_options]; + SANE_Parameters params; + SANE_String name; + SANE_Int reader_pid; + SANE_Int reader_fds; + SANE_Int pipe; + SANE_Word bytes_per_line; + SANE_Word pixels_per_line; + SANE_Word lines; + SANE_Int bytes_total; + SANE_Bool open; + SANE_Bool scanning; + SANE_Bool cancelled; + SANE_Bool eof; +} +VP2_Device; + +#endif /* geniusvp2_h */ diff -Naur sane-backends-1.0.15.orig/configure sane-backends-1.0.15/configure --- sane-backends-1.0.15.orig/configure 2004-11-07 17:36:08.000000000 +0000 +++ sane-backends-1.0.15/configure 2005-04-04 00:42:54.000000000 +0000 @@ -1168,7 +1168,7 @@ else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd "$ac_popdir" + cd $ac_popdir done fi @@ -2228,7 +2228,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2286,7 +2287,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2402,7 +2404,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2456,7 +2459,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2501,7 +2505,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2545,7 +2550,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3470,7 +3476,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3640,7 +3647,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3703,7 +3711,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3872,7 +3881,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3926,7 +3936,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3996,7 +4007,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4175,7 +4187,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4246,7 +4259,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4394,7 +4408,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4494,7 +4509,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4567,7 +4583,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4715,7 +4732,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4815,7 +4833,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4906,7 +4925,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4979,7 +4999,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5052,7 +5073,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5126,7 +5148,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5199,7 +5222,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5272,7 +5296,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5346,7 +5371,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5403,7 +5429,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5576,7 +5603,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5717,7 +5745,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5811,7 +5840,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5961,7 +5991,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6067,7 +6098,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6318,7 +6350,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6398,7 +6431,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6461,7 +6495,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6677,7 +6712,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6820,7 +6856,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6907,7 +6944,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7053,7 +7091,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7134,7 +7173,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7195,7 +7235,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7260,7 +7301,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7325,7 +7367,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7443,7 +7486,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7508,7 +7552,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7573,7 +7618,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7638,7 +7684,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7703,7 +7750,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7768,7 +7816,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7831,7 +7880,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7887,7 +7937,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7941,7 +7992,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7998,7 +8050,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8059,7 +8112,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8145,7 +8199,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8204,7 +8259,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8246,7 +8302,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8303,7 +8360,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8471,7 +8529,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8531,7 +8590,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8604,7 +8664,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8685,7 +8746,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8826,7 +8888,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8964,7 +9027,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9148,7 +9212,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9447,7 +9512,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9559,7 +9625,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9677,7 +9744,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9774,7 +9842,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9844,7 +9913,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9902,7 +9972,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10482,7 +10553,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 10485 "configure"' > conftest.$ac_ext + echo '#line 10556 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10602,7 +10673,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10919,7 +10991,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11179,7 +11252,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11237,7 +11311,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11308,7 +11383,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11352,7 +11428,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11715,7 +11792,7 @@ # Provide some information about the compiler. -echo "$as_me:11718:" \ +echo "$as_me:11795:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -11761,7 +11838,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11810,7 +11888,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12774,11 +12853,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12777: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12856: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12781: \$? = $ac_status" >&5 + echo "$as_me:12860: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13017,11 +13096,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13020: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13099: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13024: \$? = $ac_status" >&5 + echo "$as_me:13103: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13077,11 +13156,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13080: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13159: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13084: \$? = $ac_status" >&5 + echo "$as_me:13163: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13468,7 +13547,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13528,7 +13608,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14720,7 +14801,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14823,7 +14905,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14888,7 +14971,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14981,7 +15065,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15046,7 +15131,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15112,7 +15198,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15178,7 +15265,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15253,7 +15341,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 15256 "configure" +#line 15344 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15351,7 +15439,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 15354 "configure" +#line 15442 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16388,7 +16476,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -16449,7 +16538,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17546,11 +17636,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17549: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17639: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17553: \$? = $ac_status" >&5 + echo "$as_me:17643: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -17606,11 +17696,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17609: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17699: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17613: \$? = $ac_status" >&5 + echo "$as_me:17703: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18427,7 +18517,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18530,7 +18621,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18595,7 +18687,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18688,7 +18781,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18753,7 +18847,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18819,7 +18914,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18885,7 +18981,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18960,7 +19057,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 18963 "configure" +#line 19060 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19058,7 +19155,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 19061 "configure" +#line 19158 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19895,11 +19992,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19898: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19995: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19902: \$? = $ac_status" >&5 + echo "$as_me:19999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -19955,11 +20052,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19958: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20055: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19962: \$? = $ac_status" >&5 + echo "$as_me:20059: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20336,7 +20433,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20386,7 +20484,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21992,11 +22091,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21995: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22094: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21999: \$? = $ac_status" >&5 + echo "$as_me:22098: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -22235,11 +22334,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22238: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22337: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:22242: \$? = $ac_status" >&5 + echo "$as_me:22341: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -22295,11 +22394,11 @@ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22298: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22397: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:22302: \$? = $ac_status" >&5 + echo "$as_me:22401: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -22686,7 +22785,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -22746,7 +22846,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -23938,7 +24039,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24041,7 +24143,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24106,7 +24209,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24199,7 +24303,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24264,7 +24369,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24330,7 +24436,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24396,7 +24503,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -24471,7 +24579,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 24474 "configure" +#line 24582 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -24569,7 +24677,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 24572 "configure" +#line 24680 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -25681,6 +25789,13 @@ BACKENDS="${BACKENDS} net" fi + if test "${ac_cv_header_linux_ppdev_h}" != "yes" + then + echo "*** disabling geniusvp2 backend (linux/ppdev.h not found)" + else + BACKENDS="${BACKENDS} geniusvp2" + fi + # Check whether --enable-pnm-backend or --disable-pnm-backend was given. if test "${enable_pnm_backend+set}" = set; then enableval="$enable_pnm_backend" @@ -26655,6 +26770,11 @@ *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -26693,12 +26813,6 @@ fi;; esac done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub diff -Naur sane-backends-1.0.15.orig/configure.in sane-backends-1.0.15/configure.in --- sane-backends-1.0.15.orig/configure.in 2004-11-07 17:35:52.000000000 +0000 +++ sane-backends-1.0.15/configure.in 2005-04-04 00:42:54.000000000 +0000 @@ -362,6 +362,13 @@ BACKENDS="${BACKENDS} net" fi + if test "${ac_cv_header_linux_ppdev_h}" != "yes" + then + echo "*** disabling geniusvp2 backend (linux/ppdev.h not found)" + else + BACKENDS="${BACKENDS} geniusvp2" + fi + AC_ARG_ENABLE(pnm-backend, AC_HELP_STRING([--enable-pnm-backend], [enable the pnm backend for testing frontends (possible diff -Naur sane-backends-1.0.15.orig/doc/Makefile.in sane-backends-1.0.15/doc/Makefile.in --- sane-backends-1.0.15.orig/doc/Makefile.in 2004-08-03 16:22:28.000000000 +0000 +++ sane-backends-1.0.15/doc/Makefile.in 2005-04-04 00:42:54.000000000 +0000 @@ -39,8 +39,8 @@ SECT1 = scanimage.1 sane-config.1 sane-find-scanner.1 gamma4scanimage.1 SECT5 = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 sane-dll.5 \ - sane-dc25.5 sane-dmc.5 sane-epson.5 sane-hp.5 sane-gphoto2.5 \ - sane-leo.5 sane-matsushita.5 sane-microtek.5 \ + sane-dc25.5 sane-dmc.5 sane-epson.5 sane-geniusvp2.5 sane-gphoto2.5 \ + sane-hp.5 sane-leo.5 sane-matsushita.5 sane-microtek.5 \ sane-microtek2.5 sane-mustek.5 sane-nec.5 sane-net.5 sane-pie.5 \ sane-pint.5 sane-pnm.5 sane-umax.5 sane-qcam.5 sane-scsi.5 \ sane-artec.5 sane-fujitsu.5 sane-sharp.5 sane-s9036.5 \ @@ -62,7 +62,8 @@ README.hp-ux README.linux README.netbsd README.openbsd README.os2 \ README.solaris README.unixware2 README.unixware7 README.windows DOCS = backend-writing.txt sane.ps sane.dvi -BACKDIRS= canon leo matsushita mustek mustek_usb plustek u12 umax sceptre teco gt68xx niash +BACKDIRS= canon geniusvp2 leo matsushita mustek mustek_usb plustek u12 umax \ + sceptre teco gt68xx niash LATEX = TEXINPUTS=$(srcdir):$$TEXINPUTS @LATEX@ DVIPS = @DVIPS@ MAKEINDEX = @MAKEINDEX@ @@ -90,9 +91,9 @@ sane-canon.man sane-canon630u.man sane-config.man sane-coolscan.man \ sane-coolscan2.man sane-dc210.man sane-dc240.man \ sane-dc25.man sane-dll.man sane-dmc.man sane-epson.man \ - sane-find-scanner.man sane-fujitsu.man sane-gphoto2.man sane-hp.man \ - sane-logo.png sane-logo2.jpg sane-matsushita.man sane-microtek.man \ - sane-leo.man sane-microtek2.man \ + sane-find-scanner.man sane-fujitsu.man sane-geniusvp2.man sane-gphoto2.man \ + sane-hp.man sane-leo.man sane-logo.png sane-logo2.jpg \ + sane-matsushita.man sane-microtek.man sane-microtek2.man \ sane-mustek.man sane-mustek_pp.man sane-mustek_usb.man sane-nec.man \ sane-net.man sane-pie.man sane-pint.man sane-plustek.man \ sane-pnm.man sane-qcam.man sane-ricoh.man sane-s9036.man \ diff -Naur sane-backends-1.0.15.orig/doc/descriptions-external/geniusvp2.desc sane-backends-1.0.15/doc/descriptions-external/geniusvp2.desc --- sane-backends-1.0.15.orig/doc/descriptions-external/geniusvp2.desc 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/doc/descriptions-external/geniusvp2.desc 2005-04-04 01:20:38.000000000 +0000 @@ -0,0 +1,26 @@ +; +; SANE Backend specification file +; + +:backend "geniusvp2" ; backend's name +:version "0.2.1" ; backend's version (or "unmaintained") +:manpage "sane-geniusvp2" ; manpage name +:url "http://sourceforge.net/projects/geniusvp2/" ; backend's web page +:comment "Supports color mode, bit depth of 8, 75-600 dpi resolution" + ; comment about the backend + +:devicetype :scanner ; start of a list of devices.... + +:mfg "Genius" ; name a manufacturer +:url "http://www.geniusnet.com.tw/" ; manufacturer's URL + +:model "ColorPage-Vivid Pro II" ; name models for above-specified mfg. +:status :basic ; :minimal, :basic, :good, :complete + ; :untested, or :unsupported +:interface "Parport (EPP)" ; interface type of the device: + ; "SCSI", "USB", "Parport (EPP)", + ; "Parport (SPP)", "Parport (ECP)", + ; "Serial port", "IEEE-1394", "JetDirect", + ; or "Proprietary". +:comment "Similar to Primax Colorado Direct 9600, but with EICI 091000 ASIC" + ; comment about the model diff -Naur sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.BUGS sane-backends-1.0.15/doc/geniusvp2/geniusvp2.BUGS --- sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.BUGS 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/doc/geniusvp2/geniusvp2.BUGS 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,18 @@ +BUGS +---- + +- Scan may sometimes timeout due to the buffer not being filled after some +reasonable time (on a graphical frontend you can notice this when scanning +"hangs" and after some time it stops, resulting in a truncated image). Just +try scanning again and it should work. + +- Scan at high resolutions (e.g. 600 dpi.) may also be truncated if the +selected scan area is too large. Just scan at lower (<= 300 dpi.) resolutions +for now if you want a larger image. + +- the lamp carriage may sometimes go out of its maximum distance (297 mm), +forcing the motor engine. You can detect this when the scanner produces a +"strange" noise and the carriage is at its maximum distance from home. In this +situation, **turn off scanner power imediately**, or you can risk damage your +device. This seems to happen more often when scanning full pages at high +resolutions. diff -Naur sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.THANKS sane-backends-1.0.15/doc/geniusvp2/geniusvp2.THANKS --- sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.THANKS 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/doc/geniusvp2/geniusvp2.THANKS 2005-04-04 00:56:41.000000000 +0000 @@ -0,0 +1,9 @@ +This driver was based on the pxscan program, which in turn is based on primax_scan. + +I'd like to thank the following people/projects: + +- Gustaf Kröling, for writing pxscan. +- Marco Foglia, Christian Ordig and Thomas Schano, for writing primax_scan. +- Jochen Eisinger for sending the first patch for geniusvp2. :-) +- Julien BLACHE for maintaining the libsane-extras Debian package (which contains geniusvp2). +- the SANE developers, for writing such nice scanner platform. diff -Naur sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.TODO sane-backends-1.0.15/doc/geniusvp2/geniusvp2.TODO --- sane-backends-1.0.15.orig/doc/geniusvp2/geniusvp2.TODO 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/doc/geniusvp2/geniusvp2.TODO 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,14 @@ +TODO +---- + +- Add black & white and gray mode scanning (probably using pxscan code). + +- Fix calibration code. + +- Add validation & status checking code (e.g. check if a supported scanner is +present right after initialization code, check for timeouts and return code of +I/O functions etc.). + +- Write a SANE driver (DONE). + +- Document how the scanner works. diff -Naur sane-backends-1.0.15.orig/doc/sane-geniusvp2.man sane-backends-1.0.15/doc/sane-geniusvp2.man --- sane-backends-1.0.15.orig/doc/sane-geniusvp2.man 1970-01-01 00:00:00.000000000 +0000 +++ sane-backends-1.0.15/doc/sane-geniusvp2.man 2005-04-04 00:42:54.000000000 +0000 @@ -0,0 +1,91 @@ +.\" .IX sane-geniusvp2 +.TH "sane-geniusvp2" "5" "08 Feb 2005" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" +.SH "NAME" +sane\-geniusvp2 \- SANE backend for Genius ColorPage\-Vivid Pro II (PP) scanner +.SH "DESCRIPTION" +The +.B sane\-geniusvp2 +backend supports EICI 091000 based parallel port flatbed scanners. This ASIC can be found on some Primax devices, and on the Genius ColorPage\-Vivid Pro II scanner (which is actually a Primax OEM device). +.SH "SUPPORTED DEVICES" +The following scanner should work with this backend: + +Device Details +.br +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +.br +Vendor: Genius +.br +Model: ColorPage\-Vivid Pro II +.br +FCC ID: EMJFB308C +.br +MODEL NO: FB601C + +Chipset Details +.br +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- +.br +ASIC ID: 0xE1 +.br +Product ID: 0x06 +.br +ASIC: EICI 091000 +.br +AFE: Wolfson WM\-8143\-12 +.br +Memory: NEC uPD424210\-60 (256 Kb?) +.SH "CONFIGURATION" +.PP +This section decribes the backend's configuration file entries. The file is located at: +.IP +.I @CONFIGDIR@/geniusvp2.conf +.PP +For a proper setup, you will need at least this entry: +.IP +.I device parport0 +.PP +Currently, only access through ppdev is supported. +.SH "PARALLEL PORT MODES" +.PP +Only EPP mode (including "EPP+ECP") is supported. Future versions may include support for the (slower) SPP mode. +.SH "FILES" +.TP +.I @CONFIGDIR@/geniusvp2.conf +The backend configuration file +.TP +.I @LIBDIR@/libsane\-geniusvp2.a +The static library implementing this backend. +.TP +.I @LIBDIR@/libsane\-geniusvp2.so +The shared library implementing this backend (present on systems that support dynamic loading). +.SH "ENVIRONMENT" +.TP +.B SANE_CONFIG_DIR +This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi\-colon (`;'). If this variable is not set, the configuration file is searched in two default directories: first, the current working directory (".") and then in @CONFIGDIR@. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explicitly specified directories. For example, setting +.B SANE_CONFIG_DIR +to "/tmp/config:" would result in directories "/tmp/config", ".", and "@CONFIGDIR@" being searched (in this order). +.TP +.B SANE_DEBUG_GENIUSVP2 +If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. Higher debug levels increase the verbosity of the output. + +Example: export SANE_DEBUG_GENIUSVP2=10 + +To obtain debug messages from the backend, set this environment variable before calling your favorite frontend (e.g. xscanimage). + +Example: export SANE_DEBUG_GENIUSVP2=10 ; xscanimage +.SH "KNOWN BUGS AND RESTRICTIONS" +.PP +Scan may sometimes timeout due to the scanner's buffer not being filled after some reasonable time, and you get a truncated image. Just try scanning again and it should work. +.PP +Scans at high resolutions (e.g. 600 dpi.) may also be truncated if the selected scan area is too large. Just scan at lower (<= 300 dpi.) resolutions for now if you want a larger image. +.PP +The lamp carriage may sometimes go out of its maximum distance (297 mm), forcing the motor engine. You can detect this when the scanner produces a "strange" noise and the carriage is at its maximum distance from home. In this situation, +.B turn off scanner power imediately, +or you may risk damage your device. This seems to happen more often when scanning full pages at high resolutions. +.SH "SEE ALSO" +.BR sane (7), +.br +.I http://sourceforge.net/projects/geniusvp2/ +.SH "AUTHOR" +.PP +Anderson Lizardo <lizardo@users.sourceforge.net> diff -Naur sane-backends-1.0.15.orig/doc/sane.man sane-backends-1.0.15/doc/sane.man --- sane-backends-1.0.15.orig/doc/sane.man 2004-08-03 17:28:07.000000000 +0000 +++ sane-backends-1.0.15/doc/sane.man 2005-04-04 00:42:54.000000000 +0000 @@ -754,6 +754,7 @@ .BR sane\-dmc (5), .BR sane\-epson (5), .BR sane\-fujitsu (5), +.BR sane\-geniusvp2 (5), .BR sane\-gphoto2 (5), .BR sane\-gt68xx (5), .BR sane\-hp (5), @@ -804,4 +805,4 @@ for details). This man page was written by Henning Meier-Geinitz. Quite a lot of text was taken from the .B SANE -standard, several man pages, and README files. \ No newline at end of file +standard, several man pages, and README files. diff -Naur sane-backends-1.0.15.orig/sane-backends.lsm sane-backends-1.0.15/sane-backends.lsm --- sane-backends-1.0.15.orig/sane-backends.lsm 2004-05-12 18:10:59.000000000 +0000 +++ sane-backends-1.0.15/sane-backends.lsm 2005-04-04 00:42:54.000000000 +0000 @@ -8,8 +8,8 @@ networking support. For other/graphical frontends take a look at sane-frontends and XSane. Keywords: camera, scanner, Abaton, Agfa, Apple, Artec, Avision, Canon, - DevCom, Epson, Fujitsu, gPhoto, HP, Kodak (DC25, DC210 and - DC240), Microtek, Mustek, NEC, Nikon CoolScan, Polaroid + DevCom, Epson, Fujitsu, Genius, gPhoto, HP, Kodak (DC25, DC210 + and DC240), Microtek, Mustek, NEC, Nikon CoolScan, Polaroid Digital Microscope Camera, Pacific Image Electronics, PINT, Plustek, Panasonic, Connectix QuickCam, Ricoh, Sceptre, Sharp, Siemens, Tamarack, UMAX, Video for Linux,