Lines Matching +full:issue +full:- +full:inactive +full:- +full:days
2 epson.c - SANE library for Epson flatbed scanners.
7 Original code taken from sane-0.71
11 Copyright (C) 1998-1999 Christian Bucher <bucher@vernetzt.at>
12 Copyright (C) 1998-1999 Kling & Hautzinger GmbH
13 Copyright (C) 1999 Norihiko Sawa <sawa@yb3.so-net.ne.jp>
16 Copyright (C) 1999-2005 Karl Heinz Kremer <khk@khk.net>
20 #define SANE_EPSON_VERSION "SANE Epson Backend v0.2.47 - 2006-08-21"
61 2006-08-21 Fix buffer overflow error (submitted by Johannes Meixner)
62 2006-06-11 Applied patch from Henning. Fixed a number of compiler warnings
63 2006-03-12 Added support for perfetion 4990 photo 4800 dpi
64 2005-01-09 "flaming hack to get USB scanners working without timeouts under linux"
66 2004-12-18 Added USB IDs for CX-4600 and CX-3650
67 2004-10-16 Added USB ID for Expression 10000XL
68 2004-05-08 Disable feed() for Perfection1640
69 2004-02-08 Reformat all source code with "indent -bli0"
70 2004-02-01 Added D7 function level as copy of D1 for CX-6400
71 Added IDs for CX-6400 and Perfection 4870
72 2003-10-27 Replaced DBG(0, ... with DBG(1, ...
73 2003-09-12 Increment only once in loop to find USB scanners
75 2003-08-21 Removed '//' comments - again ...
77 2003-08-15 Added support for GT-30000, with support for the ADF in simplex mode
80 useable for SBP-2 under FreeBSD
81 2003-05-11 Initialize OPT_LIMIT_RESOLUTION before first call to filter_resolution_list()
84 2003-03-26 Fixed two warnings reported by der Mouse
85 2003-02-16 Code cleanup, use more descriptive variable names.
86 2003-02-15 Move sanei_usb_init() to sane_init(). Thanks to Ron Cemer
88 2003-02-15 Fix problem with "usb <vendor> <product> syntax in config file
89 2002-12-28 Added advanced option to display only short resolution list for
91 2002-11-23 Fixed problem with dropout color.
92 2002-11-03 Full libusb support.
93 2002-10-05 Fixed problem with incorrect response to sane_get_parameters()
95 2002-09-01 USB scanners are now using libsane-usb functions
96 2002-08-17 Fixed typo in variable name.
97 Fixed IEEE-1394 problem with Perfection-2450.
100 2002-04-22 Declare close_scanner() and open_scanner() before they
102 2002-04-13 Check if scanner needs to be opened for the reset call.
105 2002-01-18 Recognize GT-xxxx type scanners also when using the SCSI
106 or IEEE-1394 interface
107 2002-01-06 Disable TEST_IOCTL again, which was enabled by accident. Also
109 2002-01-05 Version 0.2.17
110 Check for and set s->fd to -1 when device is closed.
111 Removed black gamma table - only use RGB even for grayscale
112 2002-01-01 Do not call access() for OS/2 systems
113 2001-11-13 Version 0.2.16
115 2001-11-11 Version 0.2.15
116 Fixed "wait-for-button" functionality, accidentally merged back wrong
118 Corrected "need-strange-reorder" recognition.
120 2001-11-10 Version 0.2.14
121 Added "wait-for-button" functionality
122 2001-10-30 I18N patches (Stefan Roellin)
123 2001-10-28 Fixed bug with 1650 recognition
124 2001-06-09 Version 0.2.09
126 2001-05-25 Version 0.2.07
129 2001-05-24 Removed ancient code that was used to determine the resolution
132 2001-05-22 Version 0.2.06
133 Added sense_handler to support the GT-8000 scanner. Thanks to Matthias Trute
137 2001-05-19 Version 0.2.05
138 fixed the year in the recent change log entries - I now that it's
141 2001-05-13 Version 0.2.04
144 2001-04-22 Version 0.2.03
149 2001-03-31 Version 0.2.02
150 2001-03-17 Next attempt to get the reported number of lines correct
153 2000-12-25 Version 0.2.01
160 2000-12-09 Version 0.2.00
165 2000-12-04 We've introduced the concept of inverting images
173 2000-12-03 added the 12/14/16 bit support again.
174 2000-12-03 Version 0.1.38
178 hardcoded values and the fix for the off-by-one error
183 2000-12-03 Fixed off-by-one error in color reordering function.
184 2000-12-02 Read information about optical resolution and line
187 2000-11-23 Display "Set Focus" control only for scanners that
189 2000-11-19 Added support for the "set focus position" command,
191 2000-07-28 Changed #include <...> to #include "..." for the
193 2000-07-26 Fixed problem with Perfection610: The variable
194 s->color_shuffle_line was never correctly initialized
195 2000-06-28 When closing the scanner device the data that's
197 is flushed. This fixes the problem with scanimage -T
198 2000-06-13 Invert image when scanning negative with TPU,
200 2000-06-13 Initialize optical_res to 0 (Dave Hill)
201 2000-06-07 Fix in sane_close() - found by Henning Meier-Geinitz
202 2000-06-01 Threshold should only be active when scan depth
204 2000-05-28 Turned on scanner based color correction.
214 2000-05-21 In sane_close use close_scanner instead of just the
216 2000-05-20 ... finally fixed the problem with the 610
218 epson.h - this fixes a bug that caused problems when
220 2000-05-13 Fixed the color problem with the Perfection 610. The few
223 2000-05-06 Added support for multiple EPSON scanners. At this time
226 2000-04-06 Did some cleanup on the gamma correction part. The user
230 2000-03-27 Disable request for push button status
231 2000-03-22 Removed free() calls to static strings to remove
235 long time (2000-01-25).
236 2000-03-19 Fixed problem with A4 level devices - they use the
242 2000-03-06 Fixed occasional crash after warm up when the "in warmup
245 2000-03-02 Code cleanup, disabled ZOOM until I have time to
247 2000-03-01 More D1 fixes. In the future I have to come up with
252 2000-02-23 First stab at level D1 support, also added a test
254 2000-02-21 Check for "warming up" in after sane_start. This is
257 2000-02-20 Added some cleanup on error conditions in attach()
260 2000-02-19 Changed some "int" to "size_t" types
264 2000-02-11 Default scan source is always "Flatbed", regardless
266 2000-02-03 Gamma curves now coupled with gamma correction menu.
270 2000-02-02 "Brown Paper Bag Release" Put the USB fix finally
272 2000-02-01 Fixed problem with USB scanner not being recognized
273 because of the changes to attach a few days ago. (KHK)
274 2000-01-29 fixed core dump with xscanimage by moving the gamma
277 easier to compile on non-gcc compilers (KHK)
278 2000-01-26 fixed problem with resolution selection when using the
280 2000-01-25 moved the section where the device name is assigned
283 2000-01-24 reorganization of SCSI related "helper" functions
284 started support for user defined color correction -
286 2000-01-24 Removed C++ style comments '//' (KHK)
300 /* --------------------- SANE INTERNATIONALISATION ------------------ */
347 #define XtOffset(p_type,field) ((size_t)&(((p_type)NULL)->field))
397 convince me that this is still needed. The A5 level was for the GT-300, which
399 scanner with SANE get in touch with me and we can work something out - khk */
443 …{"A2", 'I', 0, 'F','S', 0, 'G','D','R','H','A','L',{-3,3,0}, 'Z','B', 0, '@', 0, 0, 0, 0, 0, …
445 …{"B2", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z','B', 0, '@', 0, 0, 0, 0, 0, …
446 …{"B3", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z','B','M','@', 0, 0, 0, 0, 0, …
447 …{"B4", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z','B','M','@','g','d', 0, 'z','Q','…
448 …{"B5", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z','B','M','@','g','d','K','z','Q','…
449 …{"B6", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z','B','M','@','g','d','K','z','Q','…
450 …{"B7", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-4,3,0}, 'Z','B','M','@','g','d','K','z','Q','…
451 …{"B8", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-4,3,0}, 'Z','B','M','@','g','d','K','z','Q','…
452 …{"F5", 'I', 0, 'F','S','C','G','D','R','H','A','L',{-3,3,0}, 'Z', 0, 'M','@','g','d','K','z','Q', …
505 * NOTE: no const - this list gets created while exploring the capabilities
631 SANE_I18N ("Impact-dot printers"),
633 SANE_I18N ("Ink-jet printers"),
717 static const SANE_Range s8_range = { -127, 127, 0 };
732 static const SANE_Range outline_emphasis_range = { -2, 2, 0 };
734 /* static const SANE_Range gamma_range = { -2, 2, 0 }; */
770 * List of pointers to devices - will be dynamically allocated depending
899 if (s->hw->connection == SANE_EPSON_SCSI) in send()
901 return sanei_epson_scsi_write (s->fd, buf, buf_size, status); in send()
903 else if (s->hw->connection == SANE_EPSON_PIO) in send()
907 if (buf_size == (n = sanei_pio_write (s->fd, buf, buf_size))) in send()
914 else if (s->hw->connection == SANE_EPSON_USB) in send()
918 *status = sanei_usb_write_bulk (s->fd, buf, &n); in send()
940 if (s->hw->connection == SANE_EPSON_SCSI) in receive()
942 n = sanei_epson_scsi_read (s->fd, buf, buf_size, status); in receive()
944 else if (s->hw->connection == SANE_EPSON_PIO) in receive()
946 if (buf_size == (n = sanei_pio_read (s->fd, buf, (size_t) buf_size))) in receive()
951 else if (s->hw->connection == SANE_EPSON_USB) in receive()
955 *status = sanei_usb_read_bulk (s->fd, (SANE_Byte *) buf, (size_t *) & n); in receive()
1093 if (0 == strncmp (model, "ES-9000H", strlen ("ES-9000H")) in fix_up_extended_status_reply()
1094 || 0 == strncmp (model, "GT-30000", strlen ("GT-30000"))) in fix_up_extended_status_reply()
1121 #define set_focus_position(s,v) set_cmd( s,(s)->hw->cmd->set_focus_position,v)
1122 #define set_color_mode(s,v) set_cmd( s,(s)->hw->cmd->set_color_mode,v)
1123 #define set_data_format(s,v) set_cmd( s,(s)->hw->cmd->set_data_format, v)
1124 #define set_halftoning(s,v) set_cmd( s,(s)->hw->cmd->set_halftoning, v)
1125 #define set_gamma(s,v) set_cmd( s,(s)->hw->cmd->set_gamma, v)
1126 #define set_color_correction(s,v) set_cmd( s,(s)->hw->cmd->set_color_correction, v)
1127 #define set_lcount(s,v) set_cmd( s,(s)->hw->cmd->set_lcount, v)
1128 #define set_bright(s,v) set_cmd( s,(s)->hw->cmd->set_bright, v)
1129 #define mirror_image(s,v) set_cmd( s,(s)->hw->cmd->mirror_image, v)
1130 #define set_speed(s,v) set_cmd( s,(s)->hw->cmd->set_speed, v)
1131 #define set_outline_emphasis(s,v) set_cmd( s,(s)->hw->cmd->set_outline_emphasis, v)
1132 #define control_auto_area_segmentation(s,v) set_cmd( s,(s)->hw->cmd->control_auto_area_segmenta…
1133 #define set_film_type(s,v) set_cmd( s,(s)->hw->cmd->set_film_type, v)
1134 #define set_exposure_time(s,v) set_cmd( s,(s)->hw->cmd->set_exposure_time, v)
1135 #define set_bay(s,v) set_cmd( s,(s)->hw->cmd->set_bay, v)
1136 #define set_threshold(s,v) set_cmd( s,(s)->hw->cmd->set_threshold, v)
1137 #define control_extension(s,v) set_cmd( s,(s)->hw->cmd->control_an_extension, v)
1139 /*#define (s,v) set_cmd( s,(s)->hw->cmd->, v) */
1148 if (!s->hw->cmd->set_zoom) in set_zoom()
1152 cmd[1] = s->hw->cmd->set_zoom; in set_zoom()
1176 if (!s->hw->cmd->set_resolution) in set_resolution()
1180 params[1] = s->hw->cmd->set_resolution; in set_resolution()
1214 if (!s->hw->cmd->set_scan_area) in set_scan_area()
1225 params[1] = s->hw->cmd->set_scan_area; in set_scan_area()
1258 u_char cmd = s->hw->cmd->set_color_correction_coefficients; in set_color_correction_coefficients()
1274 cct[0] = s->val[OPT_CCT_1].w; in set_color_correction_coefficients()
1275 cct[1] = s->val[OPT_CCT_2].w; in set_color_correction_coefficients()
1276 cct[2] = s->val[OPT_CCT_3].w; in set_color_correction_coefficients()
1277 cct[3] = s->val[OPT_CCT_4].w; in set_color_correction_coefficients()
1278 cct[4] = s->val[OPT_CCT_5].w; in set_color_correction_coefficients()
1279 cct[5] = s->val[OPT_CCT_6].w; in set_color_correction_coefficients()
1280 cct[6] = s->val[OPT_CCT_7].w; in set_color_correction_coefficients()
1281 cct[7] = s->val[OPT_CCT_8].w; in set_color_correction_coefficients()
1282 cct[8] = s->val[OPT_CCT_9].w; in set_color_correction_coefficients()
1305 u_char cmd = s->hw->cmd->set_gamma_table; in set_gamma_table()
1341 sprintf (newValue, " %02x", s->gamma_table[c][i + j]); in set_gamma_table()
1357 * supplied gamma function. This is *not* just 255-gamma - in set_gamma_table()
1364 if (s->invert_image) in set_gamma_table()
1368 gamma[n + 1] = 255 - s->gamma_table[table][255 - n]; in set_gamma_table()
1375 gamma[n + 1] = s->gamma_table[table][n]; in set_gamma_table()
1470 * is reported as a warning (only visible if debug level is set to 10 or greater) -
1482 u_char cmd = s->hw->cmd->request_extended_status; in check_ext_status()
1503 buf = &head->buf[0]; in check_ext_status()
1517 if (s->hw->ADF && s->hw->use_extension && s->hw->cmd->feed) in check_ext_status()
1519 fix_up_extended_status_reply (s->hw->sane.model, buf); in check_ext_status()
1524 if (0 == strcmp ("ES-9000H", s->hw->sane.model) in check_ext_status()
1525 || 0 == strcmp ("GT-30000", s->hw->sane.model)) in check_ext_status()
1534 if (w < s->val[OPT_BR_X].w) in check_ext_status()
1535 s->val[OPT_BR_X].w = w; in check_ext_status()
1536 if (h < s->val[OPT_BR_Y].w) in check_ext_status()
1537 s->val[OPT_BR_Y].w = h; in check_ext_status()
1581 if (s->hw->devtype == 3 && s->hw->use_extension == 0) in check_ext_status()
1585 *max_x = (int) (w * s->hw->dpi_range.max); in check_ext_status()
1586 *max_y = (int) (h * s->hw->dpi_range.max); in check_ext_status()
1610 if (!s->hw->cmd->initialize_scanner) in reset()
1614 param[1] = s->hw->cmd->initialize_scanner; in reset()
1616 if (s->fd == -1) in reset()
1646 DBG (5, "close_scanner(fd = %d)\n", s->fd); in close_scanner()
1648 if (s->fd == -1) in close_scanner()
1659 param[1] = s->hw->cmd->request_status; in close_scanner()
1681 if (s->hw->connection == SANE_EPSON_SCSI) in close_scanner()
1683 sanei_scsi_close (s->fd); in close_scanner()
1685 else if (s->hw->connection == SANE_EPSON_PIO) in close_scanner()
1687 sanei_pio_close (s->fd); in close_scanner()
1689 else if (s->hw->connection == SANE_EPSON_USB) in close_scanner()
1691 sanei_usb_close (s->fd); in close_scanner()
1694 s->fd = -1; in close_scanner()
1712 if (s->fd != -1) in open_scanner()
1714 DBG (5, "scanner is already open: fd = %d\n", s->fd); in open_scanner()
1722 if ((s->hw->connection != SANE_EPSON_PIO) in open_scanner()
1723 && (access (s->hw->sane.name, R_OK | W_OK) != 0)) in open_scanner()
1725 DBG (1, "sane_start: access(%s, R_OK | W_OK) failed\n", s->hw->sane.name); in open_scanner()
1732 if (s->hw->connection == SANE_EPSON_SCSI) in open_scanner()
1734 status = sanei_scsi_open (s->hw->sane.name, &s->fd, in open_scanner()
1738 DBG (1, "sane_start: %s open failed: %s\n", s->hw->sane.name, in open_scanner()
1743 else if (s->hw->connection == SANE_EPSON_PIO) in open_scanner()
1745 status = sanei_pio_open (s->hw->sane.name, &s->fd); in open_scanner()
1748 DBG (1, "sane_start: %s open failed: %s\n", s->hw->sane.name, in open_scanner()
1753 else if (s->hw->connection == SANE_EPSON_USB) in open_scanner()
1755 status = sanei_usb_open (s->hw->sane.name, &s->fd); in open_scanner()
1773 u_char cmd = s->hw->cmd->feed; in feed()
1810 u_char cmd = s->hw->cmd->eject; in eject()
1818 if (s->fd == -1) in eject()
1867 head = &(hdrunion->hdr); in command()
1873 /* this is necessary for the GT-8000. I don't know why, but in command()
1884 if (s->hw->connection == SANE_EPSON_SCSI) in command()
1889 else if (s->hw->connection == SANE_EPSON_USB) in command()
1904 DBG (4, "code %02x\n", (int) head->code); in command()
1906 switch (head->code) in command()
1916 if (s->hw->connection == SANE_EPSON_SCSI) in command()
1920 else if (s->hw->connection == SANE_EPSON_USB) in command()
1933 DBG (4, "status %02x\n", (int) head->status); in command()
1935 count = head->count2 * 255 + head->count1; in command()
1948 head = &(hdrunion->hdr); in command()
1950 buf = head->buf; in command()
1959 if (0 == head->code) in command()
1961 else if (cmd[cmd_size - 1] == head->code) in command()
1964 DBG (2, "Illegal response of scanner for command: %02x\n", head->code); in command()
1992 for (dev = first_dev; dev; dev = dev->next) in attach()
1994 if (strcmp (dev->sane.name, dev_name) == 0) in attach()
2034 s->hw = dev; in attach()
2035 s->hw->sane.name = NULL; in attach()
2036 s->hw->sane.type = "flatbed scanner"; in attach()
2037 s->hw->sane.vendor = "Epson"; in attach()
2038 s->hw->sane.model = NULL; in attach()
2039 s->hw->optical_res = 0; /* just to have it initialized */ in attach()
2040 s->hw->color_shuffle = SANE_FALSE; in attach()
2041 s->hw->extension = SANE_FALSE; in attach()
2042 s->hw->use_extension = SANE_FALSE; in attach()
2044 s->hw->need_color_reorder = SANE_FALSE; in attach()
2045 s->hw->need_double_vertical = SANE_FALSE; in attach()
2047 s->hw->cmd = &epson_cmd[EPSON_LEVEL_DEFAULT]; /* default function level */ in attach()
2048 s->hw->connection = type; in attach()
2052 s->hw->last_res = 0; in attach()
2053 s->hw->last_res_preview = 0; /* set resolution to safe values */ in attach()
2063 if (s->hw->connection == SANE_EPSON_SCSI) in attach()
2069 sanei_scsi_open (dev_name, &s->fd, sanei_epson_scsi_sense_handler, in attach()
2078 status = sanei_epson_scsi_inquiry (s->fd, 0, buf, &buf_size); in attach()
2109 else if (s->hw->connection == SANE_EPSON_PIO) in attach()
2111 if (SANE_STATUS_GOOD != (status = sanei_pio_open (dev_name, &s->fd))) in attach()
2113 DBG (1, "Cannot open %s as a parallel-port device: %s\n", in attach()
2119 else if (s->hw->connection == SANE_EPSON_USB) in attach()
2141 return SANE_STATUS_INVAL; /* return - the attach_one_usb() in attach()
2145 status = sanei_usb_open (dev_name, &s->fd); in attach()
2157 if (sanei_usb_get_vendor_product (s->fd, &vendor, &product) == in attach()
2171 sanei_usb_close (s->fd); in attach()
2172 s->fd = -1; in attach()
2195 sanei_usb_close (s->fd); in attach()
2196 s->fd = -1; in attach()
2205 "Cannot use IOCTL interface to verify that device is a scanner - will continue\n"); in attach()
2219 if (s->hw->cmd->request_identity != 0) in attach()
2232 if (s->hw->cmd->request_identity2 != 0) in attach()
2257 s->hw->maxDepth = 16; in attach()
2265 s->hw->maxDepth = 14; in attach()
2272 s->hw->maxDepth = 12; in attach()
2279 s->hw->maxDepth = 8; in attach()
2284 DBG (1, "Max. supported color depth = %d\n", s->hw->maxDepth); in attach()
2293 if (request_focus_position (s, &s->currentFocusPosition) == in attach()
2297 s->hw->focusSupport = SANE_TRUE; in attach()
2298 s->opt[OPT_FOCUS].cap &= ~SANE_CAP_INACTIVE; in attach()
2301 if (s->currentFocusPosition < 0x4C) in attach()
2304 s->val[OPT_FOCUS].w = 0; in attach()
2309 s->val[OPT_FOCUS].w = 1; in attach()
2316 s->hw->focusSupport = SANE_FALSE; in attach()
2317 s->opt[OPT_FOCUS].cap |= SANE_CAP_INACTIVE; in attach()
2318 s->val[OPT_FOCUS].w = 0; /* on glass - just in case */ in attach()
2327 dev->x_range = &dev->fbf_x_range; in attach()
2328 dev->y_range = &dev->fbf_y_range; in attach()
2337 if ((dev->x_range->max - dev->x_range->min) > in attach()
2338 (dev->y_range->max - dev->y_range->min)) in attach()
2340 dev->y_range->max += (dev->y_range->max - dev->y_range->min); in attach()
2341 dev->need_double_vertical = SANE_TRUE; in attach()
2342 dev->need_color_reorder = SANE_TRUE; in attach()
2356 if (s->hw->cmd->request_extended_status != 0) in attach()
2363 params[1] = s->hw->cmd->request_extended_status; in attach()
2368 dev->sane.model = strdup ("Unknown model"); in attach()
2373 buf = &head->buf[0]; in attach()
2381 s->hw->devtype = buf[11] >> 6; in attach()
2384 * Get the device name and copy it to dev->sane.model. in attach()
2409 dev->sane.model = (char *) memcpy (str, device_name, len); in attach()
2415 if (dev->extension && (buf[1] & EXT_STATUS_IST)) in attach()
2419 /* the GT-30000 does not report the ADF scan area */ in attach()
2420 if ((strcmp (dev->sane.model, "GT-30000") == 0) || in attach()
2421 (strcmp (dev->sane.model, "ES-9000H") == 0)) in attach()
2425 dev->duplexSupport = (buf[0] & 0x10) != 0; in attach()
2426 if (dev->duplexSupport) in attach()
2439 dev->x_range = &dev->adf_x_range; in attach()
2440 dev->y_range = &dev->adf_y_range; in attach()
2443 dev->adf_x_range.min = 0; in attach()
2444 dev->adf_x_range.max = in attach()
2445 SANE_FIX ((buf[3] << 8 | buf[2]) * 25.4 / dev->dpi_range.max); in attach()
2446 dev->adf_x_range.quant = 0; in attach()
2448 dev->adf_max_x = buf[3] << 8 | buf[2]; in attach()
2450 dev->adf_y_range.min = 0; in attach()
2451 dev->adf_y_range.max = in attach()
2452 SANE_FIX ((buf[5] << 8 | buf[4]) * 25.4 / dev->dpi_range.max); in attach()
2453 dev->adf_y_range.quant = 0; in attach()
2455 dev->adf_max_y = buf[5] << 8 | buf[4]; in attach()
2458 SANE_UNFIX (dev->adf_x_range.min), in attach()
2459 SANE_UNFIX (dev->adf_y_range.min), in attach()
2460 SANE_UNFIX (dev->adf_x_range.max), in attach()
2461 SANE_UNFIX (dev->adf_y_range.max)); in attach()
2465 dev->ADF = SANE_TRUE; in attach()
2473 if (dev->extension && (buf[6] & EXT_STATUS_IST)) in attach()
2480 dev->x_range = &dev->tpu_x_range; in attach()
2481 dev->y_range = &dev->tpu_y_range; in attach()
2484 dev->tpu_x_range.min = 0; in attach()
2485 dev->tpu_x_range.max = in attach()
2486 SANE_FIX ((buf[8] << 8 | buf[7]) * 25.4 / dev->dpi_range.max); in attach()
2487 dev->tpu_x_range.quant = 0; in attach()
2489 dev->tpu_y_range.min = 0; in attach()
2490 dev->tpu_y_range.max = in attach()
2491 SANE_FIX ((buf[10] << 8 | buf[9]) * 25.4 / dev->dpi_range.max); in attach()
2492 dev->tpu_y_range.quant = 0; in attach()
2495 * Check for Perfection 4990 photo/GT-X800 scanner. in attach()
2502 if (strncmp((char *) buf + 0x1A,"GT-X800",7) == 0) in attach()
2504 dev->tpu_x_range.max = (dev->tpu_x_range.max/32)*48; in attach()
2505 dev->tpu_y_range.max = (dev->tpu_y_range.max/32)*48; in attach()
2506 DBG (5, "dpi_range.max %x \n", dev->dpi_range.max); in attach()
2510 SANE_UNFIX (dev->tpu_x_range.min), in attach()
2511 SANE_UNFIX (dev->tpu_y_range.min), in attach()
2512 SANE_UNFIX (dev->tpu_x_range.max), in attach()
2513 SANE_UNFIX (dev->tpu_y_range.max)); in attach()
2517 dev->TPU = SANE_TRUE; in attach()
2521 * Get the device name and copy it to dev->sane.model. in attach()
2547 dev->sane.model = (char *) memcpy (str, device_name, len); in attach()
2553 dev->sane.model = strdup ("EPSON Scanner"); in attach()
2558 DBG (1, "scanner model: %s\n", dev->sane.model); in attach()
2561 s->hw->need_reset_on_source_change = SANE_FALSE; in attach()
2563 if (strcmp ("ES-9000H", dev->sane.model) == 0 || in attach()
2564 strcmp ("GT-30000", dev->sane.model) == 0) in attach()
2566 s->hw->cmd->set_focus_position = 0; in attach()
2567 s->hw->cmd->feed = 0x19; in attach()
2569 else if (strcmp ("GT-8200", dev->sane.model) == 0 || in attach()
2570 strcmp ("Perfection1650", dev->sane.model) == 0 || in attach()
2571 strcmp ("Perfection1640", dev->sane.model) == 0 || in attach()
2572 strcmp ("GT-8700", dev->sane.model) == 0) in attach()
2574 s->hw->cmd->feed = 0; in attach()
2575 s->hw->cmd->set_focus_position = 0; in attach()
2576 s->hw->need_reset_on_source_change = SANE_TRUE; in attach()
2584 qf_params[XtNumber (qf_params) - 1].tl_x = dev->x_range->min; in attach()
2585 qf_params[XtNumber (qf_params) - 1].tl_y = dev->y_range->min; in attach()
2586 qf_params[XtNumber (qf_params) - 1].br_x = dev->x_range->max; in attach()
2587 qf_params[XtNumber (qf_params) - 1].br_y = dev->y_range->max; in attach()
2594 dev->sane.name = strcpy (str, dev_name); in attach()
2603 dev->next = first_dev; in attach()
2696 sanei_epson_usb_product_ids[numIds - 1] = product; in sane_init()
2715 scanner structure - which we don't have at this time. So I have in sane_init()
2716 to come up with something :-) */ in sane_init()
2734 next = dev->next; in sane_exit()
2735 free ((void *) dev->sane.name); in sane_exit()
2736 free ((void *) dev->sane.model); in sane_exit()
2772 for (dev = first_dev; i < num_devices; dev = dev->next) in sane_get_devices()
2774 devlist[i++] = &dev->sane; in sane_get_devices()
2799 s->opt[i].size = sizeof (SANE_Word); in init_options()
2800 s->opt[i].cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; in init_options()
2803 s->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS; in init_options()
2804 s->opt[OPT_NUM_OPTS].desc = SANE_DESC_NUM_OPTIONS; in init_options()
2805 s->opt[OPT_NUM_OPTS].type = SANE_TYPE_INT; in init_options()
2806 s->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT; in init_options()
2807 s->val[OPT_NUM_OPTS].w = NUM_OPTIONS; in init_options()
2811 s->opt[OPT_MODE_GROUP].title = SANE_I18N ("Scan Mode"); in init_options()
2812 s->opt[OPT_MODE_GROUP].desc = ""; in init_options()
2813 s->opt[OPT_MODE_GROUP].type = SANE_TYPE_GROUP; in init_options()
2814 s->opt[OPT_MODE_GROUP].cap = 0; in init_options()
2817 s->opt[OPT_MODE].name = SANE_NAME_SCAN_MODE; in init_options()
2818 s->opt[OPT_MODE].title = SANE_TITLE_SCAN_MODE; in init_options()
2819 s->opt[OPT_MODE].desc = SANE_DESC_SCAN_MODE; in init_options()
2820 s->opt[OPT_MODE].type = SANE_TYPE_STRING; in init_options()
2821 s->opt[OPT_MODE].size = max_string_size (mode_list); in init_options()
2822 s->opt[OPT_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
2823 s->opt[OPT_MODE].constraint.string_list = mode_list; in init_options()
2824 s->val[OPT_MODE].w = 0; /* Binary */ in init_options()
2827 s->opt[OPT_BIT_DEPTH].name = SANE_NAME_BIT_DEPTH; in init_options()
2828 s->opt[OPT_BIT_DEPTH].title = SANE_TITLE_BIT_DEPTH; in init_options()
2829 s->opt[OPT_BIT_DEPTH].desc = SANE_DESC_BIT_DEPTH; in init_options()
2830 s->opt[OPT_BIT_DEPTH].type = SANE_TYPE_INT; in init_options()
2831 s->opt[OPT_BIT_DEPTH].unit = SANE_UNIT_NONE; in init_options()
2832 s->opt[OPT_BIT_DEPTH].constraint_type = SANE_CONSTRAINT_WORD_LIST; in init_options()
2833 s->opt[OPT_BIT_DEPTH].constraint.word_list = bitDepthList; in init_options()
2834 s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE; in init_options()
2835 s->val[OPT_BIT_DEPTH].w = bitDepthList[1]; /* the first "real" element is the default */ in init_options()
2837 if (bitDepthList[0] == 1) /* only one element in the list -> hide the option */ in init_options()
2838 s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE; in init_options()
2841 s->opt[OPT_HALFTONE].name = SANE_NAME_HALFTONE; in init_options()
2842 s->opt[OPT_HALFTONE].title = SANE_TITLE_HALFTONE; in init_options()
2843 s->opt[OPT_HALFTONE].desc = SANE_I18N ("Selects the halftone."); in init_options()
2845 s->opt[OPT_HALFTONE].type = SANE_TYPE_STRING; in init_options()
2846 s->opt[OPT_HALFTONE].size = max_string_size (halftone_list_7); in init_options()
2847 s->opt[OPT_HALFTONE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
2849 if (s->hw->level >= 7) in init_options()
2850 s->opt[OPT_HALFTONE].constraint.string_list = halftone_list_7; in init_options()
2851 else if (s->hw->level >= 4) in init_options()
2852 s->opt[OPT_HALFTONE].constraint.string_list = halftone_list_4; in init_options()
2854 s->opt[OPT_HALFTONE].constraint.string_list = halftone_list; in init_options()
2856 s->val[OPT_HALFTONE].w = 1; /* Halftone A */ in init_options()
2858 if (!s->hw->cmd->set_halftoning) in init_options()
2860 s->opt[OPT_HALFTONE].cap |= SANE_CAP_INACTIVE; in init_options()
2864 s->opt[OPT_DROPOUT].name = "dropout"; in init_options()
2865 s->opt[OPT_DROPOUT].title = SANE_I18N ("Dropout"); in init_options()
2866 s->opt[OPT_DROPOUT].desc = SANE_I18N ("Selects the dropout."); in init_options()
2868 s->opt[OPT_DROPOUT].type = SANE_TYPE_STRING; in init_options()
2869 s->opt[OPT_DROPOUT].size = max_string_size (dropout_list); in init_options()
2870 s->opt[OPT_DROPOUT].cap |= SANE_CAP_ADVANCED; in init_options()
2871 s->opt[OPT_DROPOUT].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
2872 s->opt[OPT_DROPOUT].constraint.string_list = dropout_list; in init_options()
2873 s->val[OPT_DROPOUT].w = 0; /* None */ in init_options()
2876 s->opt[OPT_BRIGHTNESS].name = SANE_NAME_BRIGHTNESS; in init_options()
2877 s->opt[OPT_BRIGHTNESS].title = SANE_TITLE_BRIGHTNESS; in init_options()
2878 s->opt[OPT_BRIGHTNESS].desc = SANE_I18N ("Selects the brightness."); in init_options()
2880 s->opt[OPT_BRIGHTNESS].type = SANE_TYPE_INT; in init_options()
2881 s->opt[OPT_BRIGHTNESS].unit = SANE_UNIT_NONE; in init_options()
2882 s->opt[OPT_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2883 s->opt[OPT_BRIGHTNESS].constraint.range = &s->hw->cmd->bright_range; in init_options()
2884 s->val[OPT_BRIGHTNESS].w = 0; /* Normal */ in init_options()
2886 if (!s->hw->cmd->set_bright) in init_options()
2888 s->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE; in init_options()
2892 s->opt[OPT_SHARPNESS].name = "sharpness"; in init_options()
2893 s->opt[OPT_SHARPNESS].title = SANE_I18N ("Sharpness"); in init_options()
2894 s->opt[OPT_SHARPNESS].desc = ""; in init_options()
2896 s->opt[OPT_SHARPNESS].type = SANE_TYPE_INT; in init_options()
2897 s->opt[OPT_SHARPNESS].unit = SANE_UNIT_NONE; in init_options()
2898 s->opt[OPT_SHARPNESS].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2899 s->opt[OPT_SHARPNESS].constraint.range = &outline_emphasis_range; in init_options()
2900 s->val[OPT_SHARPNESS].w = 0; /* Normal */ in init_options()
2902 if (!s->hw->cmd->set_outline_emphasis) in init_options()
2904 s->opt[OPT_SHARPNESS].cap |= SANE_CAP_INACTIVE; in init_options()
2909 s->opt[OPT_GAMMA_CORRECTION].name = SANE_NAME_GAMMA_CORRECTION; in init_options()
2910 s->opt[OPT_GAMMA_CORRECTION].title = SANE_TITLE_GAMMA_CORRECTION; in init_options()
2911 s->opt[OPT_GAMMA_CORRECTION].desc = SANE_DESC_GAMMA_CORRECTION; in init_options()
2913 s->opt[OPT_GAMMA_CORRECTION].type = SANE_TYPE_STRING; in init_options()
2914 s->opt[OPT_GAMMA_CORRECTION].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
2916 * special handling for D1 function level - at this time I'm not in init_options()
2918 * behave the same way. This has to be confirmed with the next D-level in init_options()
2921 if (s->hw->cmd->level[0] == 'D') in init_options()
2923 s->opt[OPT_GAMMA_CORRECTION].size = max_string_size (gamma_list_d); in init_options()
2924 s->opt[OPT_GAMMA_CORRECTION].constraint.string_list = gamma_list_d; in init_options()
2925 s->val[OPT_GAMMA_CORRECTION].w = 1; /* Default */ in init_options()
2931 s->opt[OPT_GAMMA_CORRECTION].size = max_string_size (gamma_list_ab); in init_options()
2932 s->opt[OPT_GAMMA_CORRECTION].constraint.string_list = gamma_list_ab; in init_options()
2933 s->val[OPT_GAMMA_CORRECTION].w = 0; /* Default */ in init_options()
2938 if (!s->hw->cmd->set_gamma) in init_options()
2940 s->opt[OPT_GAMMA_CORRECTION].cap |= SANE_CAP_INACTIVE; in init_options()
2946 s->opt[ OPT_GAMMA_VECTOR].name = SANE_NAME_GAMMA_VECTOR; in init_options()
2947 s->opt[ OPT_GAMMA_VECTOR].title = SANE_TITLE_GAMMA_VECTOR; in init_options()
2948 s->opt[ OPT_GAMMA_VECTOR].desc = SANE_DESC_GAMMA_VECTOR; in init_options()
2950 s->opt[ OPT_GAMMA_VECTOR].type = SANE_TYPE_INT; in init_options()
2951 s->opt[ OPT_GAMMA_VECTOR].unit = SANE_UNIT_NONE; in init_options()
2952 s->opt[ OPT_GAMMA_VECTOR].size = 256 * sizeof (SANE_Word); in init_options()
2953 s->opt[ OPT_GAMMA_VECTOR].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2954 s->opt[ OPT_GAMMA_VECTOR].constraint.range = &u8_range; in init_options()
2955 s->val[ OPT_GAMMA_VECTOR].wa = &s->gamma_table [ 0] [ 0]; in init_options()
2960 s->opt[OPT_GAMMA_VECTOR_R].name = SANE_NAME_GAMMA_VECTOR_R; in init_options()
2961 s->opt[OPT_GAMMA_VECTOR_R].title = SANE_TITLE_GAMMA_VECTOR_R; in init_options()
2962 s->opt[OPT_GAMMA_VECTOR_R].desc = SANE_DESC_GAMMA_VECTOR_R; in init_options()
2964 s->opt[OPT_GAMMA_VECTOR_R].type = SANE_TYPE_INT; in init_options()
2965 s->opt[OPT_GAMMA_VECTOR_R].unit = SANE_UNIT_NONE; in init_options()
2966 s->opt[OPT_GAMMA_VECTOR_R].size = 256 * sizeof (SANE_Word); in init_options()
2967 s->opt[OPT_GAMMA_VECTOR_R].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2968 s->opt[OPT_GAMMA_VECTOR_R].constraint.range = &u8_range; in init_options()
2969 s->val[OPT_GAMMA_VECTOR_R].wa = &s->gamma_table[0][0]; in init_options()
2973 s->opt[OPT_GAMMA_VECTOR_G].name = SANE_NAME_GAMMA_VECTOR_G; in init_options()
2974 s->opt[OPT_GAMMA_VECTOR_G].title = SANE_TITLE_GAMMA_VECTOR_G; in init_options()
2975 s->opt[OPT_GAMMA_VECTOR_G].desc = SANE_DESC_GAMMA_VECTOR_G; in init_options()
2977 s->opt[OPT_GAMMA_VECTOR_G].type = SANE_TYPE_INT; in init_options()
2978 s->opt[OPT_GAMMA_VECTOR_G].unit = SANE_UNIT_NONE; in init_options()
2979 s->opt[OPT_GAMMA_VECTOR_G].size = 256 * sizeof (SANE_Word); in init_options()
2980 s->opt[OPT_GAMMA_VECTOR_G].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2981 s->opt[OPT_GAMMA_VECTOR_G].constraint.range = &u8_range; in init_options()
2982 s->val[OPT_GAMMA_VECTOR_G].wa = &s->gamma_table[1][0]; in init_options()
2986 s->opt[OPT_GAMMA_VECTOR_B].name = SANE_NAME_GAMMA_VECTOR_B; in init_options()
2987 s->opt[OPT_GAMMA_VECTOR_B].title = SANE_TITLE_GAMMA_VECTOR_B; in init_options()
2988 s->opt[OPT_GAMMA_VECTOR_B].desc = SANE_DESC_GAMMA_VECTOR_B; in init_options()
2990 s->opt[OPT_GAMMA_VECTOR_B].type = SANE_TYPE_INT; in init_options()
2991 s->opt[OPT_GAMMA_VECTOR_B].unit = SANE_UNIT_NONE; in init_options()
2992 s->opt[OPT_GAMMA_VECTOR_B].size = 256 * sizeof (SANE_Word); in init_options()
2993 s->opt[OPT_GAMMA_VECTOR_B].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
2994 s->opt[OPT_GAMMA_VECTOR_B].constraint.range = &u8_range; in init_options()
2995 s->val[OPT_GAMMA_VECTOR_B].wa = &s->gamma_table[2][0]; in init_options()
2997 if (s->hw->cmd->set_gamma_table && in init_options()
2998 gamma_userdefined[s->val[OPT_GAMMA_CORRECTION].w] == SANE_TRUE) in init_options()
3000 /* s->opt[ OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE; */ in init_options()
3001 s->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE; in init_options()
3002 s->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE; in init_options()
3003 s->opt[OPT_GAMMA_VECTOR_B].cap &= ~SANE_CAP_INACTIVE; in init_options()
3007 /* s->opt[ OPT_GAMMA_VECTOR].cap |= SANE_CAP_INACTIVE; */ in init_options()
3008 s->opt[OPT_GAMMA_VECTOR_R].cap |= SANE_CAP_INACTIVE; in init_options()
3009 s->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE; in init_options()
3010 s->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE; in init_options()
3014 memset (&s->gamma_table[0], 0, 256 * sizeof (SANE_Word)); in init_options()
3015 memset (&s->gamma_table[1], 0, 256 * sizeof (SANE_Word)); in init_options()
3016 memset (&s->gamma_table[2], 0, 256 * sizeof (SANE_Word)); in init_options()
3017 /* memset(&s->gamma_table[3], 0, 256 * sizeof(SANE_Word)); */ in init_options()
3020 s->gamma_table[0][i] = i; in init_options()
3021 s->gamma_table[1][i] = i; in init_options()
3022 s->gamma_table[2][i] = i; in init_options()
3023 /* s->gamma_table[3][i] = i; */ in init_options()
3028 s->opt[OPT_COLOR_CORRECTION].name = "color-correction"; in init_options()
3029 s->opt[OPT_COLOR_CORRECTION].title = SANE_I18N ("Color correction"); in init_options()
3030 s->opt[OPT_COLOR_CORRECTION].desc = in init_options()
3034 s->opt[OPT_COLOR_CORRECTION].type = SANE_TYPE_STRING; in init_options()
3035 s->opt[OPT_COLOR_CORRECTION].size = 32; in init_options()
3036 s->opt[OPT_COLOR_CORRECTION].cap |= SANE_CAP_ADVANCED; in init_options()
3037 s->opt[OPT_COLOR_CORRECTION].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3038 s->opt[OPT_COLOR_CORRECTION].constraint.string_list = color_list; in init_options()
3039 s->val[OPT_COLOR_CORRECTION].w = 5; /* scanner default: CRT monitors */ in init_options()
3041 if (!s->hw->cmd->set_color_correction) in init_options()
3043 s->opt[OPT_COLOR_CORRECTION].cap |= SANE_CAP_INACTIVE; in init_options()
3047 s->opt[OPT_RESOLUTION].name = SANE_NAME_SCAN_RESOLUTION; in init_options()
3048 s->opt[OPT_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION; in init_options()
3049 s->opt[OPT_RESOLUTION].desc = SANE_DESC_SCAN_RESOLUTION; in init_options()
3051 s->opt[OPT_RESOLUTION].type = SANE_TYPE_INT; in init_options()
3052 s->opt[OPT_RESOLUTION].unit = SANE_UNIT_DPI; in init_options()
3053 s->opt[OPT_RESOLUTION].constraint_type = SANE_CONSTRAINT_WORD_LIST; in init_options()
3054 s->opt[OPT_RESOLUTION].constraint.word_list = s->hw->resolution_list; in init_options()
3055 s->val[OPT_RESOLUTION].w = s->hw->dpi_range.min; in init_options()
3058 s->opt[OPT_THRESHOLD].name = SANE_NAME_THRESHOLD; in init_options()
3059 s->opt[OPT_THRESHOLD].title = SANE_TITLE_THRESHOLD; in init_options()
3060 s->opt[OPT_THRESHOLD].desc = SANE_DESC_THRESHOLD; in init_options()
3062 s->opt[OPT_THRESHOLD].type = SANE_TYPE_INT; in init_options()
3063 s->opt[OPT_THRESHOLD].unit = SANE_UNIT_NONE; in init_options()
3064 s->opt[OPT_THRESHOLD].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3065 s->opt[OPT_THRESHOLD].constraint.range = &u8_range; in init_options()
3066 s->val[OPT_THRESHOLD].w = 0x80; in init_options()
3068 if (!s->hw->cmd->set_threshold) in init_options()
3070 s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE; in init_options()
3073 s->opt[OPT_CCT_GROUP].title = SANE_I18N ("Color correction coefficients"); in init_options()
3074 s->opt[OPT_CCT_GROUP].desc = SANE_I18N ("Matrix multiplication of RGB"); in init_options()
3075 s->opt[OPT_CCT_GROUP].type = SANE_TYPE_GROUP; in init_options()
3076 s->opt[OPT_CCT_GROUP].cap = SANE_CAP_ADVANCED; in init_options()
3080 s->opt[OPT_CCT_1].name = "cct-1"; in init_options()
3081 s->opt[OPT_CCT_2].name = "cct-2"; in init_options()
3082 s->opt[OPT_CCT_3].name = "cct-3"; in init_options()
3083 s->opt[OPT_CCT_4].name = "cct-4"; in init_options()
3084 s->opt[OPT_CCT_5].name = "cct-5"; in init_options()
3085 s->opt[OPT_CCT_6].name = "cct-6"; in init_options()
3086 s->opt[OPT_CCT_7].name = "cct-7"; in init_options()
3087 s->opt[OPT_CCT_8].name = "cct-8"; in init_options()
3088 s->opt[OPT_CCT_9].name = "cct-9"; in init_options()
3090 s->opt[OPT_CCT_1].title = SANE_I18N ("Green"); in init_options()
3091 s->opt[OPT_CCT_2].title = SANE_I18N ("Shift green to red"); in init_options()
3092 s->opt[OPT_CCT_3].title = SANE_I18N ("Shift green to blue"); in init_options()
3093 s->opt[OPT_CCT_4].title = SANE_I18N ("Shift red to green"); in init_options()
3094 s->opt[OPT_CCT_5].title = SANE_I18N ("Red"); in init_options()
3095 s->opt[OPT_CCT_6].title = SANE_I18N ("Shift red to blue"); in init_options()
3096 s->opt[OPT_CCT_7].title = SANE_I18N ("Shift blue to green"); in init_options()
3097 s->opt[OPT_CCT_8].title = SANE_I18N ("Shift blue to red"); in init_options()
3098 s->opt[OPT_CCT_9].title = SANE_I18N ("Blue"); in init_options()
3100 s->opt[OPT_CCT_1].desc = SANE_I18N ("Controls green level"); in init_options()
3101 s->opt[OPT_CCT_2].desc = SANE_I18N ("Adds to red based on green level"); in init_options()
3102 s->opt[OPT_CCT_3].desc = SANE_I18N ("Adds to blue based on green level"); in init_options()
3103 s->opt[OPT_CCT_4].desc = SANE_I18N ("Adds to green based on red level"); in init_options()
3104 s->opt[OPT_CCT_5].desc = SANE_I18N ("Controls red level"); in init_options()
3105 s->opt[OPT_CCT_6].desc = SANE_I18N ("Adds to blue based on red level"); in init_options()
3106 s->opt[OPT_CCT_7].desc = SANE_I18N ("Adds to green based on blue level"); in init_options()
3107 s->opt[OPT_CCT_8].desc = SANE_I18N ("Adds to red based on blue level"); in init_options()
3108 s->opt[OPT_CCT_9].desc = SANE_I18N ("Controls blue level"); in init_options()
3110 s->opt[OPT_CCT_1].type = SANE_TYPE_INT; in init_options()
3111 s->opt[OPT_CCT_2].type = SANE_TYPE_INT; in init_options()
3112 s->opt[OPT_CCT_3].type = SANE_TYPE_INT; in init_options()
3113 s->opt[OPT_CCT_4].type = SANE_TYPE_INT; in init_options()
3114 s->opt[OPT_CCT_5].type = SANE_TYPE_INT; in init_options()
3115 s->opt[OPT_CCT_6].type = SANE_TYPE_INT; in init_options()
3116 s->opt[OPT_CCT_7].type = SANE_TYPE_INT; in init_options()
3117 s->opt[OPT_CCT_8].type = SANE_TYPE_INT; in init_options()
3118 s->opt[OPT_CCT_9].type = SANE_TYPE_INT; in init_options()
3120 s->opt[OPT_CCT_1].cap |= SANE_CAP_ADVANCED; in init_options()
3121 s->opt[OPT_CCT_2].cap |= SANE_CAP_ADVANCED; in init_options()
3122 s->opt[OPT_CCT_3].cap |= SANE_CAP_ADVANCED; in init_options()
3123 s->opt[OPT_CCT_4].cap |= SANE_CAP_ADVANCED; in init_options()
3124 s->opt[OPT_CCT_5].cap |= SANE_CAP_ADVANCED; in init_options()
3125 s->opt[OPT_CCT_6].cap |= SANE_CAP_ADVANCED; in init_options()
3126 s->opt[OPT_CCT_7].cap |= SANE_CAP_ADVANCED; in init_options()
3127 s->opt[OPT_CCT_8].cap |= SANE_CAP_ADVANCED; in init_options()
3128 s->opt[OPT_CCT_9].cap |= SANE_CAP_ADVANCED; in init_options()
3130 s->opt[OPT_CCT_1].cap |= SANE_CAP_INACTIVE; in init_options()
3131 s->opt[OPT_CCT_2].cap |= SANE_CAP_INACTIVE; in init_options()
3132 s->opt[OPT_CCT_3].cap |= SANE_CAP_INACTIVE; in init_options()
3133 s->opt[OPT_CCT_4].cap |= SANE_CAP_INACTIVE; in init_options()
3134 s->opt[OPT_CCT_5].cap |= SANE_CAP_INACTIVE; in init_options()
3135 s->opt[OPT_CCT_6].cap |= SANE_CAP_INACTIVE; in init_options()
3136 s->opt[OPT_CCT_7].cap |= SANE_CAP_INACTIVE; in init_options()
3137 s->opt[OPT_CCT_8].cap |= SANE_CAP_INACTIVE; in init_options()
3138 s->opt[OPT_CCT_9].cap |= SANE_CAP_INACTIVE; in init_options()
3140 s->opt[OPT_CCT_1].unit = SANE_UNIT_NONE; in init_options()
3141 s->opt[OPT_CCT_2].unit = SANE_UNIT_NONE; in init_options()
3142 s->opt[OPT_CCT_3].unit = SANE_UNIT_NONE; in init_options()
3143 s->opt[OPT_CCT_4].unit = SANE_UNIT_NONE; in init_options()
3144 s->opt[OPT_CCT_5].unit = SANE_UNIT_NONE; in init_options()
3145 s->opt[OPT_CCT_6].unit = SANE_UNIT_NONE; in init_options()
3146 s->opt[OPT_CCT_7].unit = SANE_UNIT_NONE; in init_options()
3147 s->opt[OPT_CCT_8].unit = SANE_UNIT_NONE; in init_options()
3148 s->opt[OPT_CCT_9].unit = SANE_UNIT_NONE; in init_options()
3150 s->opt[OPT_CCT_1].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3151 s->opt[OPT_CCT_2].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3152 s->opt[OPT_CCT_3].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3153 s->opt[OPT_CCT_4].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3154 s->opt[OPT_CCT_5].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3155 s->opt[OPT_CCT_6].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3156 s->opt[OPT_CCT_7].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3157 s->opt[OPT_CCT_8].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3158 s->opt[OPT_CCT_9].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3160 s->opt[OPT_CCT_1].constraint.range = &s8_range; in init_options()
3161 s->opt[OPT_CCT_2].constraint.range = &s8_range; in init_options()
3162 s->opt[OPT_CCT_3].constraint.range = &s8_range; in init_options()
3163 s->opt[OPT_CCT_4].constraint.range = &s8_range; in init_options()
3164 s->opt[OPT_CCT_5].constraint.range = &s8_range; in init_options()
3165 s->opt[OPT_CCT_6].constraint.range = &s8_range; in init_options()
3166 s->opt[OPT_CCT_7].constraint.range = &s8_range; in init_options()
3167 s->opt[OPT_CCT_8].constraint.range = &s8_range; in init_options()
3168 s->opt[OPT_CCT_9].constraint.range = &s8_range; in init_options()
3170 s->val[OPT_CCT_1].w = 32; in init_options()
3171 s->val[OPT_CCT_2].w = 0; in init_options()
3172 s->val[OPT_CCT_3].w = 0; in init_options()
3173 s->val[OPT_CCT_4].w = 0; in init_options()
3174 s->val[OPT_CCT_5].w = 32; in init_options()
3175 s->val[OPT_CCT_6].w = 0; in init_options()
3176 s->val[OPT_CCT_7].w = 0; in init_options()
3177 s->val[OPT_CCT_8].w = 0; in init_options()
3178 s->val[OPT_CCT_9].w = 32; in init_options()
3180 if (!s->hw->cmd->set_color_correction_coefficients) in init_options()
3182 s->opt[OPT_CCT_1].cap |= SANE_CAP_INACTIVE; in init_options()
3183 s->opt[OPT_CCT_2].cap |= SANE_CAP_INACTIVE; in init_options()
3184 s->opt[OPT_CCT_3].cap |= SANE_CAP_INACTIVE; in init_options()
3185 s->opt[OPT_CCT_4].cap |= SANE_CAP_INACTIVE; in init_options()
3186 s->opt[OPT_CCT_5].cap |= SANE_CAP_INACTIVE; in init_options()
3187 s->opt[OPT_CCT_6].cap |= SANE_CAP_INACTIVE; in init_options()
3188 s->opt[OPT_CCT_7].cap |= SANE_CAP_INACTIVE; in init_options()
3189 s->opt[OPT_CCT_8].cap |= SANE_CAP_INACTIVE; in init_options()
3190 s->opt[OPT_CCT_9].cap |= SANE_CAP_INACTIVE; in init_options()
3195 s->opt[OPT_ADVANCED_GROUP].title = SANE_I18N ("Advanced"); in init_options()
3196 s->opt[OPT_ADVANCED_GROUP].desc = ""; in init_options()
3197 s->opt[OPT_ADVANCED_GROUP].type = SANE_TYPE_GROUP; in init_options()
3198 s->opt[OPT_ADVANCED_GROUP].cap = SANE_CAP_ADVANCED; in init_options()
3202 s->opt[OPT_MIRROR].name = "mirror"; in init_options()
3203 s->opt[OPT_MIRROR].title = SANE_I18N ("Mirror image"); in init_options()
3204 s->opt[OPT_MIRROR].desc = SANE_I18N ("Mirror the image."); in init_options()
3206 s->opt[OPT_MIRROR].type = SANE_TYPE_BOOL; in init_options()
3207 s->val[OPT_MIRROR].w = SANE_FALSE; in init_options()
3209 if (!s->hw->cmd->mirror_image) in init_options()
3211 s->opt[OPT_MIRROR].cap |= SANE_CAP_INACTIVE; in init_options()
3216 s->opt[OPT_SPEED].name = SANE_NAME_SCAN_SPEED; in init_options()
3217 s->opt[OPT_SPEED].title = SANE_TITLE_SCAN_SPEED; in init_options()
3218 s->opt[OPT_SPEED].desc = SANE_DESC_SCAN_SPEED; in init_options()
3220 s->opt[OPT_SPEED].type = SANE_TYPE_BOOL; in init_options()
3221 s->val[OPT_SPEED].w = SANE_FALSE; in init_options()
3223 if (!s->hw->cmd->set_speed) in init_options()
3225 s->opt[OPT_SPEED].cap |= SANE_CAP_INACTIVE; in init_options()
3229 s->opt[OPT_PREVIEW_SPEED].name = "preview-speed"; in init_options()
3230 s->opt[OPT_PREVIEW_SPEED].title = SANE_I18N ("Fast preview"); in init_options()
3231 s->opt[OPT_PREVIEW_SPEED].desc = ""; in init_options()
3233 s->opt[OPT_PREVIEW_SPEED].type = SANE_TYPE_BOOL; in init_options()
3234 s->val[OPT_PREVIEW_SPEED].w = SANE_FALSE; in init_options()
3236 if (!s->hw->cmd->set_speed) in init_options()
3238 s->opt[OPT_PREVIEW_SPEED].cap |= SANE_CAP_INACTIVE; in init_options()
3242 s->opt[OPT_AAS].name = "auto-area-segmentation"; in init_options()
3243 s->opt[OPT_AAS].title = SANE_I18N ("Auto area segmentation"); in init_options()
3244 s->opt[OPT_AAS].desc = ""; in init_options()
3246 s->opt[OPT_AAS].type = SANE_TYPE_BOOL; in init_options()
3247 s->val[OPT_AAS].w = SANE_TRUE; in init_options()
3249 if (!s->hw->cmd->control_auto_area_segmentation) in init_options()
3251 s->opt[OPT_AAS].cap |= SANE_CAP_INACTIVE; in init_options()
3255 s->opt[OPT_LIMIT_RESOLUTION].name = "short-resolution"; in init_options()
3256 s->opt[OPT_LIMIT_RESOLUTION].title = SANE_I18N ("Short resolution list"); in init_options()
3257 s->opt[OPT_LIMIT_RESOLUTION].desc = in init_options()
3259 s->opt[OPT_LIMIT_RESOLUTION].type = SANE_TYPE_BOOL; in init_options()
3260 s->val[OPT_LIMIT_RESOLUTION].w = SANE_FALSE; in init_options()
3264 s->opt[OPT_ZOOM].name = "zoom"; in init_options()
3265 s->opt[OPT_ZOOM].title = SANE_I18N ("Zoom"); in init_options()
3266 s->opt[OPT_ZOOM].desc = in init_options()
3269 s->opt[OPT_ZOOM].type = SANE_TYPE_INT; in init_options()
3270 s->opt[OPT_ZOOM].unit = SANE_UNIT_NONE; in init_options()
3271 s->opt[OPT_ZOOM].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3272 s->opt[OPT_ZOOM].constraint.range = &zoom_range; in init_options()
3273 s->val[OPT_ZOOM].w = 100; in init_options()
3275 /* if( ! s->hw->cmd->set_zoom) */ in init_options()
3277 s->opt[OPT_ZOOM].cap |= SANE_CAP_INACTIVE; in init_options()
3282 s->opt[OPT_PREVIEW_GROUP].title = SANE_TITLE_PREVIEW; in init_options()
3283 s->opt[OPT_PREVIEW_GROUP].desc = ""; in init_options()
3284 s->opt[OPT_PREVIEW_GROUP].type = SANE_TYPE_GROUP; in init_options()
3285 s->opt[OPT_PREVIEW_GROUP].cap = SANE_CAP_ADVANCED; in init_options()
3288 s->opt[OPT_PREVIEW].name = SANE_NAME_PREVIEW; in init_options()
3289 s->opt[OPT_PREVIEW].title = SANE_TITLE_PREVIEW; in init_options()
3290 s->opt[OPT_PREVIEW].desc = SANE_DESC_PREVIEW; in init_options()
3292 s->opt[OPT_PREVIEW].type = SANE_TYPE_BOOL; in init_options()
3293 s->val[OPT_PREVIEW].w = SANE_FALSE; in init_options()
3296 s->opt[OPT_GEOMETRY_GROUP].title = SANE_I18N ("Geometry"); in init_options()
3297 s->opt[OPT_GEOMETRY_GROUP].desc = ""; in init_options()
3298 s->opt[OPT_GEOMETRY_GROUP].type = SANE_TYPE_GROUP; in init_options()
3299 s->opt[OPT_GEOMETRY_GROUP].cap = SANE_CAP_ADVANCED; in init_options()
3301 /* top-left x */ in init_options()
3302 s->opt[OPT_TL_X].name = SANE_NAME_SCAN_TL_X; in init_options()
3303 s->opt[OPT_TL_X].title = SANE_TITLE_SCAN_TL_X; in init_options()
3304 s->opt[OPT_TL_X].desc = SANE_DESC_SCAN_TL_X; in init_options()
3306 s->opt[OPT_TL_X].type = SANE_TYPE_FIXED; in init_options()
3307 s->opt[OPT_TL_X].unit = SANE_UNIT_MM; in init_options()
3308 s->opt[OPT_TL_X].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3309 s->opt[OPT_TL_X].constraint.range = s->hw->x_range; in init_options()
3310 s->val[OPT_TL_X].w = 0; in init_options()
3312 /* top-left y */ in init_options()
3313 s->opt[OPT_TL_Y].name = SANE_NAME_SCAN_TL_Y; in init_options()
3314 s->opt[OPT_TL_Y].title = SANE_TITLE_SCAN_TL_Y; in init_options()
3315 s->opt[OPT_TL_Y].desc = SANE_DESC_SCAN_TL_Y; in init_options()
3317 s->opt[OPT_TL_Y].type = SANE_TYPE_FIXED; in init_options()
3318 s->opt[OPT_TL_Y].unit = SANE_UNIT_MM; in init_options()
3319 s->opt[OPT_TL_Y].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3320 s->opt[OPT_TL_Y].constraint.range = s->hw->y_range; in init_options()
3321 s->val[OPT_TL_Y].w = 0; in init_options()
3323 /* bottom-right x */ in init_options()
3324 s->opt[OPT_BR_X].name = SANE_NAME_SCAN_BR_X; in init_options()
3325 s->opt[OPT_BR_X].title = SANE_TITLE_SCAN_BR_X; in init_options()
3326 s->opt[OPT_BR_X].desc = SANE_DESC_SCAN_BR_X; in init_options()
3328 s->opt[OPT_BR_X].type = SANE_TYPE_FIXED; in init_options()
3329 s->opt[OPT_BR_X].unit = SANE_UNIT_MM; in init_options()
3330 s->opt[OPT_BR_X].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3331 s->opt[OPT_BR_X].constraint.range = s->hw->x_range; in init_options()
3332 s->val[OPT_BR_X].w = s->hw->x_range->max; in init_options()
3334 /* bottom-right y */ in init_options()
3335 s->opt[OPT_BR_Y].name = SANE_NAME_SCAN_BR_Y; in init_options()
3336 s->opt[OPT_BR_Y].title = SANE_TITLE_SCAN_BR_Y; in init_options()
3337 s->opt[OPT_BR_Y].desc = SANE_DESC_SCAN_BR_Y; in init_options()
3339 s->opt[OPT_BR_Y].type = SANE_TYPE_FIXED; in init_options()
3340 s->opt[OPT_BR_Y].unit = SANE_UNIT_MM; in init_options()
3341 s->opt[OPT_BR_Y].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
3342 s->opt[OPT_BR_Y].constraint.range = s->hw->y_range; in init_options()
3343 s->val[OPT_BR_Y].w = s->hw->y_range->max; in init_options()
3346 s->opt[OPT_QUICK_FORMAT].name = "quick-format"; in init_options()
3347 s->opt[OPT_QUICK_FORMAT].title = SANE_I18N ("Quick format"); in init_options()
3348 s->opt[OPT_QUICK_FORMAT].desc = ""; in init_options()
3350 s->opt[OPT_QUICK_FORMAT].type = SANE_TYPE_STRING; in init_options()
3351 s->opt[OPT_QUICK_FORMAT].size = max_string_size (qf_list); in init_options()
3352 s->opt[OPT_QUICK_FORMAT].cap |= SANE_CAP_ADVANCED; in init_options()
3353 s->opt[OPT_QUICK_FORMAT].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3354 s->opt[OPT_QUICK_FORMAT].constraint.string_list = qf_list; in init_options()
3355 s->val[OPT_QUICK_FORMAT].w = XtNumber (qf_params) - 1; /* max */ in init_options()
3358 s->opt[OPT_EQU_GROUP].title = SANE_I18N ("Optional equipment"); in init_options()
3359 s->opt[OPT_EQU_GROUP].desc = ""; in init_options()
3360 s->opt[OPT_EQU_GROUP].type = SANE_TYPE_GROUP; in init_options()
3361 s->opt[OPT_EQU_GROUP].cap = SANE_CAP_ADVANCED; in init_options()
3365 s->opt[OPT_SOURCE].name = SANE_NAME_SCAN_SOURCE; in init_options()
3366 s->opt[OPT_SOURCE].title = SANE_TITLE_SCAN_SOURCE; in init_options()
3367 s->opt[OPT_SOURCE].desc = SANE_DESC_SCAN_SOURCE; in init_options()
3369 s->opt[OPT_SOURCE].type = SANE_TYPE_STRING; in init_options()
3370 s->opt[OPT_SOURCE].size = max_string_size (source_list); in init_options()
3372 s->opt[OPT_SOURCE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3373 s->opt[OPT_SOURCE].constraint.string_list = source_list; in init_options()
3375 if (!s->hw->extension) in init_options()
3377 s->opt[OPT_SOURCE].cap |= SANE_CAP_INACTIVE; in init_options()
3379 s->val[OPT_SOURCE].w = 0; /* always use Flatbed as default */ in init_options()
3383 s->opt[OPT_FILM_TYPE].name = "film-type"; in init_options()
3384 s->opt[OPT_FILM_TYPE].title = SANE_I18N ("Film type"); in init_options()
3385 s->opt[OPT_FILM_TYPE].desc = ""; in init_options()
3387 s->opt[OPT_FILM_TYPE].type = SANE_TYPE_STRING; in init_options()
3388 s->opt[OPT_FILM_TYPE].size = max_string_size (film_list); in init_options()
3390 s->opt[OPT_FILM_TYPE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3391 s->opt[OPT_FILM_TYPE].constraint.string_list = film_list; in init_options()
3393 s->val[OPT_FILM_TYPE].w = 0; in init_options()
3395 deactivateOption (s, OPT_FILM_TYPE, &dummy); /* default is inactive */ in init_options()
3398 s->opt[OPT_FOCUS].name = SANE_EPSON_FOCUS_NAME; in init_options()
3399 s->opt[OPT_FOCUS].title = SANE_EPSON_FOCUS_TITLE; in init_options()
3400 s->opt[OPT_FOCUS].desc = SANE_EPSON_FOCUS_DESC; in init_options()
3401 s->opt[OPT_FOCUS].type = SANE_TYPE_STRING; in init_options()
3402 s->opt[OPT_FOCUS].size = max_string_size (focus_list); in init_options()
3403 s->opt[OPT_FOCUS].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3404 s->opt[OPT_FOCUS].constraint.string_list = focus_list; in init_options()
3405 s->val[OPT_FOCUS].w = 0; in init_options()
3407 s->opt[OPT_FOCUS].cap |= SANE_CAP_ADVANCED; in init_options()
3408 if (s->hw->focusSupport == SANE_TRUE) in init_options()
3410 s->opt[OPT_FOCUS].cap &= ~SANE_CAP_INACTIVE; in init_options()
3414 s->opt[OPT_FOCUS].cap |= SANE_CAP_INACTIVE; in init_options()
3418 if ((!s->hw->TPU) && (!s->hw->cmd->set_bay)) in init_options()
3428 s->opt[OPT_EJECT].name = "eject"; in init_options()
3429 s->opt[OPT_EJECT].title = SANE_I18N ("Eject"); in init_options()
3430 s->opt[OPT_EJECT].desc = SANE_I18N ("Eject the sheet in the ADF"); in init_options()
3432 s->opt[OPT_EJECT].type = SANE_TYPE_BUTTON; in init_options()
3434 if ((!s->hw->ADF) && (!s->hw->cmd->set_bay)) in init_options()
3436 s->opt[OPT_EJECT].cap |= SANE_CAP_INACTIVE; in init_options()
3441 s->opt[OPT_AUTO_EJECT].name = "auto-eject"; in init_options()
3442 s->opt[OPT_AUTO_EJECT].title = SANE_I18N ("Auto eject"); in init_options()
3443 s->opt[OPT_AUTO_EJECT].desc = SANE_I18N ("Eject document after scanning"); in init_options()
3445 s->opt[OPT_AUTO_EJECT].type = SANE_TYPE_BOOL; in init_options()
3446 s->val[OPT_AUTO_EJECT].w = SANE_FALSE; in init_options()
3448 if (!s->hw->ADF) in init_options()
3450 s->opt[OPT_AUTO_EJECT].cap |= SANE_CAP_INACTIVE; in init_options()
3454 s->opt[OPT_ADF_MODE].name = "adf_mode"; in init_options()
3455 s->opt[OPT_ADF_MODE].title = SANE_I18N ("ADF Mode"); in init_options()
3456 s->opt[OPT_ADF_MODE].desc = in init_options()
3458 s->opt[OPT_ADF_MODE].type = SANE_TYPE_STRING; in init_options()
3459 s->opt[OPT_ADF_MODE].size = max_string_size (adf_mode_list); in init_options()
3460 s->opt[OPT_ADF_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3461 s->opt[OPT_ADF_MODE].constraint.string_list = adf_mode_list; in init_options()
3462 s->val[OPT_ADF_MODE].w = 0; /* simplex */ in init_options()
3464 if ((!s->hw->ADF) || (s->hw->duplexSupport == SANE_FALSE)) in init_options()
3466 s->opt[OPT_ADF_MODE].cap |= SANE_CAP_INACTIVE; in init_options()
3470 s->opt[OPT_BAY].name = "bay"; in init_options()
3471 s->opt[OPT_BAY].title = SANE_I18N ("Bay"); in init_options()
3472 s->opt[OPT_BAY].desc = SANE_I18N ("Select bay to scan"); in init_options()
3474 s->opt[OPT_BAY].type = SANE_TYPE_STRING; in init_options()
3475 s->opt[OPT_BAY].size = max_string_size (bay_list); in init_options()
3476 s->opt[OPT_BAY].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
3477 s->opt[OPT_BAY].constraint.string_list = bay_list; in init_options()
3478 s->val[OPT_BAY].w = 0; /* Bay 1 */ in init_options()
3480 if (!s->hw->cmd->set_bay) in init_options()
3482 s->opt[OPT_BAY].cap |= SANE_CAP_INACTIVE; in init_options()
3486 s->opt[OPT_WAIT_FOR_BUTTON].name = SANE_EPSON_WAIT_FOR_BUTTON_NAME; in init_options()
3487 s->opt[OPT_WAIT_FOR_BUTTON].title = SANE_EPSON_WAIT_FOR_BUTTON_TITLE; in init_options()
3488 s->opt[OPT_WAIT_FOR_BUTTON].desc = SANE_EPSON_WAIT_FOR_BUTTON_DESC; in init_options()
3490 s->opt[OPT_WAIT_FOR_BUTTON].type = SANE_TYPE_BOOL; in init_options()
3491 s->opt[OPT_WAIT_FOR_BUTTON].unit = SANE_UNIT_NONE; in init_options()
3492 s->opt[OPT_WAIT_FOR_BUTTON].constraint_type = SANE_CONSTRAINT_NONE; in init_options()
3493 s->opt[OPT_WAIT_FOR_BUTTON].constraint.range = NULL; in init_options()
3494 s->opt[OPT_WAIT_FOR_BUTTON].cap |= SANE_CAP_ADVANCED; in init_options()
3496 if (!s->hw->cmd->request_push_button_status) in init_options()
3498 s->opt[OPT_WAIT_FOR_BUTTON].cap |= SANE_CAP_INACTIVE; in init_options()
3521 for (dev = first_dev; dev; dev = dev->next) in sane_open()
3523 if (strcmp (dev->sane.name, devicename) == 0) in sane_open()
3559 s->fd = -1; in sane_open()
3560 s->hw = dev; in sane_open()
3565 s->next = first_handle; in sane_open()
3594 for (s = first_handle; s; s = s->next) in sane_close()
3608 prev->next = s->next; in sane_close()
3610 first_handle = s->next; in sane_close()
3612 if (s->fd != -1) in sane_close()
3631 return (s->opt + option); in sane_get_option_descriptor()
3665 if (!SANE_OPTION_IS_ACTIVE (s->opt[option].cap)) in activateOption()
3667 s->opt[option].cap &= ~SANE_CAP_INACTIVE; in activateOption()
3675 if (SANE_OPTION_IS_ACTIVE (s->opt[option].cap)) in deactivateOption()
3677 s->opt[option].cap |= SANE_CAP_INACTIVE; in deactivateOption()
3704 SANE_Option_Descriptor *sopt = &(s->opt[option]); in getvalue()
3705 Option_Value *sval = &(s->val[option]); in getvalue()
3713 memcpy (value, sval->wa, sopt->size); in getvalue()
3744 *((SANE_Word *) value) = sval->w; in getvalue()
3757 strcpy ((char *) value, sopt->constraint.string_list[sval->w]); in getvalue()
3761 strcpy (value, sval->s); in getvalue()
3785 - auto area segmentation, and threshold. Apparently AAS in handle_depth_halftone()
3795 int hti = s->val[OPT_HALFTONE].w; in handle_depth_halftone()
3796 int mdi = s->val[OPT_MODE].w; in handle_depth_halftone()
3800 if (!s->hw->cmd->control_auto_area_segmentation) in handle_depth_halftone()
3836 /* reset the scanner when we are changing the source setting - in handle_source()
3838 if (s->hw->need_reset_on_source_change) in handle_source()
3841 s->focusOnGlass = SANE_TRUE; /* this is the default */ in handle_source()
3843 if (s->val[OPT_SOURCE].w == optindex) in handle_source()
3846 s->val[OPT_SOURCE].w = optindex; in handle_source()
3848 if (s->val[OPT_TL_X].w == s->hw->x_range->min in handle_source()
3849 && s->val[OPT_TL_Y].w == s->hw->y_range->min in handle_source()
3850 && s->val[OPT_BR_X].w == s->hw->x_range->max in handle_source()
3851 && s->val[OPT_BR_Y].w == s->hw->y_range->max) in handle_source()
3857 s->hw->x_range = &s->hw->adf_x_range; in handle_source()
3858 s->hw->y_range = &s->hw->adf_y_range; in handle_source()
3859 s->hw->use_extension = SANE_TRUE; in handle_source()
3862 s->val[OPT_FOCUS].w = 0; in handle_source()
3863 if (s->hw->duplexSupport) in handle_source()
3870 s->val[OPT_ADF_MODE].w = 0; in handle_source()
3875 s->hw->x_range = &s->hw->tpu_x_range; in handle_source()
3876 s->hw->y_range = &s->hw->tpu_y_range; in handle_source()
3877 s->hw->use_extension = SANE_TRUE; in handle_source()
3879 if (s->hw->cmd->set_film_type != 0) in handle_source()
3888 if (s->hw->cmd->set_focus_position != 0) in handle_source()
3890 s->val[OPT_FOCUS].w = 1; in handle_source()
3891 s->focusOnGlass = SANE_FALSE; in handle_source()
3899 s->hw->x_range = &s->hw->fbf_x_range; in handle_source()
3900 s->hw->y_range = &s->hw->fbf_y_range; in handle_source()
3901 s->hw->use_extension = SANE_FALSE; in handle_source()
3904 s->val[OPT_FOCUS].w = 0; in handle_source()
3908 qf_params[XtNumber (qf_params) - 1].tl_x = s->hw->x_range->min; in handle_source()
3909 qf_params[XtNumber (qf_params) - 1].tl_y = s->hw->y_range->min; in handle_source()
3910 qf_params[XtNumber (qf_params) - 1].br_x = s->hw->x_range->max; in handle_source()
3911 qf_params[XtNumber (qf_params) - 1].br_y = s->hw->y_range->max; in handle_source()
3913 s->opt[OPT_BR_X].constraint.range = s->hw->x_range; in handle_source()
3914 s->opt[OPT_BR_Y].constraint.range = s->hw->y_range; in handle_source()
3916 if (s->val[OPT_TL_X].w < s->hw->x_range->min || force_max) in handle_source()
3917 s->val[OPT_TL_X].w = s->hw->x_range->min; in handle_source()
3919 if (s->val[OPT_TL_Y].w < s->hw->y_range->min || force_max) in handle_source()
3920 s->val[OPT_TL_Y].w = s->hw->y_range->min; in handle_source()
3922 if (s->val[OPT_BR_X].w > s->hw->x_range->max || force_max) in handle_source()
3923 s->val[OPT_BR_X].w = s->hw->x_range->max; in handle_source()
3925 if (s->val[OPT_BR_Y].w > s->hw->y_range->max || force_max) in handle_source()
3926 s->val[OPT_BR_Y].w = s->hw->y_range->max; in handle_source()
3928 setOptionState (s, s->hw->ADF && s->hw->use_extension, in handle_source()
3930 setOptionState (s, s->hw->ADF && s->hw->use_extension, OPT_EJECT, &dummy); in handle_source()
3936 setOptionState (s, s->hw->ADF && s->hw->use_extension, OPT_BAY, &reload); in handle_source()
3948 SANE_Option_Descriptor *sopt = &(s->opt[option]); in setvalue()
3949 Option_Value *sval = &(s->val[option]); in setvalue()
3963 s->option_has_changed = SANE_TRUE; in setvalue()
3968 if (sopt->constraint_type == SANE_CONSTRAINT_STRING_LIST) in setvalue()
3970 optval = search_string_list (sopt->constraint.string_list, in setvalue()
3975 optindex = optval - sopt->constraint.string_list; in setvalue()
3984 memcpy (sval->wa, value, sopt->size); /* Word arrays */ in setvalue()
3996 sval->w = *((SANE_Word *) value); /* Simple values */ in setvalue()
4003 sval->w = optindex; /* Simple lists */ in setvalue()
4012 sval->w = *((SANE_Word *) value); in setvalue()
4020 sval->w = *((SANE_Word *) value); in setvalue()
4021 DBG (1, "set = %f\n", SANE_UNFIX (sval->w)); in setvalue()
4035 color_userdefined[s->val[OPT_COLOR_CORRECTION].w]; in setvalue()
4037 sval->w = optindex; in setvalue()
4039 if (s->hw->cmd->set_halftoning != 0) in setvalue()
4046 if (s->hw->cmd->set_color_correction) in setvalue()
4050 if (s->hw->cmd->set_color_correction_coefficients) in setvalue()
4066 s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE; in setvalue()
4071 s->opt[OPT_BIT_DEPTH].cap |= SANE_CAP_INACTIVE; in setvalue()
4074 s->opt[OPT_BIT_DEPTH].cap &= ~SANE_CAP_INACTIVE; in setvalue()
4075 s->val[OPT_BIT_DEPTH].w = mode_params[optindex].depth; in setvalue()
4086 sval->w = optindex; in setvalue()
4090 sval->w = *((SANE_Word *) value); in setvalue()
4091 mode_params[s->val[OPT_MODE].w].depth = sval->w; in setvalue()
4096 sval->w = optindex; in setvalue()
4104 sval->w = optindex; in setvalue()
4122 sval->w = optindex; in setvalue()
4143 sval->w = *((SANE_Word *) value); in setvalue()
4147 sval->w = *((SANE_Word *) value); in setvalue()
4153 sval->w = optindex; in setvalue()
4155 s->val[OPT_TL_X].w = qf_params[sval->w].tl_x; in setvalue()
4156 s->val[OPT_TL_Y].w = qf_params[sval->w].tl_y; in setvalue()
4157 s->val[OPT_BR_X].w = qf_params[sval->w].br_x; in setvalue()
4158 s->val[OPT_BR_Y].w = qf_params[sval->w].br_y; in setvalue()
4160 if (s->val[OPT_TL_X].w < s->hw->x_range->min) in setvalue()
4161 s->val[OPT_TL_X].w = s->hw->x_range->min; in setvalue()
4163 if (s->val[OPT_TL_Y].w < s->hw->y_range->min) in setvalue()
4164 s->val[OPT_TL_Y].w = s->hw->y_range->min; in setvalue()
4166 if (s->val[OPT_BR_X].w > s->hw->x_range->max) in setvalue()
4167 s->val[OPT_BR_X].w = s->hw->x_range->max; in setvalue()
4169 if (s->val[OPT_BR_Y].w > s->hw->y_range->max) in setvalue()
4170 s->val[OPT_BR_Y].w = s->hw->y_range->max; in setvalue()
4243 if (!s->eof && s->ptr != NULL) in sane_get_parameters()
4249 *params = s->params; in sane_get_parameters()
4252 DBG (3, "Preview = %d\n", s->val[OPT_PREVIEW].w); in sane_get_parameters()
4253 DBG (3, "Resolution = %d\n", s->val[OPT_RESOLUTION].w); in sane_get_parameters()
4256 (void *) s->val, SANE_UNFIX (s->val[OPT_TL_X].w), in sane_get_parameters()
4257 SANE_UNFIX (s->val[OPT_TL_Y].w), SANE_UNFIX (s->val[OPT_BR_X].w), in sane_get_parameters()
4258 SANE_UNFIX (s->val[OPT_BR_Y].w)); in sane_get_parameters()
4260 print_params (s->params); in sane_get_parameters()
4267 memset (&s->params, 0, sizeof (SANE_Parameters)); in sane_get_parameters()
4269 ndpi = s->val[OPT_RESOLUTION].w; in sane_get_parameters()
4271 s->params.pixels_per_line = in sane_get_parameters()
4272 SANE_UNFIX (s->val[OPT_BR_X].w - s->val[OPT_TL_X].w) / 25.4 * ndpi + 0.5; in sane_get_parameters()
4273 s->params.lines = in sane_get_parameters()
4274 SANE_UNFIX (s->val[OPT_BR_Y].w - s->val[OPT_TL_Y].w) / 25.4 * ndpi + 0.5; in sane_get_parameters()
4280 * useable. If s->params.lines gets negative, 0 lines are reported in sane_get_parameters()
4283 if (s->hw->color_shuffle) in sane_get_parameters()
4285 s->params.lines -= 4 * s->line_distance; in sane_get_parameters()
4286 if (s->params.lines < 0) in sane_get_parameters()
4288 s->params.lines = 0; in sane_get_parameters()
4291 4 * s->line_distance, s->params.lines); in sane_get_parameters()
4294 DBG (3, "Preview = %d\n", s->val[OPT_PREVIEW].w); in sane_get_parameters()
4295 DBG (3, "Resolution = %d\n", s->val[OPT_RESOLUTION].w); in sane_get_parameters()
4298 (void *) s->val, SANE_UNFIX (s->val[OPT_TL_X].w), in sane_get_parameters()
4299 SANE_UNFIX (s->val[OPT_TL_Y].w), SANE_UNFIX (s->val[OPT_BR_X].w), in sane_get_parameters()
4300 SANE_UNFIX (s->val[OPT_BR_Y].w)); in sane_get_parameters()
4310 if (mode_params[s->val[OPT_MODE].w].depth == 1) in sane_get_parameters()
4312 s->params.depth = 1; in sane_get_parameters()
4316 s->params.depth = s->val[OPT_BIT_DEPTH].w; in sane_get_parameters()
4319 if (s->params.depth > 8) in sane_get_parameters()
4321 s->params.depth = 16; /* in sane_get_parameters()
4323 * for gray or color - so if it's more than 8, in sane_get_parameters()
4332 …bytes_per_pixel = s->params.depth / 8; /* this works because it can only be set to 1, 8 or … in sane_get_parameters()
4333 if (s->params.depth % 8) /* just in case ... */ in sane_get_parameters()
4339 s->params.pixels_per_line = s->params.pixels_per_line & ~7; in sane_get_parameters()
4341 s->params.last_frame = SANE_TRUE; in sane_get_parameters()
4343 if (mode_params[s->val[OPT_MODE].w].color) in sane_get_parameters()
4345 s->params.format = SANE_FRAME_RGB; in sane_get_parameters()
4346 s->params.bytes_per_line = in sane_get_parameters()
4347 3 * s->params.pixels_per_line * bytes_per_pixel; in sane_get_parameters()
4351 s->params.format = SANE_FRAME_GRAY; in sane_get_parameters()
4352 s->params.bytes_per_line = in sane_get_parameters()
4353 s->params.pixels_per_line * s->params.depth / 8; in sane_get_parameters()
4357 *params = s->params; in sane_get_parameters()
4359 print_params (s->params); in sane_get_parameters()
4401 if (s->hw->extension) in sane_start()
4406 extensionCtrl = (s->hw->use_extension ? 1 : 0); in sane_start()
4407 if (s->hw->use_extension && (s->val[OPT_ADF_MODE].w == 1)) in sane_start()
4415 s->hw->use_extension ? "on" : "off"); in sane_start()
4422 if (s->hw->cmd->request_extended_status != 0) in sane_start()
4433 if (s->hw->ADF && s->hw->use_extension && s->hw->cmd->feed) in sane_start()
4443 s->hw->adf_max_x = max_x; in sane_start()
4444 s->hw->adf_max_y = max_y; in sane_start()
4455 if (s->hw->focusSupport == SANE_TRUE) in sane_start()
4457 if (s->val[OPT_FOCUS].w == 0) in sane_start()
4470 /* use the flatbed size for the max. scansize for the GT-30000 in sane_start()
4472 if (s->hw->devtype == 3 && s->hw->use_extension == 0) in sane_start()
4483 s->hw->fbf_max_x = max_x; in sane_start()
4484 s->hw->fbf_max_y = max_y; in sane_start()
4488 mparam = mode_params + s->val[OPT_MODE].w; in sane_start()
4489 DBG (1, "sane_start: Setting data format to %d bits\n", mparam->depth); in sane_start()
4490 status = set_data_format (s, mparam->depth); in sane_start()
4503 if ((s->hw->cmd->level[0] == 'D' || in sane_start()
4504 (s->hw->cmd->level[0] == 'B' && s->hw->level >= 5)) && in sane_start()
4505 mparam->mode_flags == 0x02) in sane_start()
4511 status = set_color_mode (s, mparam->mode_flags | (mparam->dropout_mask in sane_start()
4512 & dropout_params[s-> in sane_start()
4525 if (s->hw->cmd->set_halftoning && in sane_start()
4526 SANE_OPTION_IS_ACTIVE (s->opt[OPT_HALFTONE].cap)) in sane_start()
4528 status = set_halftoning (s, halftone_params[s->val[OPT_HALFTONE].w]); in sane_start()
4539 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_BRIGHTNESS].cap)) in sane_start()
4541 status = set_bright (s, s->val[OPT_BRIGHTNESS].w); in sane_start()
4550 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_MIRROR].cap)) in sane_start()
4552 status = mirror_image (s, mirror_params[s->val[OPT_MIRROR].w]); in sane_start()
4563 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_SPEED].cap)) in sane_start()
4566 if (s->val[OPT_PREVIEW].w) in sane_start()
4567 status = set_speed (s, speed_params[s->val[OPT_PREVIEW_SPEED].w]); in sane_start()
4569 status = set_speed (s, speed_params[s->val[OPT_SPEED].w]); in sane_start()
4584 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_AAS].cap)) in sane_start()
4587 speed_params[s->val[OPT_AAS].w]); in sane_start()
4597 s->invert_image = SANE_FALSE; /* default: to not inverting the image */ in sane_start()
4599 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_FILM_TYPE].cap)) in sane_start()
4601 s->invert_image = (s->val[OPT_FILM_TYPE].w == FILM_TYPE_NEGATIVE); in sane_start()
4602 status = set_film_type (s, film_params[s->val[OPT_FILM_TYPE].w]); in sane_start()
4611 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_BAY].cap)) in sane_start()
4613 status = set_bay (s, s->val[OPT_BAY].w); in sane_start()
4622 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_SHARPNESS].cap)) in sane_start()
4625 status = set_outline_emphasis (s, s->val[OPT_SHARPNESS].w); in sane_start()
4635 if (s->hw->cmd->set_gamma && in sane_start()
4636 SANE_OPTION_IS_ACTIVE (s->opt[OPT_GAMMA_CORRECTION].cap)) in sane_start()
4639 if (s->hw->cmd->level[0] == 'D') in sane_start()
4645 val = gamma_params[s->val[OPT_GAMMA_CORRECTION].w]; in sane_start()
4649 val = gamma_params[s->val[OPT_GAMMA_CORRECTION].w]; in sane_start()
4657 /* if( s->val[ OPT_GAMMA_CORRECTION].w <= 1) { */ in sane_start()
4658 if (s->val[OPT_GAMMA_CORRECTION].w == 0) in sane_start()
4660 val += mparam->depth == 1 ? 0 : 1; in sane_start()
4674 if (s->hw->cmd->set_gamma_table && in sane_start()
4675 gamma_userdefined[s->val[OPT_GAMMA_CORRECTION].w]) in sane_start()
4691 if (SANE_OPTION_IS_ACTIVE (s->opt[OPT_COLOR_CORRECTION].cap)) in sane_start()
4693 int val = color_params[s->val[OPT_COLOR_CORRECTION].w]; in sane_start()
4705 if (1 == s->val[OPT_COLOR_CORRECTION].w) in sane_start()
4718 if (s->hw->cmd->set_threshold != 0 in sane_start()
4719 && SANE_OPTION_IS_ACTIVE (s->opt[OPT_THRESHOLD].cap)) in sane_start()
4721 status = set_threshold (s, s->val[OPT_THRESHOLD].w); in sane_start()
4726 s->val[OPT_THRESHOLD].w, sane_strstatus (status)); in sane_start()
4731 ndpi = s->val[OPT_RESOLUTION].w; in sane_start()
4748 if (s->hw->cmd->set_zoom != 0 in sane_start()
4749 && SANE_OPTION_IS_ACTIVE (s->opt[OPT_ZOOM].cap)) in sane_start()
4751 status = set_zoom (s, s->val[OPT_ZOOM].w, s->val[OPT_ZOOM].w); in sane_start()
4755 s->val[OPT_ZOOM].w, sane_strstatus (status)); in sane_start()
4762 * Now s->params is initialized. in sane_start()
4772 if (s->val[OPT_WAIT_FOR_BUTTON].w == SANE_TRUE) in sane_start()
4774 s->hw->wait_for_button = SANE_TRUE; in sane_start()
4776 while (s->hw->wait_for_button == SANE_TRUE) in sane_start()
4778 if (s->canceling == SANE_TRUE) in sane_start()
4780 s->hw->wait_for_button = SANE_FALSE; in sane_start()
4788 s->hw->wait_for_button = SANE_FALSE; in sane_start()
4798 s->hw->wait_for_button = SANE_FALSE; in sane_start()
4814 left = SANE_UNFIX (s->val[OPT_TL_X].w) / 25.4 * ndpi + 0.5; in sane_start()
4815 top = SANE_UNFIX (s->val[OPT_TL_Y].w) / 25.4 * ndpi + 0.5; in sane_start()
4825 s->hw->color_shuffle = SANE_FALSE; in sane_start()
4826 s->current_output_line = 0; in sane_start()
4827 s->lines_written = 0; in sane_start()
4828 s->color_shuffle_line = 0; in sane_start()
4830 if ((s->hw->optical_res != 0) && (mparam->depth == 8) in sane_start()
4831 && (mparam->mode_flags != 0)) in sane_start()
4833 s->line_distance = s->hw->max_line_distance * ndpi / s->hw->optical_res; in sane_start()
4834 if (s->line_distance != 0) in sane_start()
4836 s->hw->color_shuffle = SANE_TRUE; in sane_start()
4839 s->hw->color_shuffle = SANE_FALSE; in sane_start()
4847 s->hw->color_shuffle = SANE_TRUE; in sane_start()
4856 * this is possible - if not, then we try to calculate the number of additional in sane_start()
4859 if (s->hw->color_shuffle == SANE_TRUE) in sane_start()
4863 top -= 2 * s->line_distance; in sane_start()
4870 s->params.lines += 4 * s->line_distance; in sane_start()
4874 * If (top + s->params.lines) is larger than the max scan area, reset in sane_start()
4877 if (SANE_UNFIX (s->val[OPT_BR_Y].w) / 25.4 * ndpi < (s->params.lines + top)) in sane_start()
4879 s->params.lines = ((int) SANE_UNFIX (s->val[OPT_BR_Y].w) / in sane_start()
4880 25.4 * ndpi + 0.5) - top; in sane_start()
4885 set_scan_area (s, left, top, s->params.pixels_per_line, s->params.lines); in sane_start()
4894 s->block = SANE_FALSE; in sane_start()
4903 if (((s->hw->cmd->level[0] == 'B') && in sane_start()
4904 ((s->hw->level >= 5) || ((s->hw->level >= 4) && in sane_start()
4905 (!mode_params[s->val[OPT_MODE].w].color)))) in sane_start()
4906 || (s->hw->cmd->level[0] == 'D')) in sane_start()
4908 s->block = SANE_TRUE; in sane_start()
4909 lcount = sanei_scsi_max_request_size / s->params.bytes_per_line; in sane_start()
4916 if (s->hw->TPU && s->hw->use_extension && lcount > 32) in sane_start()
4924 * for bi-level scanning. If a bit depth of 1 is selected, then in sane_start()
4927 if (s->hw->cmd->level[0] == 'D') in sane_start()
4931 lcount -= 1; in sane_start()
4951 if (s->hw->cmd->request_extended_status != 0 in sane_start()
4952 && SANE_TRUE == s->hw->extension) in sane_start()
4959 params[1] = s->hw->cmd->request_extended_status; in sane_start()
4993 if (s->hw->cmd->request_condition != 0) in sane_start()
5000 params[1] = s->hw->cmd->request_condition; in sane_start()
5024 DBG (10, "SANE_START: %d: %c\n", i, buf[i - 1]); in sane_start()
5055 s->retry_count = 0; in sane_start()
5057 if (s->hw->color_shuffle == SANE_TRUE) in sane_start()
5061 for (i = 0; i < s->line_distance * 2 + 1; i++) in sane_start()
5063 if (s->line_buffer[i] != NULL) in sane_start()
5064 free (s->line_buffer[i]); in sane_start()
5066 s->line_buffer[i] = malloc (s->params.bytes_per_line); in sane_start()
5067 if (s->line_buffer[i] == NULL) in sane_start()
5072 free (s->line_buffer[j]); in sane_start()
5073 s->line_buffer[j] = NULL; in sane_start()
5082 params[1] = s->hw->cmd->start_scanning; in sane_start()
5092 s->eof = SANE_FALSE; in sane_start()
5093 s->buf = realloc (s->buf, lcount * s->params.bytes_per_line); in sane_start()
5094 s->ptr = s->end = s->buf; in sane_start()
5095 s->canceling = SANE_FALSE; in sane_start()
5111 if (s->hw->ADF && s->hw->use_extension && s->val[OPT_AUTO_EJECT].w) in sane_auto_eject()
5116 u_char cmd = s->hw->cmd->eject; in sane_auto_eject()
5145 receive (s, result, s->block ? 6 : 4, &status); in read_data_block()
5150 if (STX != result->code) in read_data_block()
5152 DBG (1, "code %02x\n", (int) result->code); in read_data_block()
5158 if (result->status & STATUS_FER) in read_data_block()
5162 DBG (1, "fatal error - Status = %02x\n", result->status); in read_data_block()
5169 * re-issue the command again. We can assume that the command that in read_data_block()
5183 * then just return the status and let the loop handle this - otherwise in read_data_block()
5187 if ((status == SANE_STATUS_DEVICE_BUSY && s->retry_count > 0) || in read_data_block()
5188 (status == SANE_STATUS_GOOD && s->retry_count > 0)) in read_data_block()
5197 if (s->retry_count > SANE_EPSON_MAX_RETRIES) in read_data_block()
5199 DBG (1, "Max retry count exceeded (%d)\n", s->retry_count); in read_data_block()
5205 DBG (1, "retrying ESC G - %d\n", ++(s->retry_count)); in read_data_block()
5208 param[1] = s->hw->cmd->start_scanning; in read_data_block()
5241 free (s->buf); in scan_finish()
5242 s->buf = NULL; in scan_finish()
5246 if (SANE_STATUS_NO_DOCS == status && s->hw->ADF && s->hw->use_extension) in scan_finish()
5249 for (i = 0; i < s->line_distance; i++) in scan_finish()
5251 if (s->line_buffer[i] != NULL) in scan_finish()
5253 free (s->line_buffer[i]); in scan_finish()
5254 s->line_buffer[i] = NULL; in scan_finish()
5274 if (s->ptr == s->end) in sane_read()
5279 if ((s->fd != -1) && s->eof) in sane_read()
5281 if (s->hw->color_shuffle) in sane_read()
5283 DBG (1, "Written %d lines after color shuffle\n", s->lines_written); in sane_read()
5284 DBG (1, "Lines requested: %d\n", s->params.lines); in sane_read()
5307 if (s->block) in sane_read()
5313 if (!s->block && SANE_FRAME_RGB == s->params.format) in sane_read()
5321 * read the first color line - the number of bytes to read in sane_read()
5325 * way the data is delivered does not guarantee this - actually it's in sane_read()
5341 receive (s, s->buf + index * s->params.pixels_per_line, buf_len, in sane_read()
5363 if (s->block) in sane_read()
5381 receive (s, s->buf + index * s->params.pixels_per_line, buf_len, in sane_read()
5405 if (s->block) in sane_read()
5423 receive (s, s->buf + index * s->params.pixels_per_line, buf_len, in sane_read()
5445 receive (s, s->buf, buf_len, &status); in sane_read()
5457 s->eof = SANE_TRUE; in sane_read()
5461 if (s->canceling) in sane_read()
5476 s->end = s->buf + buf_len; in sane_read()
5477 s->ptr = s->buf; in sane_read()
5480 * if we have to re-order the color components (GRB->RGB) we in sane_read()
5485 * Some scaners (e.g. the Perfection 1640 and GT-2200) seem in sane_read()
5487 * The GT-8700 is the Asian version of the Perfection1640. in sane_read()
5493 (strstr (s->hw->sane.model, "GT-2200") || in sane_read()
5494 ((strstr (s->hw->sane.model, "1640") && in sane_read()
5495 strstr (s->hw->sane.model, "Perfection")) || in sane_read()
5496 strstr (s->hw->sane.model, "GT-8700"))) && in sane_read()
5497 s->params.format == SANE_FRAME_RGB; in sane_read()
5500 * Certain Perfection 1650 also need this re-ordering of the two in sane_read()
5503 * we also set the variable s->hw->need_color_reorder in sane_read()
5505 if (s->hw->need_color_reorder) in sane_read()
5513 if (s->params.format != SANE_FRAME_RGB) in sane_read()
5520 ptr = s->buf; in sane_read()
5521 while (ptr < s->end) in sane_read()
5523 if (s->params.depth > 8) in sane_read()
5527 /* R->G G->R */ in sane_read()
5540 /* R->G G->R */ in sane_read()
5553 * Do the color_shuffle if everything else is correct - at this time in sane_read()
5557 if (s->hw->color_shuffle) in sane_read()
5569 if (new_length == 0 && s->end != s->ptr) in sane_read()
5574 s->end = s->buf + new_length; in sane_read()
5575 s->ptr = s->buf; in sane_read()
5589 if (!s->block && SANE_FRAME_RGB == s->params.format) in sane_read()
5594 if (max_length > s->end - s->ptr) in sane_read()
5595 max_length = s->end - s->ptr; in sane_read()
5599 if (s->invert_image == SANE_TRUE) in sane_read()
5601 while (max_length-- != 0) in sane_read()
5604 *data++ = (u_char) ~ (s->ptr[0]); in sane_read()
5605 *data++ = (u_char) ~ (s->ptr[s->params.pixels_per_line]); in sane_read()
5606 *data++ = (u_char) ~ (s->ptr[2 * s->params.pixels_per_line]); in sane_read()
5607 ++s->ptr; in sane_read()
5612 while (max_length-- != 0) in sane_read()
5614 *data++ = s->ptr[0]; in sane_read()
5615 *data++ = s->ptr[s->params.pixels_per_line]; in sane_read()
5616 *data++ = s->ptr[2 * s->params.pixels_per_line]; in sane_read()
5617 ++s->ptr; in sane_read()
5623 if (max_length > s->end - s->ptr) in sane_read()
5624 max_length = s->end - s->ptr; in sane_read()
5628 if (1 == s->params.depth) in sane_read()
5630 if (s->invert_image == SANE_TRUE) in sane_read()
5632 while (max_length-- != 0) in sane_read()
5633 *data++ = *s->ptr++; in sane_read()
5637 while (max_length-- != 0) in sane_read()
5638 *data++ = ~*s->ptr++; in sane_read()
5644 if (s->invert_image == SANE_TRUE) in sane_read()
5650 data[i] = (u_char) ~ (s->ptr[i]); in sane_read()
5655 memcpy (data, s->ptr, max_length); in sane_read()
5657 s->ptr += max_length; in sane_read()
5671 SANE_Byte *buf = s->buf; in color_shuffle()
5672 int length = s->end - s->buf; in color_shuffle()
5674 if (s->hw->color_shuffle == SANE_TRUE) in color_shuffle()
5704 * The image data is in *buf, we know that the buffer contains s->end - s->buf ( = length) in color_shuffle()
5705 * bytes of data. The width of one line is in s->params.bytes_per_line in color_shuffle()
5713 if (length % s->params.bytes_per_line != 0) in color_shuffle()
5716 length, s->params.bytes_per_line); in color_shuffle()
5728 dest_ptr = s->line_buffer[s->color_shuffle_line] + 1; in color_shuffle()
5730 for (i = 0; i < s->params.bytes_per_line / 3; i++) in color_shuffle()
5739 if (s->color_shuffle_line >= s->line_distance) in color_shuffle()
5743 s->line_buffer[s->color_shuffle_line - s->line_distance] + 2; in color_shuffle()
5745 /* while (source_ptr < s->line_buffer[s->color_shuffle_line] + s->para… in color_shuffle()
5746 for (loop = 0; loop < s->params.bytes_per_line / 3; loop++) in color_shuffle()
5758 dest_ptr = s->line_buffer[s->color_shuffle_line + s->line_distance]; in color_shuffle()
5760 /* while (source_ptr < s->line_buffer[s->color_shuffle_line] + s->params.bytes… in color_shuffle()
5761 for (loop = 0; loop < s->params.bytes_per_line / 3; loop++) in color_shuffle()
5768 data_ptr += s->params.bytes_per_line; in color_shuffle()
5770 if (s->color_shuffle_line == s->line_distance) in color_shuffle()
5773 * we just finished the line in line_buffer[0] - write it to the in color_shuffle()
5788 if ((s->current_output_line >= s->line_distance) && in color_shuffle()
5789 (s->current_output_line < s->params.lines + s->line_distance)) in color_shuffle()
5791 memcpy (out_data_ptr, s->line_buffer[0], s->params.bytes_per_line); in color_shuffle()
5792 out_data_ptr += s->params.bytes_per_line; in color_shuffle()
5794 s->lines_written++; in color_shuffle()
5797 s->current_output_line++; in color_shuffle()
5801 * Now remove the 0-entry and move all other in color_shuffle()
5806 * from - to 2*line_distance-1! in color_shuffle()
5809 free (s->line_buffer[0]); in color_shuffle()
5811 for (i = 0; i < s->line_distance * 2; i++) in color_shuffle()
5813 s->line_buffer[i] = s->line_buffer[i + 1]; in color_shuffle()
5820 s->line_buffer[s->line_distance * 2] = in color_shuffle()
5821 malloc (s->params.bytes_per_line); in color_shuffle()
5822 if (s->line_buffer[s->line_distance * 2] == NULL) in color_shuffle()
5825 for (i = 0; i < s->line_distance * 2; i++) in color_shuffle()
5827 free (s->line_buffer[i]); in color_shuffle()
5828 s->line_buffer[i] = NULL; in color_shuffle()
5836 s->color_shuffle_line++; /* increase the buffer number */ in color_shuffle()
5847 *new_length = out_data_ptr - buf; in color_shuffle()
5867 Epson_Device *dev = s->hw; in get_identity_information()
5875 if (!s->hw->cmd->request_identity) in get_identity_information()
5880 param[1] = s->hw->cmd->request_identity; in get_identity_information()
5889 DBG (1, "type %3c 0x%02x\n", ident->type, ident->type); in get_identity_information()
5890 DBG (1, "level %3c 0x%02x\n", ident->level, ident->level); in get_identity_information()
5897 ident->type = force[0]; in get_identity_information()
5898 ident->level = force[1]; in get_identity_information()
5900 DBG (1, "type %3c 0x%02x\n", ident->type, ident->type); in get_identity_information()
5901 DBG (1, "level %3c 0x%02x\n", ident->level, ident->level); in get_identity_information()
5911 if (ident->status & STATUS_OPTION) in get_identity_information()
5914 dev->extension = SANE_TRUE; in get_identity_information()
5919 dev->extension = SANE_FALSE; in get_identity_information()
5922 dev->TPU = SANE_FALSE; in get_identity_information()
5923 dev->ADF = SANE_FALSE; in get_identity_information()
5935 sprintf(type_level, "%c%c", ident->type, ident->level); in get_identity_information()
5942 dev->cmd = &epson_cmd[n]; in get_identity_information()
5946 dev->cmd = &epson_cmd[EPSON_LEVEL_DEFAULT]; in get_identity_information()
5948 ident->type, ident->level, dev->cmd->level); in get_identity_information()
5951 s->hw->level = dev->cmd->level[1] - '0'; in get_identity_information()
5958 s->hw->res_list_size = 0; in get_identity_information()
5959 s->hw->res_list = in get_identity_information()
5960 (SANE_Int *) calloc (s->hw->res_list_size, sizeof (SANE_Int)); in get_identity_information()
5962 if (NULL == s->hw->res_list) in get_identity_information()
5971 int count = ident->count2 * 255 + ident->count1; in get_identity_information()
5975 int correction = sizeof (EpsonIdentRec) - sizeof (EpsonHdrRec); in get_identity_information()
5976 for (n = (count - correction), buf = ident->buf; n; n -= k, buf += k) in get_identity_information()
5984 s->hw->res_list_size++; in get_identity_information()
5985 s->hw->res_list = in get_identity_information()
5986 (SANE_Int *) realloc (s->hw->res_list, in get_identity_information()
5987 s->hw->res_list_size * sizeof (SANE_Int)); in get_identity_information()
5989 if (NULL == s->hw->res_list) in get_identity_information()
5995 s->hw->res_list[s->hw->res_list_size - 1] = (SANE_Int) val; in get_identity_information()
6010 * Check for Perfection 4990 photo/GT-X800 scanner. in get_identity_information()
6017 if (s->hw->cmd->request_extended_status != 0) in get_identity_information()
6024 params[1] = s->hw->cmd->request_extended_status; in get_identity_information()
6028 buf = &head->buf[0x1A]; in get_identity_information()
6030 if (strncmp((char *) buf,"GT-X800",7) == 0) in get_identity_information()
6034 s->hw->res_list_size++; in get_identity_information()
6035 s->hw->res_list = in get_identity_information()
6036 (SANE_Int *) realloc (s->hw->res_list, in get_identity_information()
6037 s->hw->res_list_size * sizeof (SANE_Int)); in get_identity_information()
6039 if (NULL == s->hw->res_list) in get_identity_information()
6045 s->hw->res_list[s->hw->res_list_size - 1] = (SANE_Int) val; in get_identity_information()
6050 DBG (1, "maximum scan area GT-X800: x %d y %d\n", x, y); in get_identity_information()
6064 dev->dpi_range.min = s->hw->res_list[0]; in get_identity_information()
6065 dev->dpi_range.max = s->hw->res_list[s->hw->res_list_size - 1]; in get_identity_information()
6066 dev->dpi_range.quant = 0; in get_identity_information()
6068 dev->fbf_x_range.min = 0; in get_identity_information()
6069 dev->fbf_x_range.max = SANE_FIX (x * 25.4 / dev->dpi_range.max); in get_identity_information()
6070 dev->fbf_x_range.quant = 0; in get_identity_information()
6072 dev->fbf_y_range.min = 0; in get_identity_information()
6073 dev->fbf_y_range.max = SANE_FIX (y * 25.4 / dev->dpi_range.max); in get_identity_information()
6074 dev->fbf_y_range.quant = 0; in get_identity_information()
6077 SANE_UNFIX (dev->fbf_x_range.min), SANE_UNFIX (dev->fbf_y_range.min), in get_identity_information()
6078 SANE_UNFIX (dev->fbf_x_range.max), in get_identity_information()
6079 SANE_UNFIX (dev->fbf_y_range.max)); in get_identity_information()
6088 s->hw->resolution_list = in get_identity_information()
6089 malloc ((s->hw->res_list_size + 1) * sizeof (SANE_Word)); in get_identity_information()
6091 if (s->hw->resolution_list == NULL) in get_identity_information()
6096 *(s->hw->resolution_list) = s->hw->res_list_size; in get_identity_information()
6097 memcpy (&(s->hw->resolution_list[1]), s->hw->res_list, in get_identity_information()
6098 s->hw->res_list_size * sizeof (SANE_Word)); in get_identity_information()
6102 s->val[OPT_LIMIT_RESOLUTION].w = SANE_FALSE; in get_identity_information()
6128 if (s->hw->cmd->request_identity2 == 0) in get_identity2_information()
6132 param[1] = s->hw->cmd->request_identity2; in get_identity2_information()
6152 s->hw->optical_res = buf[1] << 8 | buf[0]; in get_identity2_information()
6163 s->hw->max_line_distance = buf[4]; in get_identity2_information()
6181 * If the s->ptr pointer is not NULL, then a scan operation in sane_cancel()
6182 * was started and if s->eof is FALSE, it was not finished. in sane_cancel()
6185 if (s->buf != NULL) in sane_cancel()
6191 dummy = malloc (s->params.bytes_per_line); in sane_cancel()
6202 s->canceling = SANE_TRUE; in sane_cancel()
6204 while (!s->eof && in sane_cancel()
6206 s->params.bytes_per_line, in sane_cancel()
6230 if (s->hw->cmd->request_focus_position == 0) in request_focus_position()
6234 param[1] = s->hw->cmd->request_focus_position; in request_focus_position()
6280 if (s->hw->cmd->request_push_button_status == 0) in request_push_button_status()
6287 param[1] = s->hw->cmd->request_push_button_status; in request_push_button_status()
6320 /* re-create the list */ in filter_resolution_list()
6322 if (s->val[OPT_LIMIT_RESOLUTION].w == SANE_TRUE) in filter_resolution_list()
6332 for (i = 1; i <= s->hw->res_list_size; i++) in filter_resolution_list()
6335 res = s->hw->res_list[i]; in filter_resolution_list()
6341 s->hw->resolution_list[new_size] = s->hw->res_list[i]; in filter_resolution_list()
6344 if (res == s->val[OPT_RESOLUTION].w) in filter_resolution_list()
6350 s->hw->resolution_list[0] = new_size; in filter_resolution_list()
6356 if (s->val[OPT_RESOLUTION].w < s->hw->resolution_list[i]) in filter_resolution_list()
6358 s->val[OPT_RESOLUTION].w = s->hw->resolution_list[i]; in filter_resolution_list()
6368 s->hw->resolution_list[0] = s->hw->res_list_size; in filter_resolution_list()
6369 memcpy (&(s->hw->resolution_list[1]), s->hw->res_list, in filter_resolution_list()
6370 s->hw->res_list_size * sizeof (SANE_Word)); in filter_resolution_list()
6379 * not supported - for asynchronous I/O
6395 * not supported - for asynchronous I/O