1 /* sane - Scanner Access Now Easy. 2 Copyright (C) 2007 Ilia Sotnikov <hostcc@gmail.com> 3 HP ScanJet 4570c support by Markham Thomas 4 This file is part of the SANE package. 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License as 8 published by the Free Software Foundation; either version 2 of the 9 License, or (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <https://www.gnu.org/licenses/>. 18 19 As a special exception, the authors of SANE give permission for 20 additional uses of the libraries contained in this release of SANE. 21 22 The exception is that, if you link a SANE library with other files 23 to produce an executable, this does not by itself cause the 24 resulting executable to be covered by the GNU General Public 25 License. Your use of that executable is in no way restricted on 26 account of linking the SANE library code into it. 27 28 This exception does not, however, invalidate any other reasons why 29 the executable file might be covered by the GNU General Public 30 License. 31 32 If you submit changes to SANE to the maintainers to be included in 33 a subsequent release, you agree by submitting the changes that 34 those changes may be distributed with this exception intact. 35 36 If you write modifications of your own for SANE, it is your choice 37 whether to permit this exception to apply to your modifications. 38 If you do not wish that, delete this exception notice. 39 40 This file is part of a SANE backend for 41 HP ScanJet 4500C/4570C/5500C/5550C/5590/7650 Scanners 42 */ 43 44 #ifndef HP5590_H 45 #define HP5590_H 46 47 #include "hp5590_low.h" 48 49 #define TMA_MAX_X_INCHES 1.69 50 #define TMA_MAX_Y_INCHES 6 51 52 #define ADF_MAX_Y_INCHES 14 53 54 enum hp_scanner_types 55 { 56 SCANNER_NONE = 0, 57 SCANNER_HP4570, 58 SCANNER_HP5550, 59 SCANNER_HP5590, 60 SCANNER_HP7650 61 }; 62 63 enum scan_sources 64 { 65 SOURCE_NONE = 1, 66 SOURCE_FLATBED, 67 SOURCE_ADF, 68 SOURCE_ADF_DUPLEX, 69 SOURCE_TMA_NEGATIVES, 70 SOURCE_TMA_SLIDES 71 }; 72 73 enum scan_modes 74 { 75 MODE_NORMAL = 1, 76 MODE_PREVIEW 77 }; 78 79 enum color_depths 80 { 81 DEPTH_BW = 1, 82 DEPTH_GRAY, 83 DEPTH_COLOR_24, 84 DEPTH_COLOR_48 85 }; 86 87 enum button_status 88 { 89 BUTTON_NONE = 1, 90 BUTTON_POWER, 91 BUTTON_SCAN, 92 BUTTON_COLLECT, 93 BUTTON_FILE, 94 BUTTON_EMAIL, 95 BUTTON_COPY, 96 BUTTON_UP, 97 BUTTON_DOWN, 98 BUTTON_MODE, 99 BUTTON_CANCEL 100 }; 101 102 enum color_led_status 103 { 104 LED_COLOR = 1, 105 LED_BLACKWHITE 106 }; 107 108 enum hp5590_lamp_state 109 { 110 LAMP_STATE_TURNOFF = 1, 111 LAMP_STATE_TURNON, 112 LAMP_STATE_SET_TURNOFF_TIME, 113 LAMP_STATE_SET_TURNOFF_TIME_LONG 114 }; 115 116 struct hp5590_model 117 { 118 enum hp_scanner_types scanner_type; 119 unsigned int usb_vendor_id; 120 unsigned int usb_product_id; 121 const char *vendor_id; 122 const char *model; 123 const char *kind; 124 enum proto_flags proto_flags; 125 }; 126 127 #define FEATURE_NONE 0 128 #define FEATURE_ADF 1 << 0 129 #define FEATURE_TMA 1 << 1 130 #define FEATURE_LCD 1 << 2 131 132 struct scanner_info 133 { 134 const char *model; 135 const char *kind; 136 unsigned int features; 137 const char *fw_version; 138 unsigned int max_dpi_x; 139 unsigned int max_dpi_y; 140 unsigned int max_pixels_x; 141 unsigned int max_pixels_y; 142 float max_size_x; 143 float max_size_y; 144 unsigned int max_motor_param; 145 unsigned int normal_motor_param; 146 }; 147 148 static SANE_Status hp5590_model_def (enum hp_scanner_types scanner_type, 149 const struct hp5590_model ** model); 150 static SANE_Status hp5590_vendor_product_id (enum hp_scanner_types scanner_type, 151 SANE_Word * vendor_id, 152 SANE_Word * product_id); 153 static SANE_Status hp5590_init_scanner (SANE_Int dn, 154 enum proto_flags proto_flags, 155 struct scanner_info **info, 156 enum hp_scanner_types scanner_type); 157 static SANE_Status hp5590_power_status (SANE_Int dn, 158 enum proto_flags proto_flags); 159 static SANE_Status hp5590_read_max_scan_count (SANE_Int dn, 160 enum proto_flags proto_flags, 161 unsigned int *max_count); 162 static SANE_Status hp5590_select_source_and_wakeup (SANE_Int dn, 163 enum proto_flags proto_flags, 164 enum scan_sources source, 165 SANE_Bool extend_lamp_timeout); 166 static SANE_Status hp5590_stop_scan (SANE_Int dn, 167 enum proto_flags proto_flags); 168 static SANE_Status hp5590_read_scan_count (SANE_Int dn, 169 enum proto_flags proto_flags, 170 unsigned int *count); 171 static SANE_Status hp5590_set_scan_params (SANE_Int dn, 172 enum proto_flags proto_flags, 173 struct scanner_info *scanner_info, 174 unsigned int top_x, unsigned int top_y, 175 unsigned int width, unsigned int height, 176 unsigned int dpi, 177 enum color_depths color_depth, 178 enum scan_modes scan_mode, 179 enum scan_sources scan_source); 180 static SANE_Status hp5590_send_forward_calibration_maps (SANE_Int dn, 181 enum proto_flags proto_flags); 182 static SANE_Status hp5590_send_reverse_calibration_map (SANE_Int dn, 183 enum proto_flags proto_flags); 184 static SANE_Status hp5590_inc_scan_count (SANE_Int dn, 185 enum proto_flags proto_flags); 186 static SANE_Status hp5590_start_scan (SANE_Int dn, 187 enum proto_flags proto_flags); 188 static SANE_Status hp5590_read (SANE_Int dn, 189 enum proto_flags proto_flags, 190 unsigned char *bytes, 191 unsigned int size, void *state); 192 static SANE_Status hp5590_read_buttons (SANE_Int dn, 193 enum proto_flags proto_flags, 194 enum button_status *status); 195 static SANE_Status hp5590_read_part_number (SANE_Int dn, 196 enum proto_flags proto_flags); 197 static SANE_Status hp5590_calc_pixel_bits (unsigned int dpi, 198 enum color_depths color_depth, 199 unsigned int *pixel_bits); 200 static SANE_Status hp5590_is_data_available (SANE_Int dn, 201 enum proto_flags proto_flags); 202 static SANE_Status hp5590_reset_scan_head (SANE_Int dn, 203 enum proto_flags proto_flags); 204 #endif /* HP5590_H */ 205 /* vim: sw=2 ts=8 206 */ 207