1/* sane - Scanner Access Now Easy. 2 3 Copyright (C) 2007-2012 stef.dev@free.fr 4 5 This file is part of the SANE package. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <https://www.gnu.org/licenses/>. 19 20 As a special exception, the authors of SANE give permission for 21 additional uses of the libraries contained in this release of SANE. 22 23 The exception is that, if you link a SANE library with other files 24 to produce an executable, this does not by itself cause the 25 resulting executable to be covered by the GNU General Public 26 License. Your use of that executable is in no way restricted on 27 account of linking the SANE library code into it. 28 29 This exception does not, however, invalidate any other reasons why 30 the executable file might be covered by the GNU General Public 31 License. 32 33 If you submit changes to SANE to the maintainers to be included in 34 a subsequent release, you agree by submitting the changes that 35 those changes may be distributed with this exception intact. 36 37 If you write modifications of your own for SANE, it is your choice 38 whether to permit this exception to apply to your modifications. 39 If you do not wish that, delete this exception notice. 40*/ 41 42#ifndef RTS8891_H 43#define RTS8891_H 44 45#define ENABLE(OPTION) s->opt[OPTION].cap &= ~SANE_CAP_INACTIVE 46#define DISABLE(OPTION) s->opt[OPTION].cap |= SANE_CAP_INACTIVE 47#define IS_ACTIVE(OPTION) (((s->opt[OPTION].cap) & SANE_CAP_INACTIVE) == 0) 48 49#define RTS8891_CONFIG_FILE "rts8891.conf" 50 51#ifndef SANE_I18N 52#define SANE_I18N(text) text 53#endif /* */ 54 55#define COLOR_MODE SANE_VALUE_SCAN_MODE_COLOR 56#define GRAY_MODE SANE_VALUE_SCAN_MODE_GRAY 57#define LINEART_MODE SANE_VALUE_SCAN_MODE_LINEART 58 59/* preferred number of bytes to keep in buffer */ 60#define PREFERED_BUFFER_SIZE 2097152 /* all scanner memory */ 61 62/** List of SANE options 63 */ 64enum Rts8891_Option 65{ OPT_NUM_OPTS = 0, 66 OPT_STANDARD_GROUP, 67 OPT_MODE, 68 OPT_PREVIEW, 69 OPT_RESOLUTION, 70 71 OPT_GEOMETRY_GROUP, 72 OPT_TL_X, /* top-left x */ 73 OPT_TL_Y, /* top-left y */ 74 OPT_BR_X, /* bottom-right x */ 75 OPT_BR_Y, /* bottom-right y */ 76 77 /* advanced image enhancement options */ 78 OPT_ENHANCEMENT_GROUP, 79 OPT_THRESHOLD, 80 OPT_CUSTOM_GAMMA, /* toggle to enable custom gamma tables */ 81 OPT_GAMMA_VECTOR, 82 OPT_GAMMA_VECTOR_R, 83 OPT_GAMMA_VECTOR_G, 84 OPT_GAMMA_VECTOR_B, 85 86 /* advanced options */ 87 OPT_ADVANCED_GROUP, 88 OPT_LAMP_ON, 89 OPT_LAMP_OFF, 90 91 /* button group */ 92 OPT_SENSOR_GROUP, 93 OPT_BUTTON_1, 94 OPT_BUTTON_2, 95 OPT_BUTTON_3, 96 OPT_BUTTON_4, 97 OPT_BUTTON_5, 98 OPT_BUTTON_6, 99 OPT_BUTTON_7, 100 OPT_BUTTON_8, 101 OPT_BUTTON_9, 102 OPT_BUTTON_10, 103 OPT_BUTTON_11, 104 /* must come last: */ 105 NUM_OPTIONS 106}; 107 108/** 109 * enumeration of configuration options 110 */ 111enum Rts8891_Configure_Option 112{ 113 CFG_MODEL_NUMBER = 0, /* first option number must be zero */ 114 CFG_SENSOR_NUMBER, 115 CFG_ALLOW_SHARING, 116 NUM_CFG_OPTIONS /* MUST be last */ 117}; 118 119/** Scanner object. This struct holds information useful for 120 * the functions defined in SANE's standard. Information closer 121 * to the hardware are in the Rts8891_Device structure. There is 122 * as many session structure than frontends using the scanner. 123 */ 124typedef struct Rts8891_Session 125{ 126 127 /**< Next handle in linked list */ 128 struct Rts8891_Session *next; 129 130 /**< Low-level device object */ 131 struct Rts8891_Device *dev; 132 133 /* SANE data */ 134 135 /**< We are currently scanning */ 136 SANE_Bool scanning; 137 /**< Data read is in non blocking mode */ 138 SANE_Bool non_blocking; 139 /**< Gray scans are emulated */ 140 SANE_Bool emulated_gray; 141 SANE_Option_Descriptor opt[NUM_OPTIONS]; 142 /**< Option descriptors */ 143 Option_Value val[NUM_OPTIONS]; /**< Option values */ 144 SANE_Parameters params; /**< SANE Parameters */ 145 146 /**< bytes to send to frontend for the scan */ 147 SANE_Int to_send; 148 149 /**< bytes currently sent to frontend during the scan */ 150 SANE_Int sent; 151} Rts8891_Session; 152 153#endif /* not RTS8891_H */ 154