1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy. 2141cc406Sopenharmony_ci 3141cc406Sopenharmony_ci Copyright (C) 1998, 1999 Kazuya Fukuda, Abel Deuring 4141cc406Sopenharmony_ci 5141cc406Sopenharmony_ci This file is part of the SANE package. 6141cc406Sopenharmony_ci 7141cc406Sopenharmony_ci This program is free software; you can redistribute it and/or 8141cc406Sopenharmony_ci modify it under the terms of the GNU General Public License as 9141cc406Sopenharmony_ci published by the Free Software Foundation; either version 2 of the 10141cc406Sopenharmony_ci License, or (at your option) any later version. 11141cc406Sopenharmony_ci 12141cc406Sopenharmony_ci This program is distributed in the hope that it will be useful, but 13141cc406Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 14141cc406Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15141cc406Sopenharmony_ci General Public License for more details. 16141cc406Sopenharmony_ci 17141cc406Sopenharmony_ci You should have received a copy of the GNU General Public License 18141cc406Sopenharmony_ci along with this program. If not, see <https://www.gnu.org/licenses/>. 19141cc406Sopenharmony_ci 20141cc406Sopenharmony_ci As a special exception, the authors of SANE give permission for 21141cc406Sopenharmony_ci additional uses of the libraries contained in this release of SANE. 22141cc406Sopenharmony_ci 23141cc406Sopenharmony_ci The exception is that, if you link a SANE library with other files 24141cc406Sopenharmony_ci to produce an executable, this does not by itself cause the 25141cc406Sopenharmony_ci resulting executable to be covered by the GNU General Public 26141cc406Sopenharmony_ci License. Your use of that executable is in no way restricted on 27141cc406Sopenharmony_ci account of linking the SANE library code into it. 28141cc406Sopenharmony_ci 29141cc406Sopenharmony_ci This exception does not, however, invalidate any other reasons why 30141cc406Sopenharmony_ci the executable file might be covered by the GNU General Public 31141cc406Sopenharmony_ci License. 32141cc406Sopenharmony_ci 33141cc406Sopenharmony_ci If you submit changes to SANE to the maintainers to be included in 34141cc406Sopenharmony_ci a subsequent release, you agree by submitting the changes that 35141cc406Sopenharmony_ci those changes may be distributed with this exception intact. 36141cc406Sopenharmony_ci 37141cc406Sopenharmony_ci If you write modifications of your own for SANE, it is your choice 38141cc406Sopenharmony_ci whether to permit this exception to apply to your modifications. 39141cc406Sopenharmony_ci If you do not wish that, delete this exception notice. */ 40141cc406Sopenharmony_ci 41141cc406Sopenharmony_ci#ifndef sharp_h 42141cc406Sopenharmony_ci#define sharp_h 1 43141cc406Sopenharmony_ci 44141cc406Sopenharmony_ci#include <sys/types.h> 45141cc406Sopenharmony_ci 46141cc406Sopenharmony_ci/* default values for configurable options. 47141cc406Sopenharmony_ci Though these options are only meaningful if USE_FORK is defined, 48141cc406Sopenharmony_ci they are 49141cc406Sopenharmony_ci DEFAULT_BUFFERS: number of buffers allocated as shared memory 50141cc406Sopenharmony_ci for the data transfer from reader_process to 51141cc406Sopenharmony_ci read_data. The minimum value is 2 52141cc406Sopenharmony_ci DEFAULT_BUFSIZE: default size of one buffer. Must be greater 53141cc406Sopenharmony_ci than zero. 54141cc406Sopenharmony_ci DEFAULT_QUEUED_READS: number of read requests queued by 55141cc406Sopenharmony_ci sanei_scsi_req_enter. Since queued read requests 56141cc406Sopenharmony_ci are currently only supported for Linux and 57141cc406Sopenharmony_ci DomainOS, this value should automatically be set 58141cc406Sopenharmony_ci dependent on the target OS... 59141cc406Sopenharmony_ci For Linux, 2 is the optimum; for DomainOS, I 60141cc406Sopenharmony_ci don't have any recommendation; other OS 61141cc406Sopenharmony_ci should use the value zero. 62141cc406Sopenharmony_ci 63141cc406Sopenharmony_ci The value for DEFAULT_BUFSIZE is probably too Linux-oriented... 64141cc406Sopenharmony_ci*/ 65141cc406Sopenharmony_ci 66141cc406Sopenharmony_ci#define DEFAULT_BUFFERS 12 67141cc406Sopenharmony_ci#define DEFAULT_BUFSIZE 128 * 1024 68141cc406Sopenharmony_ci#define DEFAULT_QUEUED_READS 2 69141cc406Sopenharmony_ci 70141cc406Sopenharmony_citypedef enum 71141cc406Sopenharmony_ci { 72141cc406Sopenharmony_ci OPT_NUM_OPTS = 0, 73141cc406Sopenharmony_ci 74141cc406Sopenharmony_ci OPT_MODE_GROUP, 75141cc406Sopenharmony_ci OPT_MODE, 76141cc406Sopenharmony_ci OPT_HALFTONE, 77141cc406Sopenharmony_ci OPT_PAPER, 78141cc406Sopenharmony_ci OPT_SCANSOURCE, 79141cc406Sopenharmony_ci OPT_GAMMA, 80141cc406Sopenharmony_ci#ifdef USE_CUSTOM_GAMMA 81141cc406Sopenharmony_ci OPT_CUSTOM_GAMMA, 82141cc406Sopenharmony_ci#endif 83141cc406Sopenharmony_ci OPT_SPEED, 84141cc406Sopenharmony_ci 85141cc406Sopenharmony_ci OPT_RESOLUTION_GROUP, 86141cc406Sopenharmony_ci#ifdef USE_RESOLUTION_LIST 87141cc406Sopenharmony_ci OPT_RESOLUTION_LIST, 88141cc406Sopenharmony_ci#endif 89141cc406Sopenharmony_ci OPT_X_RESOLUTION, 90141cc406Sopenharmony_ci#ifdef USE_SEPARATE_Y_RESOLUTION 91141cc406Sopenharmony_ci OPT_Y_RESOLUTION, 92141cc406Sopenharmony_ci#endif 93141cc406Sopenharmony_ci 94141cc406Sopenharmony_ci OPT_GEOMETRY_GROUP, 95141cc406Sopenharmony_ci OPT_TL_X, /* top-left x */ 96141cc406Sopenharmony_ci OPT_TL_Y, /* top-left y */ 97141cc406Sopenharmony_ci OPT_BR_X, /* bottom-right x */ 98141cc406Sopenharmony_ci OPT_BR_Y, /* bottom-right y */ 99141cc406Sopenharmony_ci 100141cc406Sopenharmony_ci OPT_ENHANCEMENT_GROUP, 101141cc406Sopenharmony_ci OPT_EDGE_EMPHASIS, 102141cc406Sopenharmony_ci OPT_THRESHOLD, 103141cc406Sopenharmony_ci#ifdef USE_COLOR_THRESHOLD 104141cc406Sopenharmony_ci OPT_THRESHOLD_R, 105141cc406Sopenharmony_ci OPT_THRESHOLD_G, 106141cc406Sopenharmony_ci OPT_THRESHOLD_B, 107141cc406Sopenharmony_ci#endif 108141cc406Sopenharmony_ci OPT_LIGHTCOLOR, 109141cc406Sopenharmony_ci OPT_PREVIEW, 110141cc406Sopenharmony_ci 111141cc406Sopenharmony_ci#ifdef USE_CUSTOM_GAMMA 112141cc406Sopenharmony_ci OPT_GAMMA_VECTOR, 113141cc406Sopenharmony_ci OPT_GAMMA_VECTOR_R, 114141cc406Sopenharmony_ci OPT_GAMMA_VECTOR_G, 115141cc406Sopenharmony_ci OPT_GAMMA_VECTOR_B, 116141cc406Sopenharmony_ci#endif 117141cc406Sopenharmony_ci /* must come last: */ 118141cc406Sopenharmony_ci NUM_OPTIONS 119141cc406Sopenharmony_ci } 120141cc406Sopenharmony_ciSHARP_Option; 121141cc406Sopenharmony_ci 122141cc406Sopenharmony_ci#ifdef USE_FORK 123141cc406Sopenharmony_ci 124141cc406Sopenharmony_ci/* status defines for a buffer: 125141cc406Sopenharmony_ci buffer not used / read request queued / buffer contains data 126141cc406Sopenharmony_ci*/ 127141cc406Sopenharmony_ci#define SHM_EMPTY 0 128141cc406Sopenharmony_ci#define SHM_BUSY 1 129141cc406Sopenharmony_ci#define SHM_FULL 2 130141cc406Sopenharmony_citypedef struct SHARP_shmem_ctl 131141cc406Sopenharmony_ci { 132141cc406Sopenharmony_ci int shm_status; /* can be SHM_EMPTY, SHM_BUSY, SHM_FULL */ 133141cc406Sopenharmony_ci size_t used; /* number of bytes successfully read from scanner */ 134141cc406Sopenharmony_ci size_t nreq; /* number of bytes requested from scanner */ 135141cc406Sopenharmony_ci size_t start; /* index of the begin of used area of the buffer */ 136141cc406Sopenharmony_ci void *qid; 137141cc406Sopenharmony_ci SANE_Byte *buffer; 138141cc406Sopenharmony_ci } 139141cc406Sopenharmony_ciSHARP_shmem_ctl; 140141cc406Sopenharmony_ci 141141cc406Sopenharmony_citypedef struct SHARP_rdr_ctl 142141cc406Sopenharmony_ci { 143141cc406Sopenharmony_ci int cancel; /* 1 = flag for the reader process to cancel */ 144141cc406Sopenharmony_ci int running; /* 1 indicates that the reader process is alive */ 145141cc406Sopenharmony_ci SANE_Status status; /* return status of the reader process */ 146141cc406Sopenharmony_ci SHARP_shmem_ctl *buf_ctl; 147141cc406Sopenharmony_ci } 148141cc406Sopenharmony_ciSHARP_rdr_ctl; 149141cc406Sopenharmony_ci#endif /* USE_FORK */ 150141cc406Sopenharmony_ci 151141cc406Sopenharmony_citypedef enum 152141cc406Sopenharmony_ci { 153141cc406Sopenharmony_ci /* JX250, JX330, JX350, JX610 are used as array indices, so the 154141cc406Sopenharmony_ci corresponding numbers should start at 0 155141cc406Sopenharmony_ci */ 156141cc406Sopenharmony_ci unknown = -1, 157141cc406Sopenharmony_ci JX250, 158141cc406Sopenharmony_ci JX320, 159141cc406Sopenharmony_ci JX330, 160141cc406Sopenharmony_ci JX350, 161141cc406Sopenharmony_ci JX610 162141cc406Sopenharmony_ci } 163141cc406Sopenharmony_ciSHARP_Model; 164141cc406Sopenharmony_ci 165141cc406Sopenharmony_citypedef struct SHARP_Info 166141cc406Sopenharmony_ci { 167141cc406Sopenharmony_ci SANE_Range xres_range; 168141cc406Sopenharmony_ci SANE_Range yres_range; 169141cc406Sopenharmony_ci SANE_Range tl_x_ranges[3]; /* normal / FSU / ADF */ 170141cc406Sopenharmony_ci SANE_Range br_x_ranges[3]; /* normal / FSU / ADF */ 171141cc406Sopenharmony_ci SANE_Range tl_y_ranges[3]; /* normal / FSU / ADF */ 172141cc406Sopenharmony_ci SANE_Range br_y_ranges[3]; /* normal / FSU / ADF */ 173141cc406Sopenharmony_ci SANE_Range threshold_range; 174141cc406Sopenharmony_ci 175141cc406Sopenharmony_ci SANE_Int xres_default; 176141cc406Sopenharmony_ci SANE_Int yres_default; 177141cc406Sopenharmony_ci SANE_Int x_default; 178141cc406Sopenharmony_ci SANE_Int y_default; 179141cc406Sopenharmony_ci SANE_Int bmu; 180141cc406Sopenharmony_ci SANE_Int mud; 181141cc406Sopenharmony_ci SANE_Int adf_fsu_installed; 182141cc406Sopenharmony_ci SANE_String_Const scansources[5]; 183141cc406Sopenharmony_ci size_t buffers; 184141cc406Sopenharmony_ci size_t bufsize; 185141cc406Sopenharmony_ci int wanted_bufsize; 186141cc406Sopenharmony_ci size_t queued_reads; 187141cc406Sopenharmony_ci int complain_on_errors; 188141cc406Sopenharmony_ci /* default scan mode: 189141cc406Sopenharmony_ci -1 -> "automatic": Use the ADF, if installed, 190141cc406Sopenharmony_ci else use the FSU, if installed. 191141cc406Sopenharmony_ci or: SCAN_ADF, SCAN_FSU, SCAN_SIMPLE 192141cc406Sopenharmony_ci */ 193141cc406Sopenharmony_ci int default_scan_mode; 194141cc406Sopenharmony_ci } 195141cc406Sopenharmony_ciSHARP_Info; 196141cc406Sopenharmony_ci 197141cc406Sopenharmony_ci#define COMPLAIN_ON_FSU_ERROR 2 198141cc406Sopenharmony_ci#define COMPLAIN_ON_ADF_ERROR 1 199141cc406Sopenharmony_citypedef struct SHARP_Sense_Data 200141cc406Sopenharmony_ci { 201141cc406Sopenharmony_ci SHARP_Model model; 202141cc406Sopenharmony_ci /* flag, if conditions like "paper jam" or "cover open" 203141cc406Sopenharmony_ci are considered as an error. Should be 0 for attach, else 204141cc406Sopenharmony_ci a frontend might refuse to start, if the scanner returns 205141cc406Sopenharmony_ci these errors. 206141cc406Sopenharmony_ci */ 207141cc406Sopenharmony_ci int complain_on_errors; 208141cc406Sopenharmony_ci /* Linux returns only 16 bytes of sense data... */ 209141cc406Sopenharmony_ci u_char sb[16]; 210141cc406Sopenharmony_ci } 211141cc406Sopenharmony_ciSHARP_Sense_Data; 212141cc406Sopenharmony_ci 213141cc406Sopenharmony_citypedef struct SHARP_Device 214141cc406Sopenharmony_ci { 215141cc406Sopenharmony_ci struct SHARP_Device *next; 216141cc406Sopenharmony_ci SANE_Device sane; 217141cc406Sopenharmony_ci SHARP_Info info; 218141cc406Sopenharmony_ci /* xxx now part of sense data SHARP_Model model; */ 219141cc406Sopenharmony_ci SHARP_Sense_Data sensedat; 220141cc406Sopenharmony_ci } 221141cc406Sopenharmony_ciSHARP_Device; 222141cc406Sopenharmony_ci 223141cc406Sopenharmony_citypedef struct SHARP_New_Device 224141cc406Sopenharmony_ci { 225141cc406Sopenharmony_ci struct SHARP_Device *dev; 226141cc406Sopenharmony_ci struct SHARP_New_Device *next; 227141cc406Sopenharmony_ci } 228141cc406Sopenharmony_ciSHARP_New_Device; 229141cc406Sopenharmony_ci 230141cc406Sopenharmony_citypedef struct SHARP_Scanner 231141cc406Sopenharmony_ci { 232141cc406Sopenharmony_ci struct SHARP_Scanner *next; 233141cc406Sopenharmony_ci int fd; 234141cc406Sopenharmony_ci SHARP_Device *dev; 235141cc406Sopenharmony_ci SANE_Option_Descriptor opt[NUM_OPTIONS]; 236141cc406Sopenharmony_ci Option_Value val[NUM_OPTIONS]; 237141cc406Sopenharmony_ci SANE_Parameters params; 238141cc406Sopenharmony_ci 239141cc406Sopenharmony_ci int get_params_called; 240141cc406Sopenharmony_ci SANE_Byte *buffer; /* for color data re-ordering, required for JX 250 */ 241141cc406Sopenharmony_ci SANE_Int buf_used; 242141cc406Sopenharmony_ci SANE_Int buf_pos; 243141cc406Sopenharmony_ci SANE_Int modes; 244141cc406Sopenharmony_ci SANE_Int xres; 245141cc406Sopenharmony_ci SANE_Int yres; 246141cc406Sopenharmony_ci SANE_Int ulx; 247141cc406Sopenharmony_ci SANE_Int uly; 248141cc406Sopenharmony_ci SANE_Int width; 249141cc406Sopenharmony_ci SANE_Int length; 250141cc406Sopenharmony_ci SANE_Int threshold; 251141cc406Sopenharmony_ci SANE_Int image_composition; 252141cc406Sopenharmony_ci SANE_Int bpp; 253141cc406Sopenharmony_ci SANE_Int halftone; 254141cc406Sopenharmony_ci SANE_Bool reverse; 255141cc406Sopenharmony_ci SANE_Bool speed; 256141cc406Sopenharmony_ci SANE_Int gamma; 257141cc406Sopenharmony_ci SANE_Int edge; 258141cc406Sopenharmony_ci SANE_Int lightcolor; 259141cc406Sopenharmony_ci SANE_Int adf_fsu_mode; /* mode selected by user */ 260141cc406Sopenharmony_ci SANE_Int adf_scan; /* flag, if the actual scan is an ADF scan */ 261141cc406Sopenharmony_ci 262141cc406Sopenharmony_ci size_t bytes_to_read; 263141cc406Sopenharmony_ci size_t max_lines_to_read; 264141cc406Sopenharmony_ci size_t unscanned_lines; 265141cc406Sopenharmony_ci SANE_Bool scanning; 266141cc406Sopenharmony_ci SANE_Bool busy; 267141cc406Sopenharmony_ci SANE_Bool cancel; 268141cc406Sopenharmony_ci#ifdef USE_CUSTOM_GAMMA 269141cc406Sopenharmony_ci SANE_Int gamma_table[4][256]; 270141cc406Sopenharmony_ci#endif 271141cc406Sopenharmony_ci#ifdef USE_FORK 272141cc406Sopenharmony_ci pid_t reader_pid; 273141cc406Sopenharmony_ci SHARP_rdr_ctl *rdr_ctl; 274141cc406Sopenharmony_ci int shmid; 275141cc406Sopenharmony_ci size_t read_buff; /* index of the buffer actually used by read_data */ 276141cc406Sopenharmony_ci#endif /* USE_FORK */ 277141cc406Sopenharmony_ci } 278141cc406Sopenharmony_ciSHARP_Scanner; 279141cc406Sopenharmony_ci 280141cc406Sopenharmony_citypedef struct SHARP_Send 281141cc406Sopenharmony_ci{ 282141cc406Sopenharmony_ci SANE_Int dtc; 283141cc406Sopenharmony_ci SANE_Int dtq; 284141cc406Sopenharmony_ci SANE_Int length; 285141cc406Sopenharmony_ci SANE_Byte *data; 286141cc406Sopenharmony_ci} 287141cc406Sopenharmony_ciSHARP_Send; 288141cc406Sopenharmony_ci 289141cc406Sopenharmony_citypedef struct WPDH 290141cc406Sopenharmony_ci{ 291141cc406Sopenharmony_ci u_char wpdh[6]; 292141cc406Sopenharmony_ci u_char wdl[2]; 293141cc406Sopenharmony_ci} 294141cc406Sopenharmony_ciWPDH; 295141cc406Sopenharmony_ci 296141cc406Sopenharmony_citypedef struct WDB 297141cc406Sopenharmony_ci{ 298141cc406Sopenharmony_ci SANE_Byte wid; 299141cc406Sopenharmony_ci SANE_Byte autobit; 300141cc406Sopenharmony_ci SANE_Byte x_res[2]; 301141cc406Sopenharmony_ci SANE_Byte y_res[2]; 302141cc406Sopenharmony_ci 303141cc406Sopenharmony_ci SANE_Byte x_ul[4]; 304141cc406Sopenharmony_ci SANE_Byte y_ul[4]; 305141cc406Sopenharmony_ci SANE_Byte width[4]; 306141cc406Sopenharmony_ci SANE_Byte length[4]; 307141cc406Sopenharmony_ci 308141cc406Sopenharmony_ci SANE_Byte brightness; 309141cc406Sopenharmony_ci SANE_Byte threshold; 310141cc406Sopenharmony_ci SANE_Byte null_1; 311141cc406Sopenharmony_ci 312141cc406Sopenharmony_ci SANE_Byte image_composition; 313141cc406Sopenharmony_ci SANE_Byte bpp; 314141cc406Sopenharmony_ci 315141cc406Sopenharmony_ci SANE_Byte ht_pattern[2]; 316141cc406Sopenharmony_ci SANE_Byte rif_padding; 317141cc406Sopenharmony_ci SANE_Byte null_2[4]; 318141cc406Sopenharmony_ci SANE_Byte null_3[6]; 319141cc406Sopenharmony_ci SANE_Byte eletu; 320141cc406Sopenharmony_ci SANE_Byte zooming_x[2]; 321141cc406Sopenharmony_ci SANE_Byte zooming_y[2]; 322141cc406Sopenharmony_ci SANE_Byte lightness_r[2]; 323141cc406Sopenharmony_ci SANE_Byte lightness_g[2]; 324141cc406Sopenharmony_ci SANE_Byte lightness_b[2]; 325141cc406Sopenharmony_ci SANE_Byte lightness_bw[2]; 326141cc406Sopenharmony_ci 327141cc406Sopenharmony_ci} 328141cc406Sopenharmony_ciWDB; 329141cc406Sopenharmony_ci 330141cc406Sopenharmony_ci/* "extension" of the window descriptor block for the JX 330 */ 331141cc406Sopenharmony_citypedef struct WDBX330 332141cc406Sopenharmony_ci { 333141cc406Sopenharmony_ci SANE_Byte moire_reduction[2]; 334141cc406Sopenharmony_ci } 335141cc406Sopenharmony_ciWDBX330; 336141cc406Sopenharmony_ci 337141cc406Sopenharmony_ci/* "extension" of the window descriptor block for the JX 250 */ 338141cc406Sopenharmony_citypedef struct XWDBX250 339141cc406Sopenharmony_ci { 340141cc406Sopenharmony_ci SANE_Byte threshold_red; 341141cc406Sopenharmony_ci SANE_Byte threshold_green; 342141cc406Sopenharmony_ci SANE_Byte threshold_blue; 343141cc406Sopenharmony_ci SANE_Byte draft; 344141cc406Sopenharmony_ci SANE_Byte scanning_time[4]; 345141cc406Sopenharmony_ci SANE_Byte fixed_gamma; 346141cc406Sopenharmony_ci SANE_Byte x_axis_res_qualifier[2]; 347141cc406Sopenharmony_ci SANE_Byte y_axis_res_qualifier[2]; 348141cc406Sopenharmony_ci } 349141cc406Sopenharmony_ciWDBX250; 350141cc406Sopenharmony_ci 351141cc406Sopenharmony_citypedef struct window_param 352141cc406Sopenharmony_ci{ 353141cc406Sopenharmony_ci WPDH wpdh; 354141cc406Sopenharmony_ci WDB wdb; 355141cc406Sopenharmony_ci WDBX330 wdbx330; 356141cc406Sopenharmony_ci WDBX250 wdbx250; 357141cc406Sopenharmony_ci} 358141cc406Sopenharmony_ciwindow_param; 359141cc406Sopenharmony_ci 360141cc406Sopenharmony_citypedef struct mode_sense_param 361141cc406Sopenharmony_ci{ 362141cc406Sopenharmony_ci SANE_Byte mode_data_length; 363141cc406Sopenharmony_ci SANE_Byte mode_param_header2; 364141cc406Sopenharmony_ci SANE_Byte mode_param_header3; 365141cc406Sopenharmony_ci SANE_Byte mode_desciptor_length; 366141cc406Sopenharmony_ci SANE_Byte resereved[5]; 367141cc406Sopenharmony_ci SANE_Byte blocklength[3]; 368141cc406Sopenharmony_ci SANE_Byte page_code; 369141cc406Sopenharmony_ci SANE_Byte page_length; /* 6 */ 370141cc406Sopenharmony_ci SANE_Byte bmu; 371141cc406Sopenharmony_ci SANE_Byte res2; 372141cc406Sopenharmony_ci SANE_Byte mud[2]; 373141cc406Sopenharmony_ci SANE_Byte res3; 374141cc406Sopenharmony_ci SANE_Byte res4; 375141cc406Sopenharmony_ci} 376141cc406Sopenharmony_cimode_sense_param; 377141cc406Sopenharmony_ci 378141cc406Sopenharmony_citypedef struct mode_sense_subdevice 379141cc406Sopenharmony_ci{ 380141cc406Sopenharmony_ci /* This definition reflects the JX250. The JX330 would need a slightly 381141cc406Sopenharmony_ci different definition, but the bytes used right now (for ADF and FSU) 382141cc406Sopenharmony_ci are identical. 383141cc406Sopenharmony_ci */ 384141cc406Sopenharmony_ci SANE_Byte mode_data_length; 385141cc406Sopenharmony_ci SANE_Byte mode_param_header2; 386141cc406Sopenharmony_ci SANE_Byte mode_param_header3; 387141cc406Sopenharmony_ci SANE_Byte mode_desciptor_length; 388141cc406Sopenharmony_ci SANE_Byte res1[5]; 389141cc406Sopenharmony_ci SANE_Byte blocklength[3]; 390141cc406Sopenharmony_ci SANE_Byte page_code; 391141cc406Sopenharmony_ci SANE_Byte page_length; /* 0x1a */ 392141cc406Sopenharmony_ci SANE_Byte a_mode_type; 393141cc406Sopenharmony_ci SANE_Byte f_mode_type; 394141cc406Sopenharmony_ci SANE_Byte res2; 395141cc406Sopenharmony_ci SANE_Byte max_x[4]; 396141cc406Sopenharmony_ci SANE_Byte max_y[4]; 397141cc406Sopenharmony_ci SANE_Byte res3[2]; 398141cc406Sopenharmony_ci SANE_Byte x_basic_resolution[2]; 399141cc406Sopenharmony_ci SANE_Byte y_basic_resolution[2]; 400141cc406Sopenharmony_ci SANE_Byte x_max_resolution[2]; 401141cc406Sopenharmony_ci SANE_Byte y_max_resolution[2]; 402141cc406Sopenharmony_ci SANE_Byte x_min_resolution[2]; 403141cc406Sopenharmony_ci SANE_Byte y_min_resolution[2]; 404141cc406Sopenharmony_ci SANE_Byte res4; 405141cc406Sopenharmony_ci} 406141cc406Sopenharmony_cimode_sense_subdevice; 407141cc406Sopenharmony_ci 408141cc406Sopenharmony_citypedef struct mode_select_param 409141cc406Sopenharmony_ci{ 410141cc406Sopenharmony_ci SANE_Byte mode_param_header1; 411141cc406Sopenharmony_ci SANE_Byte mode_param_header2; 412141cc406Sopenharmony_ci SANE_Byte mode_param_header3; 413141cc406Sopenharmony_ci SANE_Byte mode_param_header4; 414141cc406Sopenharmony_ci SANE_Byte page_code; 415141cc406Sopenharmony_ci SANE_Byte page_length; /* 6 */ 416141cc406Sopenharmony_ci SANE_Byte res1; 417141cc406Sopenharmony_ci SANE_Byte res2; 418141cc406Sopenharmony_ci SANE_Byte mud[2]; 419141cc406Sopenharmony_ci SANE_Byte res3; 420141cc406Sopenharmony_ci SANE_Byte res4; 421141cc406Sopenharmony_ci} 422141cc406Sopenharmony_cimode_select_param; 423141cc406Sopenharmony_ci 424141cc406Sopenharmony_citypedef struct mode_select_subdevice 425141cc406Sopenharmony_ci{ 426141cc406Sopenharmony_ci SANE_Byte mode_param_header1; 427141cc406Sopenharmony_ci SANE_Byte mode_param_header2; 428141cc406Sopenharmony_ci SANE_Byte mode_param_header3; 429141cc406Sopenharmony_ci SANE_Byte mode_param_header4; 430141cc406Sopenharmony_ci SANE_Byte page_code; 431141cc406Sopenharmony_ci SANE_Byte page_length; /* 0x1A */ 432141cc406Sopenharmony_ci SANE_Byte a_mode; 433141cc406Sopenharmony_ci SANE_Byte f_mode; 434141cc406Sopenharmony_ci SANE_Byte res[24]; 435141cc406Sopenharmony_ci} 436141cc406Sopenharmony_cimode_select_subdevice; 437141cc406Sopenharmony_ci 438141cc406Sopenharmony_ci/* SCSI commands */ 439141cc406Sopenharmony_ci#define TEST_UNIT_READY 0x00 440141cc406Sopenharmony_ci#define REQUEST_SENSE 0x03 441141cc406Sopenharmony_ci#define INQUIRY 0x12 442141cc406Sopenharmony_ci#define MODE_SELECT6 0x15 443141cc406Sopenharmony_ci#define RESERVE_UNIT 0x16 444141cc406Sopenharmony_ci#define RELEASE_UNIT 0x17 445141cc406Sopenharmony_ci#define MODE_SENSE6 0x1a 446141cc406Sopenharmony_ci#define SCAN 0x1b 447141cc406Sopenharmony_ci#define SEND_DIAGNOSTIC 0x1d 448141cc406Sopenharmony_ci#define SET_WINDOW 0x24 449141cc406Sopenharmony_ci#define GET_WINDOW 0x25 450141cc406Sopenharmony_ci#define READ 0x28 451141cc406Sopenharmony_ci#define SEND 0x2a 452141cc406Sopenharmony_ci#define OBJECT_POSITION 0x31 453141cc406Sopenharmony_ci 454141cc406Sopenharmony_ci#define SENSE_LEN 18 455141cc406Sopenharmony_ci#define INQUIRY_LEN 36 456141cc406Sopenharmony_ci#define MODEPARAM_LEN 12 457141cc406Sopenharmony_ci#define MODE_SUBDEV_LEN 32 458141cc406Sopenharmony_ci#define WINDOW_LEN 76 459141cc406Sopenharmony_ci 460141cc406Sopenharmony_ci#endif /* not sharp_h */ 461