1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy. 2141cc406Sopenharmony_ci Copyright (C) 2007 Jeremy Johnson 3141cc406Sopenharmony_ci This file is part of a SANE backend for Ricoh IS450 4141cc406Sopenharmony_ci and IS420 family of HS2P Scanners using the SCSI controller. 5141cc406Sopenharmony_ci 6141cc406Sopenharmony_ci This file is part of the SANE package. 7141cc406Sopenharmony_ci 8141cc406Sopenharmony_ci This program is free software; you can redistribute it and/or 9141cc406Sopenharmony_ci modify it under the terms of the GNU General Public License as 10141cc406Sopenharmony_ci published by the Free Software Foundation; either version 2 of the 11141cc406Sopenharmony_ci License, or (at your option) any later version. 12141cc406Sopenharmony_ci 13141cc406Sopenharmony_ci This program is distributed in the hope that it will be useful, but 14141cc406Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 15141cc406Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16141cc406Sopenharmony_ci General Public License for more details. 17141cc406Sopenharmony_ci 18141cc406Sopenharmony_ci You should have received a copy of the GNU General Public License 19141cc406Sopenharmony_ci along with this program. If not, see <https://www.gnu.org/licenses/>. 20141cc406Sopenharmony_ci 21141cc406Sopenharmony_ci As a special exception, the authors of SANE give permission for 22141cc406Sopenharmony_ci additional uses of the libraries contained in this release of SANE. 23141cc406Sopenharmony_ci 24141cc406Sopenharmony_ci The exception is that, if you link a SANE library with other files 25141cc406Sopenharmony_ci to produce an executable, this does not by itself cause the 26141cc406Sopenharmony_ci resulting executable to be covered by the GNU General Public 27141cc406Sopenharmony_ci License. Your use of that executable is in no way restricted on 28141cc406Sopenharmony_ci account of linking the SANE library code into it. 29141cc406Sopenharmony_ci 30141cc406Sopenharmony_ci This exception does not, however, invalidate any other reasons why 31141cc406Sopenharmony_ci the executable file might be covered by the GNU General Public 32141cc406Sopenharmony_ci License. 33141cc406Sopenharmony_ci 34141cc406Sopenharmony_ci If you submit changes to SANE to the maintainers to be included in 35141cc406Sopenharmony_ci a subsequent release, you agree by submitting the changes that 36141cc406Sopenharmony_ci those changes may be distributed with this exception intact. 37141cc406Sopenharmony_ci 38141cc406Sopenharmony_ci If you write modifications of your own for SANE, it is your choice 39141cc406Sopenharmony_ci whether to permit this exception to apply to your modifications. 40141cc406Sopenharmony_ci If you do not wish that, delete this exception notice. */ 41141cc406Sopenharmony_ci 42141cc406Sopenharmony_ci#include <time.h> 43141cc406Sopenharmony_ci#include "../include/sane/sane.h" 44141cc406Sopenharmony_ci#include "../include/sane/saneopts.h" 45141cc406Sopenharmony_ci#include "../include/sane/sanei_scsi.h" 46141cc406Sopenharmony_ci#include "../include/sane/sanei_config.h" 47141cc406Sopenharmony_ci#include "../include/sane/sanei_thread.h" 48141cc406Sopenharmony_ci 49141cc406Sopenharmony_ci/* 1-2 SCSI STATUS BYTE KEYS */ 50141cc406Sopenharmony_ci#define HS2P_SCSI_STATUS_GOOD 0x00 51141cc406Sopenharmony_ci#define HS2P_SCSI_STATUS_CHECK 0x02 52141cc406Sopenharmony_ci#define HS2P_SCSI_STATUS_BUSY 0x08 53141cc406Sopenharmony_ci#define HS2P_SCSI_STATUS_RESERVATION CONFLICT 0x18 54141cc406Sopenharmony_ci/* All other status byte keys are reserved */ 55141cc406Sopenharmony_ci 56141cc406Sopenharmony_ci/* 57141cc406Sopenharmony_ci * SCSI Command List for Command Descriptor Block 58141cc406Sopenharmony_ci * All reserved bit and fields in the CDB must be zero 59141cc406Sopenharmony_ci * Values in the CDB described as "Reserved" must no be specified 60141cc406Sopenharmony_ci * The FLAG and LINK bits in the CONTROL byte must be zero 61141cc406Sopenharmony_ci * Any values in the Vendor Unique field are ignored 62141cc406Sopenharmony_ci * The Logical Unit Number in the CDB must always be zero 63141cc406Sopenharmony_ci * All Reserved bit and fields in the data fields must be zero 64141cc406Sopenharmony_ci * Values of parameters in the data fields described as 65141cc406Sopenharmony_ci * "Reserved" or "Not supported" must not be specified 66141cc406Sopenharmony_ci*/ 67141cc406Sopenharmony_ci 68141cc406Sopenharmony_ci/* 1-3 SCSI COMMANDS */ 69141cc406Sopenharmony_ci#define HS2P_SCSI_TEST_UNIT_READY 0x00 70141cc406Sopenharmony_ci#define HS2P_SCSI_REQUEST_SENSE 0x03 71141cc406Sopenharmony_ci#define HS2P_SCSI_INQUIRY 0x12 72141cc406Sopenharmony_ci#define HS2P_SCSI_MODE_SELECT 0x15 73141cc406Sopenharmony_ci#define HS2P_SCSI_RESERVE_UNIT 0x16 74141cc406Sopenharmony_ci#define HS2P_SCSI_RELEASE_UNIT 0x17 75141cc406Sopenharmony_ci#define HS2P_SCSI_MODE_SENSE 0x1a 76141cc406Sopenharmony_ci#define HS2P_SCSI_START_SCAN 0x1b 77141cc406Sopenharmony_ci#define HS2P_SCSI_RECEIVE_DIAGNOSTICS 0x1c 78141cc406Sopenharmony_ci#define HS2P_SCSI_SEND_DIAGNOSTICS 0x1d 79141cc406Sopenharmony_ci#define HS2P_SCSI_SET_WINDOW 0x24 80141cc406Sopenharmony_ci#define HS2P_SCSI_GET_WINDOW 0x25 81141cc406Sopenharmony_ci#define HS2P_SCSI_READ_DATA 0x28 82141cc406Sopenharmony_ci#define HS2P_SCSI_SEND_DATA 0x2a 83141cc406Sopenharmony_ci#define HS2P_SCSI_OBJECT_POSITION 0x31 84141cc406Sopenharmony_ci#define HS2P_SCSI_GET_BUFFER_STATUS 0x34 85141cc406Sopenharmony_ci 86141cc406Sopenharmony_ci/* Sense Key Defines */ 87141cc406Sopenharmony_ci#define HS2P_SK_NO_SENSE 0x00 88141cc406Sopenharmony_ci#define HS2P_SK_RECOVERED_ERROR 0x01 89141cc406Sopenharmony_ci#define HS2P_SK_NOT_READY 0x02 90141cc406Sopenharmony_ci#define HS2P_SK_MEDIUM_ERROR 0x03 91141cc406Sopenharmony_ci#define HS2P_SK_HARDWARE_ERROR 0x04 92141cc406Sopenharmony_ci#define HS2P_SK_ILLEGAL_REQUEST 0x05 93141cc406Sopenharmony_ci#define HS2P_SK_UNIT_ATTENTION 0x06 94141cc406Sopenharmony_ci#define HS2P_SK_DATA_PROJECT 0x07 95141cc406Sopenharmony_ci#define HS2P_SK_BLANK_CHECK 0x08 96141cc406Sopenharmony_ci#define HS2P_SK_VENDOR_UNIQUE 0x09 97141cc406Sopenharmony_ci#define HS2P_SK_COPY_ABORTED 0x0a 98141cc406Sopenharmony_ci#define HS2P_SK_ABORTED_COMMAND 0x0b 99141cc406Sopenharmony_ci#define HS2P_SK_EQUAL 0x0c 100141cc406Sopenharmony_ci#define HS2P_SK_VOLUME_OVERFLOW 0x0d 101141cc406Sopenharmony_ci#define HS2P_SK_MISCOMPARE 0x0e 102141cc406Sopenharmony_ci#define HS2P_SK_RESERVED 0x0f 103141cc406Sopenharmony_ci 104141cc406Sopenharmony_cistruct sense_key 105141cc406Sopenharmony_ci{ 106141cc406Sopenharmony_ci int key; 107141cc406Sopenharmony_ci char *meaning; 108141cc406Sopenharmony_ci char *description; 109141cc406Sopenharmony_ci}; 110141cc406Sopenharmony_cistatic struct sense_key sensekey_errmsg[16] = { 111141cc406Sopenharmony_ci {0x00, "NO SENSE", "Indicates that there is no Sense Key information"}, 112141cc406Sopenharmony_ci {0x01, "RECOVERED ERROR", "Invalid"}, 113141cc406Sopenharmony_ci {0x02, "NOT READY", 114141cc406Sopenharmony_ci "Indicates that the scanner is not ready, e.g. ADF cover not closed"}, 115141cc406Sopenharmony_ci {0x03, "MEDIUM ERROR", "Error regarding document such as paper jam"}, 116141cc406Sopenharmony_ci {0x04, "HARDWARE ERROR", 117141cc406Sopenharmony_ci "Error relating to hardware, e.g. CCD line clock error"}, 118141cc406Sopenharmony_ci {0x05, "ILLEGAL REQUEST", 119141cc406Sopenharmony_ci "Used such as when illegal parameter exists in data or command"}, 120141cc406Sopenharmony_ci {0x06, "UNIT ATTENTION", 121141cc406Sopenharmony_ci "Used when power on, BUS DEVICE RESET message or hardware reset"}, 122141cc406Sopenharmony_ci {0x07, "DATA PROJECT", "Invalid"}, 123141cc406Sopenharmony_ci {0x08, "BLANK CHECK", "Invalid"}, 124141cc406Sopenharmony_ci {0x09, "VENDOR UNIQUE", "Invalid"}, 125141cc406Sopenharmony_ci {0x0a, "COPY ABORTED", "Invalid"}, 126141cc406Sopenharmony_ci {0x0b, "ABORTED COMMAND", "Used when scanner aborts a command execution"}, 127141cc406Sopenharmony_ci {0x0c, "EQUAL", "Invalid"}, 128141cc406Sopenharmony_ci {0x0d, "VOLUME OVERFLOW", "Invalid"}, 129141cc406Sopenharmony_ci {0x0e, "MISCOMPARE", "Invalid"}, 130141cc406Sopenharmony_ci {0x0f, "RESERVED", "Invalid"} 131141cc406Sopenharmony_ci}; 132141cc406Sopenharmony_ci 133141cc406Sopenharmony_ci/* When Error_Code = 0x70 more detailed information is available: 134141cc406Sopenharmony_ci * code, qualifier, description 135141cc406Sopenharmony_ci*/ 136141cc406Sopenharmony_cistruct ASCQ 137141cc406Sopenharmony_ci{ /* ADDITIONAL SENSE CODE QUALIFIER */ 138141cc406Sopenharmony_ci unsigned int codequalifier; 139141cc406Sopenharmony_ci char *description; 140141cc406Sopenharmony_ci}; 141141cc406Sopenharmony_cistatic struct ASCQ ascq_errmsg[74] = { 142141cc406Sopenharmony_ci {0x0000, "No additional sense information"}, 143141cc406Sopenharmony_ci {0x0002, "End of Medium detected"}, 144141cc406Sopenharmony_ci {0x0005, "End of Data detected"}, 145141cc406Sopenharmony_ci {0x0400, "Logical unit not ready. Don't know why."}, 146141cc406Sopenharmony_ci {0x0401, "Logical unit is in process of becoming ready."}, 147141cc406Sopenharmony_ci {0x0403, "Logical unit not ready. Manual intervention required."}, 148141cc406Sopenharmony_ci {0x0500, "Logical unit does not respond to selection."}, 149141cc406Sopenharmony_ci {0x0700, "Multiple peripheral devices selected."}, 150141cc406Sopenharmony_ci {0x1100, "Unrecovered read error."}, 151141cc406Sopenharmony_ci {0x1101, "Read retries exhausted."}, 152141cc406Sopenharmony_ci {0x1501, "Mechanical positioning error."}, 153141cc406Sopenharmony_ci {0x1a00, "Parameter list length error."}, 154141cc406Sopenharmony_ci {0x2000, "Invalid command operation mode."}, 155141cc406Sopenharmony_ci {0x2400, "Invalid field in CDB (check field pointer)."}, 156141cc406Sopenharmony_ci {0x2500, "Logical unit not supported."}, 157141cc406Sopenharmony_ci {0x2600, "Invalid field in parameter list (check field pointer)."}, 158141cc406Sopenharmony_ci {0x2900, "Power on, reset, or BUS DEVICE RESET occurred."}, 159141cc406Sopenharmony_ci {0x2a01, "(MODE parameter changed.)"}, 160141cc406Sopenharmony_ci {0x2c00, "Command sequence error."}, 161141cc406Sopenharmony_ci {0x2c01, "(Too many windows specified."}, 162141cc406Sopenharmony_ci {0x2c02, "(Invalid combination of windows specified."}, 163141cc406Sopenharmony_ci {0x3700, "(Rounded parameter.)"}, 164141cc406Sopenharmony_ci {0x3900, "(Saving parameters not supported.)"}, 165141cc406Sopenharmony_ci {0x3a00, "Medium not present."}, 166141cc406Sopenharmony_ci {0x3b09, "(Read past end of medium.)"}, 167141cc406Sopenharmony_ci {0x3b0b, "(Position past end of medium.)"}, 168141cc406Sopenharmony_ci {0x3d00, "Invalid bits in IDENTIFY message."}, 169141cc406Sopenharmony_ci {0x4300, "Message error."}, 170141cc406Sopenharmony_ci {0x4500, "Select/Reselect failure."}, 171141cc406Sopenharmony_ci {0x4700, "(SCSI parity error)"}, 172141cc406Sopenharmony_ci {0x4800, "Initiator detected error message received."}, 173141cc406Sopenharmony_ci {0x4900, "Invalid message error."}, 174141cc406Sopenharmony_ci {0x4a00, "Command phase error."}, 175141cc406Sopenharmony_ci {0x4b00, "Data phase error."}, 176141cc406Sopenharmony_ci {0x5300, "(Media Load/Eject failed)"}, 177141cc406Sopenharmony_ci {0x6000, "Lamp failure"}, 178141cc406Sopenharmony_ci {0x6001, "(Shading Error)"}, 179141cc406Sopenharmony_ci {0x6002, "White adjustment error"}, 180141cc406Sopenharmony_ci {0x6010, "Reverse Side Lamp Failure"}, 181141cc406Sopenharmony_ci {0x6200, "Scan head positioning error"}, 182141cc406Sopenharmony_ci {0x6300, "Document Waiting Cancel"}, 183141cc406Sopenharmony_ci {0x8000, "(PSU overheat)"}, 184141cc406Sopenharmony_ci {0x8001, "(PSU 24V fuse down)"}, 185141cc406Sopenharmony_ci {0x8002, "(ADF 24V fuse down)"}, 186141cc406Sopenharmony_ci {0x8003, "(5V fuse down)"}, 187141cc406Sopenharmony_ci {0x8004, "(-12V fuse down)"}, 188141cc406Sopenharmony_ci {0x8100, "(ADF 24V power off)"}, 189141cc406Sopenharmony_ci {0x8101, "(Base 12V power off)"}, 190141cc406Sopenharmony_ci {0x8102, "(SCSI 5V power off)"}, 191141cc406Sopenharmony_ci {0x8103, "Lamp cover open (Lamp 24V power off)"}, 192141cc406Sopenharmony_ci {0x8104, "(-12V power off)"}, 193141cc406Sopenharmony_ci {0x8105, "(Endorser 6V power off)"}, 194141cc406Sopenharmony_ci {0x8106, "SCU 3.3V power down error"}, 195141cc406Sopenharmony_ci {0x8107, "RCU 3.3V power down error"}, 196141cc406Sopenharmony_ci {0x8108, "OIPU 3.3V power down error"}, 197141cc406Sopenharmony_ci {0x8200, "Memory Error (Bus error)"}, 198141cc406Sopenharmony_ci {0x8210, "Reverse-side memory error (Bus error)"}, 199141cc406Sopenharmony_ci {0x8300, "(Image data processing LSI error)"}, 200141cc406Sopenharmony_ci {0x8301, "(Interfac LSI error)"}, 201141cc406Sopenharmony_ci {0x8302, "(SCSI controller error)"}, 202141cc406Sopenharmony_ci {0x8303, "(Compression unit error)"}, 203141cc406Sopenharmony_ci {0x8304, "(Marker detect unit error)"}, 204141cc406Sopenharmony_ci {0x8400, "Endorser error"}, 205141cc406Sopenharmony_ci {0x8500, "(Origin Positioning error)"}, 206141cc406Sopenharmony_ci {0x8600, "Mechanical Time Out error (Pick Up Roller error)"}, 207141cc406Sopenharmony_ci {0x8700, "(Heater error)"}, 208141cc406Sopenharmony_ci {0x8800, "(Thermistor error)"}, 209141cc406Sopenharmony_ci {0x8900, "ADF cover open"}, 210141cc406Sopenharmony_ci {0x8901, "(ADF lift up)"}, 211141cc406Sopenharmony_ci {0x8902, "Document jam error for ADF"}, 212141cc406Sopenharmony_ci {0x8903, "Document misfeed for ADF"}, 213141cc406Sopenharmony_ci {0x8a00, "(Interlock open)"}, 214141cc406Sopenharmony_ci {0x8b00, "(Not enough memory)"}, 215141cc406Sopenharmony_ci {0x8c00, "Size detection failed"} 216141cc406Sopenharmony_ci}; 217141cc406Sopenharmony_ci 218141cc406Sopenharmony_citypedef struct sense_data 219141cc406Sopenharmony_ci{ /* HS2P_REQUEST_SENSE_DATA */ 220141cc406Sopenharmony_ci /* bit7:valid is 1 if information byte is valid, 221141cc406Sopenharmony_ci bits6:0 error_code */ 222141cc406Sopenharmony_ci SANE_Byte error_code; 223141cc406Sopenharmony_ci 224141cc406Sopenharmony_ci /* not used, set to 0 */ 225141cc406Sopenharmony_ci SANE_Byte segment_number; 226141cc406Sopenharmony_ci 227141cc406Sopenharmony_ci /* bit7 file-mark (unused, set to 0), 228141cc406Sopenharmony_ci bit6 EOM is 1 if end of document detected before completing scan 229141cc406Sopenharmony_ci bit5 ILI (incorrect length indicator) is 1 when data length mismatch occurs on READ 230141cc406Sopenharmony_ci bits3:0 sense_key indicates error conditions. */ 231141cc406Sopenharmony_ci SANE_Byte sense_key; 232141cc406Sopenharmony_ci 233141cc406Sopenharmony_ci SANE_Byte information[4]; 234141cc406Sopenharmony_ci 235141cc406Sopenharmony_ci /* fixed at 6 */ 236141cc406Sopenharmony_ci SANE_Byte sense_length; 237141cc406Sopenharmony_ci 238141cc406Sopenharmony_ci /* not used and set to 0 */ 239141cc406Sopenharmony_ci SANE_Byte command_specific_information[4]; 240141cc406Sopenharmony_ci SANE_Byte sense_code; 241141cc406Sopenharmony_ci SANE_Byte sense_code_qualifier; 242141cc406Sopenharmony_ci} SENSE_DATA; 243141cc406Sopenharmony_ci 244141cc406Sopenharmony_ci/* page codes used with HS2P_SCSI_INQUIRY */ 245141cc406Sopenharmony_ci#define HS2P_INQUIRY_STANDARD_PAGE_CODE 0x00 246141cc406Sopenharmony_ci#define HS2P_INQUIRY_VPD_PAGE_CODE 0xC0 247141cc406Sopenharmony_ci#define HS2P_INQUIRY_JIS_PAGE_CODE 0xF0 248141cc406Sopenharmony_ci 249141cc406Sopenharmony_ci/* 250141cc406Sopenharmony_ci * The EVPD and Page Code are used in pair. When the EVPD bit is 0, INQUIRY data 251141cc406Sopenharmony_ci * in the standard format is returned to the initiator. When the EVPD bit is 1, 252141cc406Sopenharmony_ci * the EVPD information specified by each Page Code is returned in each Page Code 253141cc406Sopenharmony_ci * data format. 254141cc406Sopenharmony_ci * 255141cc406Sopenharmony_ci * EVPD=0x00, Page_Code=0x00 => Standard Data Format 256141cc406Sopenharmony_ci * 257141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0x00 => Return list of supported Page Codes 258141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0x01~0x7F => Not Supported 259141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0x80~0x82 => Not Supported 260141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0x83~0xBF => Reserved 261141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0xC0 => RICOH Scanner VPD information 262141cc406Sopenharmony_ci * EVPD=0x01, PAGE_CODE=0xF0 => JIS Version VPD information 263141cc406Sopenharmony_ci*/ 264141cc406Sopenharmony_cistruct inquiry_standard_data 265141cc406Sopenharmony_ci{ 266141cc406Sopenharmony_ci /* bits7-5 peripheral qualifier 267141cc406Sopenharmony_ci * bits4-0 peripheral device 268141cc406Sopenharmony_ci * Peripheral Qualifier and Peripheral Devide Type are not supported on logical unit 269141cc406Sopenharmony_ci * Therefore LUN=0 and this field indicates scanner and is set to 0x06 270141cc406Sopenharmony_ci * When LUN!=0 this field becomes 0x1F and means undefined data 271141cc406Sopenharmony_ci */ 272141cc406Sopenharmony_ci SANE_Byte devtype; /* must be 0x06 */ 273141cc406Sopenharmony_ci 274141cc406Sopenharmony_ci /* bit7: repaceable media bit is set to 0 275141cc406Sopenharmony_ci * bits6-1: reserved 276141cc406Sopenharmony_ci * bit0: EVPD 277141cc406Sopenharmony_ci */ 278141cc406Sopenharmony_ci SANE_Byte rmb_evpd; 279141cc406Sopenharmony_ci 280141cc406Sopenharmony_ci /* bits7-6: ISO Version is set to 0 281141cc406Sopenharmony_ci * bits5-3: ECMA Version is set to 0 282141cc406Sopenharmony_ci * bits2-0: ANSI Version is set to 2 283141cc406Sopenharmony_ci */ 284141cc406Sopenharmony_ci SANE_Byte version; 285141cc406Sopenharmony_ci 286141cc406Sopenharmony_ci /* bit7: AENC (asynchronous event notification capability) is set to 0 287141cc406Sopenharmony_ci * bit6: TrmIOP (terminate I/O process) is set to 0 288141cc406Sopenharmony_ci * bits5-4: reserved 289141cc406Sopenharmony_ci * bits3-0: Response Data Format is set to 2 290141cc406Sopenharmony_ci */ 291141cc406Sopenharmony_ci SANE_Byte response_data_format; 292141cc406Sopenharmony_ci 293141cc406Sopenharmony_ci /* Additional Length indicate number of bytes which follows, set to 31 294141cc406Sopenharmony_ci */ 295141cc406Sopenharmony_ci SANE_Byte length; 296141cc406Sopenharmony_ci 297141cc406Sopenharmony_ci SANE_Byte reserved[2]; 298141cc406Sopenharmony_ci 299141cc406Sopenharmony_ci /* bit7: RelAdr (relative addressing) is set to 0 300141cc406Sopenharmony_ci * bit6: Wbus32 is set to 0 301141cc406Sopenharmony_ci * bit5: Wbus16 is set to 0 302141cc406Sopenharmony_ci * bit4: Sync is set to 0 303141cc406Sopenharmony_ci * bit3: Linked is set to 0 304141cc406Sopenharmony_ci * bit2: reserved 305141cc406Sopenharmony_ci * bit1: CmdQue is set to 0 306141cc406Sopenharmony_ci * bit0: SftRe is set to 0 307141cc406Sopenharmony_ci * Sync is set to 1 with this scanner to support synchronous data transfer 308141cc406Sopenharmony_ci * When DIPSW2 is on, Sync is set to 0 for asynchronous data transfer 309141cc406Sopenharmony_ci */ 310141cc406Sopenharmony_ci SANE_Byte byte7; 311141cc406Sopenharmony_ci 312141cc406Sopenharmony_ci SANE_Byte vendor[8]; /* vendor_id="RICOH " */ 313141cc406Sopenharmony_ci SANE_Byte product[16]; /* product_id="IS450 " */ 314141cc406Sopenharmony_ci SANE_Byte revision[4]; /* product_revision_level="xRxx" where x indicate firmware version number */ 315141cc406Sopenharmony_ci}; 316141cc406Sopenharmony_ci 317141cc406Sopenharmony_ci/* VPD Information [EVPD=0x01, PageCode=0xC0] */ 318141cc406Sopenharmony_cistruct inquiry_vpd_data 319141cc406Sopenharmony_ci{ 320141cc406Sopenharmony_ci SANE_Byte devtype; /* bits7-5: Peripheral Qualifier 321141cc406Sopenharmony_ci * bits4-0: Peripheral Device Type */ 322141cc406Sopenharmony_ci SANE_Byte pagecode; /* Page Code => 0xC0 */ 323141cc406Sopenharmony_ci SANE_Byte byte2; /* Reserved */ 324141cc406Sopenharmony_ci SANE_Byte pagelength; /* Page Length => 12 (0x0C) */ 325141cc406Sopenharmony_ci SANE_Byte adf_id; /* ADF Identification 326141cc406Sopenharmony_ci * 0: No ADF is mounted 327141cc406Sopenharmony_ci * 1: Single sided ADF is mounted 328141cc406Sopenharmony_ci * 2: Double sided ADF is mounted 329141cc406Sopenharmony_ci * 3: ARDF is mounted. (Reverse double side scanning available) 330141cc406Sopenharmony_ci * 4: Reserved 331141cc406Sopenharmony_ci * It should be 1 or 2 with this scanner. 332141cc406Sopenharmony_ci */ 333141cc406Sopenharmony_ci SANE_Byte end_id; /* Endorser Identification 334141cc406Sopenharmony_ci * 0: No endorser 335141cc406Sopenharmony_ci * 1: Endorser mounted 336141cc406Sopenharmony_ci * 2: Reserved 337141cc406Sopenharmony_ci * It should be 0 or 1 with this scanner 338141cc406Sopenharmony_ci */ 339141cc406Sopenharmony_ci SANE_Byte ipu_id; /* Image Processing Unit Identification 340141cc406Sopenharmony_ci * bits 7:2 Reserved 341141cc406Sopenharmony_ci * bit 1 0:Extended board not mounted 342141cc406Sopenharmony_ci * 1:Extended board is mounted 343141cc406Sopenharmony_ci * bit 0 0:IPU is not mounted 344141cc406Sopenharmony_ci * 1:IPU is mounted 345141cc406Sopenharmony_ci * It should always be 0 with this scanner 346141cc406Sopenharmony_ci */ 347141cc406Sopenharmony_ci SANE_Byte imagecomposition; /* indicates supported image data type. 348141cc406Sopenharmony_ci * This is set to 0x37 349141cc406Sopenharmony_ci * bit0 => Line art supported ? 1:0 350141cc406Sopenharmony_ci * bit1 => Dither supported ? 1:0 351141cc406Sopenharmony_ci * bit2 => Error Diffusion supported ? 1:0 352141cc406Sopenharmony_ci * bit3 => Color supported ? 1:0 353141cc406Sopenharmony_ci * bit4 => 4bits gray scale supported ? 1:0 354141cc406Sopenharmony_ci * bit5 => 5-8bit gray scale supported ? 1:0 355141cc406Sopenharmony_ci * bit6 => 5-8bit gray scale supported ? 1:0 356141cc406Sopenharmony_ci * bit7 => Reserved 357141cc406Sopenharmony_ci */ 358141cc406Sopenharmony_ci SANE_Byte imagedataprocessing[2]; /* Image Data Processing Method 359141cc406Sopenharmony_ci * IPU installed ? 0x18 : 0x00 360141cc406Sopenharmony_ci * Byte8 => White Framing ? 1:0 361141cc406Sopenharmony_ci * Byte9 => Black Framing ? 1:0 362141cc406Sopenharmony_ci * Byte10 => Edge Extraction ? 1:0 363141cc406Sopenharmony_ci * Byte11 => Noise Removal ? 1:0 364141cc406Sopenharmony_ci * Byte12 => Smoothing ? 1:0 365141cc406Sopenharmony_ci * Byte13 => Line Bolding ? 0:1 366141cc406Sopenharmony_ci * Byte14 => Reserved 367141cc406Sopenharmony_ci * Byte15 => Reserved 368141cc406Sopenharmony_ci */ 369141cc406Sopenharmony_ci SANE_Byte compression; /* Compression Method is set to 0x00 370141cc406Sopenharmony_ci * bit0 => MH supported ? 1:0 371141cc406Sopenharmony_ci * bit1 => MR supported ? 1:0 372141cc406Sopenharmony_ci * bit2 => MMR supported ? 1:0 373141cc406Sopenharmony_ci * bit3 => MH (byte boundary) supported ? 1:0 374141cc406Sopenharmony_ci * bit4 => Reserved 375141cc406Sopenharmony_ci */ 376141cc406Sopenharmony_ci SANE_Byte markerrecognition; /* Marker Recognition Method is set to 0x00 377141cc406Sopenharmony_ci * bit0 => Marker Recognition supported ? 1:0 378141cc406Sopenharmony_ci * bits1-7 => Reserved 379141cc406Sopenharmony_ci */ 380141cc406Sopenharmony_ci SANE_Byte sizerecognition; /* Size Detection 381141cc406Sopenharmony_ci * bit0 => Size Detection Supported ? 1:0 382141cc406Sopenharmony_ci * bits1-7 => Reserved 383141cc406Sopenharmony_ci */ 384141cc406Sopenharmony_ci SANE_Byte byte13; /* Reserved */ 385141cc406Sopenharmony_ci SANE_Byte xmaxoutputpixels[2]; /* X Maximum Output Pixel is set to 4960 (0x1360) 386141cc406Sopenharmony_ci * indicates maximum number of pixels in the main 387141cc406Sopenharmony_ci * scanning direction that can be output by scanner 388141cc406Sopenharmony_ci */ 389141cc406Sopenharmony_ci 390141cc406Sopenharmony_ci}; 391141cc406Sopenharmony_ci 392141cc406Sopenharmony_cistruct inquiry_jis_data 393141cc406Sopenharmony_ci{ /* JIS INFORMATION VPD_IDENTIFIER_F0H */ 394141cc406Sopenharmony_ci SANE_Byte devtype; /* 7-5: peripheral qualifier, 4-0: peripheral device type */ 395141cc406Sopenharmony_ci SANE_Byte pagecode; 396141cc406Sopenharmony_ci SANE_Byte jisversion; 397141cc406Sopenharmony_ci SANE_Byte reserved1; 398141cc406Sopenharmony_ci SANE_Byte alloclen; /* page length: Set to 25 (19H) */ 399141cc406Sopenharmony_ci struct 400141cc406Sopenharmony_ci { 401141cc406Sopenharmony_ci SANE_Byte x[2]; /* Basic X Resolution: Set to 400 (01H,90H) */ 402141cc406Sopenharmony_ci SANE_Byte y[2]; /* Basic Y Resolution: Set to 400 (01H,90H) */ 403141cc406Sopenharmony_ci } BasicRes; 404141cc406Sopenharmony_ci SANE_Byte resolutionstep; /* 7-4: xstep, 3-0 ystep: Both set to 1 (11H) */ 405141cc406Sopenharmony_ci struct 406141cc406Sopenharmony_ci { 407141cc406Sopenharmony_ci SANE_Byte x[2]; /* Maximum X resolution: Set to 800 (03H,20H) */ 408141cc406Sopenharmony_ci SANE_Byte y[2]; /* Maximum Y resolution: Set to 800 (03H,20H) */ 409141cc406Sopenharmony_ci } MaxRes; 410141cc406Sopenharmony_ci struct 411141cc406Sopenharmony_ci { 412141cc406Sopenharmony_ci SANE_Byte x[2]; /* Minimum X resolution: Set to 100 (00H,64H) */ 413141cc406Sopenharmony_ci SANE_Byte y[2]; /* Minimum Y resolution */ 414141cc406Sopenharmony_ci } MinRes; 415141cc406Sopenharmony_ci SANE_Byte standardres[2]; /* Standard Resolution: bits 7-0: 416141cc406Sopenharmony_ci * byte18: 60, 75,100,120,150,160,180, 200 417141cc406Sopenharmony_ci * byte19: 240,300,320,400,480,600,800,1200 418141cc406Sopenharmony_ci */ 419141cc406Sopenharmony_ci struct 420141cc406Sopenharmony_ci { 421141cc406Sopenharmony_ci SANE_Byte width[4]; /* in pixels based on basic resolution. Set to 4787 (12B3H) */ 422141cc406Sopenharmony_ci SANE_Byte length[4]; /* maximum number of scan lines based on basic resolution. Set to 6803 (1A93H) */ 423141cc406Sopenharmony_ci } Window; 424141cc406Sopenharmony_ci SANE_Byte functions; /* This is set to 0EH: 0001110 425141cc406Sopenharmony_ci * bit0: data overflow possible 426141cc406Sopenharmony_ci * bit1: line art support 427141cc406Sopenharmony_ci * bit2: dither support 428141cc406Sopenharmony_ci * bit3: gray scale support 429141cc406Sopenharmony_ci * bits7-4: reserved 430141cc406Sopenharmony_ci */ 431141cc406Sopenharmony_ci SANE_Byte reserved2; 432141cc406Sopenharmony_ci}; 433141cc406Sopenharmony_ci 434141cc406Sopenharmony_ci 435141cc406Sopenharmony_ci 436141cc406Sopenharmony_ci#define SMS_SP 0x01 /* Mask for Bit0 */ 437141cc406Sopenharmony_ci#define SMS_PF 0x10 /* Mask for Bit4 */ 438141cc406Sopenharmony_citypedef struct scsi_mode_select_cmd 439141cc406Sopenharmony_ci{ 440141cc406Sopenharmony_ci SANE_Byte opcode; /* 15H */ 441141cc406Sopenharmony_ci SANE_Byte byte1; /* 7-5:LUN; 4:PF; 2:Reserved; 1:SP 442141cc406Sopenharmony_ci * Save Page Bit must be 0 since pages cannot be saved 443141cc406Sopenharmony_ci * Page Format Bit must be 1 */ 444141cc406Sopenharmony_ci SANE_Byte reserved[2]; 445141cc406Sopenharmony_ci SANE_Byte len; /* Parameter List Length */ 446141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 447141cc406Sopenharmony_ci} SELECT; 448141cc406Sopenharmony_ci 449141cc406Sopenharmony_ci/* MODE SELECT PARAMETERS: 450141cc406Sopenharmony_ci * 0-n Mode Parameter Header 451141cc406Sopenharmony_ci * 0-n mode Block Descriptor (not used) 452141cc406Sopenharmony_ci * 0-n mode Page 453141cc406Sopenharmony_ci*/ 454141cc406Sopenharmony_citypedef struct scsi_mode_parameter_header 455141cc406Sopenharmony_ci{ 456141cc406Sopenharmony_ci SANE_Byte data_len; /* Mode Data Length NOT USED so must be 0 */ 457141cc406Sopenharmony_ci SANE_Byte medium_type; /* Medium Type NOT USED so must be 0 */ 458141cc406Sopenharmony_ci SANE_Byte dev_spec; /* Device Specific Parameter NOT USED so must be 0 */ 459141cc406Sopenharmony_ci SANE_Byte blk_desc_len; /* Block Descriptor Length is set to 0 */ 460141cc406Sopenharmony_ci} MPHdr; 461141cc406Sopenharmony_ci 462141cc406Sopenharmony_citypedef struct page 463141cc406Sopenharmony_ci{ 464141cc406Sopenharmony_ci SANE_Byte code; /* 7:PS; 6:Reserved; 5-0:Page Code */ 465141cc406Sopenharmony_ci SANE_Byte len; /* set to 14 when MPC=02H and 6 otherwise */ 466141cc406Sopenharmony_ci SANE_Byte parameter[14]; /* either 14 or 6, so let's allow room for 14 */ 467141cc406Sopenharmony_ci} MPP; /* Mode Page Parameters */ 468141cc406Sopenharmony_citypedef struct mode_pages 469141cc406Sopenharmony_ci{ 470141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header */ 471141cc406Sopenharmony_ci MPP page; /* Mode Page Parameters */ 472141cc406Sopenharmony_ci} MP; 473141cc406Sopenharmony_ci /* MODE PAGE CODES (MPC) */ 474141cc406Sopenharmony_ci /* 00H Reserved (Vendor Unique) */ 475141cc406Sopenharmony_ci /* 01H Reserved */ 476141cc406Sopenharmony_ci#define PAGE_CODE_CONNECTION 0x02 /* 02H Disconnect/Reconnect Parameters */ 477141cc406Sopenharmony_ci#define PAGE_CODE_SCANNING_MEASUREMENTS 0x03 /* 03H Scanning Measurement Parameters */ 478141cc406Sopenharmony_ci /* 04H-08H Reserved */ 479141cc406Sopenharmony_ci /* 09H-0AH Reserved (Not supported) */ 480141cc406Sopenharmony_ci /* 0BH-1FH Reserved */ 481141cc406Sopenharmony_ci#define PAGE_CODE_WHITE_BALANCE 0x20 /* 20H White Balance */ 482141cc406Sopenharmony_ci /* 21H Reserved (Vendor Unique) */ 483141cc406Sopenharmony_ci#define PAGE_CODE_LAMP_TIMER_SET 0x22 /* 22H Lamp Timer Set */ 484141cc406Sopenharmony_ci#define PAGE_CODE_SCANNING_SPEED 0x23 /* 23H Reserved (Scanning speed select) */ 485141cc406Sopenharmony_ci /* 24H Reserved (Vendor Unique) */ 486141cc406Sopenharmony_ci /* 25H Reserved (Vendor Unique) */ 487141cc406Sopenharmony_ci#define PAGE_CODE_ADF_CONTROL 0x26 /* 26H ADF Control */ 488141cc406Sopenharmony_ci#define PAGE_CODE_ENDORSER_CONTROL 0x27 /* 27H Endorser Control */ 489141cc406Sopenharmony_ci /* 28H Reserved (Marker Area Data Processing) */ 490141cc406Sopenharmony_ci /* 29H-2AH Reserved (Vendor Unique) */ 491141cc406Sopenharmony_ci#define PAGE_CODE_SCAN_WAIT_MODE 0x2B /* 2BH Scan Wait Mode (Medium Wait Mode) */ 492141cc406Sopenharmony_ci /* 2CH-3DH Reserved (Vendor Unique) */ 493141cc406Sopenharmony_ci#define PAGE_CODE_SERVICE_MODE_SELECT 0x3E /* 3EH Service Mode Select */ 494141cc406Sopenharmony_ci /* 3FH Reserved (Not Supported) */ 495141cc406Sopenharmony_ci 496141cc406Sopenharmony_citypedef struct mode_page_connect 497141cc406Sopenharmony_ci{ 498141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 499141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0: 02H */ 500141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length 0EH */ 501141cc406Sopenharmony_ci SANE_Byte buffer_full_ratio; /* Ignored */ 502141cc406Sopenharmony_ci SANE_Byte buffer_empty_ratio; /* Ignored */ 503141cc406Sopenharmony_ci SANE_Byte bus_inactive_limit[2]; /* Ignored */ 504141cc406Sopenharmony_ci SANE_Byte disconnect_time_limit[2]; /* indicates minimum time to disconnect SCSI bus until reconnection. 505141cc406Sopenharmony_ci * It is expressed in 100msec increments; i.e. "1" for 100msec, "2" for 200msec 506141cc406Sopenharmony_ci * The maximum time is 2sec */ 507141cc406Sopenharmony_ci SANE_Byte connect_time_limit[2]; /* Ignored */ 508141cc406Sopenharmony_ci SANE_Byte maximum_burst_size[2]; /* expressed in 512 increments, i.e. "1" for 512 bytes, "2" for 1024 bytes 509141cc406Sopenharmony_ci * "0" indicates unlimited amount of data */ 510141cc406Sopenharmony_ci SANE_Byte dtdc; /* 7-2:Reserved; 1-0:DTDC indicates limitations of disconnection (bit1,bit0): 511141cc406Sopenharmony_ci * 00 (DEFAULT) Controlled by the other field in this page 512141cc406Sopenharmony_ci * 01 Once the command data transfer starts, the target never disconnects until 513141cc406Sopenharmony_ci * the whole data transfer completes 514141cc406Sopenharmony_ci * 10 Reserved 515141cc406Sopenharmony_ci * 11 Once the command data transfer starts, the target never disconnects until 516141cc406Sopenharmony_ci * the completion of the command 517141cc406Sopenharmony_ci */ 518141cc406Sopenharmony_ci SANE_Byte reserved[3]; 519141cc406Sopenharmony_ci} MP_CXN; 520141cc406Sopenharmony_ci 521141cc406Sopenharmony_ci/* 1 inch = 6 picas = 72 points = 25.4 mm */ 522141cc406Sopenharmony_ci#define DEFAULT_MUD 1200 /* WHY ? */ 523141cc406Sopenharmony_ci/* BASIC MEASUREMENT UNIT 524141cc406Sopenharmony_ci * 00H INCH 525141cc406Sopenharmony_ci * 01H MILLIMETER 526141cc406Sopenharmony_ci * 02H POINT 527141cc406Sopenharmony_ci * 03H-FFH Reserved 528141cc406Sopenharmony_ci*/ 529141cc406Sopenharmony_cienum BMU 530141cc406Sopenharmony_ci{ INCHES = 0, MILLIMETERS, POINTS }; /* Basic Measurement Unit */ 531141cc406Sopenharmony_ci 532141cc406Sopenharmony_citypedef struct mode_page_scanning_measurement 533141cc406Sopenharmony_ci{ 534141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 535141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (03H) */ 536141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 537141cc406Sopenharmony_ci SANE_Byte bmu; /* Basic Measurement Unit */ 538141cc406Sopenharmony_ci SANE_Byte reserved0; 539141cc406Sopenharmony_ci SANE_Byte mud[2]; /* Measurement Unit Divisor 540141cc406Sopenharmony_ci * produces an error if 0 541141cc406Sopenharmony_ci * mud is fixed to 1 for millimeter or point 542141cc406Sopenharmony_ci * point is default when scanner powers on */ 543141cc406Sopenharmony_ci SANE_Byte reserved1[2]; 544141cc406Sopenharmony_ci} MP_SMU; /* Scanning Measurement Units */ 545141cc406Sopenharmony_ci 546141cc406Sopenharmony_citypedef struct mode_page_white_balance 547141cc406Sopenharmony_ci{ 548141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 549141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (03H) */ 550141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 551141cc406Sopenharmony_ci SANE_Byte white_balance; /* "0" selects relative white mode (DEFAULT when power on) 552141cc406Sopenharmony_ci * "1" selects absolute white mode */ 553141cc406Sopenharmony_ci SANE_Byte reserved[5]; 554141cc406Sopenharmony_ci} MP_WhiteBal; /* White Balance */ 555141cc406Sopenharmony_ci 556141cc406Sopenharmony_citypedef struct mode_page_lamp_timer_set 557141cc406Sopenharmony_ci{ 558141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 559141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (22H) */ 560141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 561141cc406Sopenharmony_ci SANE_Byte time_on; /* indicates the time of lamp turned on */ 562141cc406Sopenharmony_ci SANE_Byte ignored[5]; 563141cc406Sopenharmony_ci} MP_LampTimer; /* Lamp Timer Set (Not supported ) */ 564141cc406Sopenharmony_ci 565141cc406Sopenharmony_citypedef struct mode_page_adf_control 566141cc406Sopenharmony_ci{ 567141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 568141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (26H) */ 569141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 570141cc406Sopenharmony_ci SANE_Byte adf_control; /* 7-2:Reserved; 1-0:ADF selection: 571141cc406Sopenharmony_ci * 00H Book Mode (DEFAULT when power on) 572141cc406Sopenharmony_ci * 01H Simplex ADF 573141cc406Sopenharmony_ci * 02H Duplex ADF 574141cc406Sopenharmony_ci * 03H-FFH Reserved */ 575141cc406Sopenharmony_ci SANE_Byte adf_mode_control; /* 7-3:Reserved; 2:Prefeed Mode Validity 1-0:Ignored 576141cc406Sopenharmony_ci * Prefeed Mode "0" means invalid, "1" means valid */ 577141cc406Sopenharmony_ci SANE_Byte medium_wait_timer; /* indicates time for scanner to wait for media. Scanner 578141cc406Sopenharmony_ci * will send CHECK on timeout. NOT SUPPORTED */ 579141cc406Sopenharmony_ci SANE_Byte ignored[3]; 580141cc406Sopenharmony_ci} MP_ADF; /* ADF Control */ 581141cc406Sopenharmony_ci 582141cc406Sopenharmony_citypedef struct mode_page_endorser_control 583141cc406Sopenharmony_ci{ 584141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 585141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (27H) */ 586141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 587141cc406Sopenharmony_ci SANE_Byte endorser_control; /* 7-3:Reserved; 2-0:Endorser Control: 588141cc406Sopenharmony_ci * 0H Disable Endorser (DEFAULT) 589141cc406Sopenharmony_ci * 1H Enable Endorser 590141cc406Sopenharmony_ci * 3H-7H Reserved */ 591141cc406Sopenharmony_ci SANE_Byte ignored[5]; 592141cc406Sopenharmony_ci} MP_EndCtrl; /* Endorser Control */ 593141cc406Sopenharmony_ci 594141cc406Sopenharmony_citypedef struct mode_page_scan_wait 595141cc406Sopenharmony_ci{ 596141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 597141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (2BH) */ 598141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 599141cc406Sopenharmony_ci SANE_Byte swm; /* 7-1:Reserved; 0:Scan Wait Mode 600141cc406Sopenharmony_ci * 0H Disable Medium wait mode 601141cc406Sopenharmony_ci * 1H Enable Medium wait mode 602141cc406Sopenharmony_ci * In Medium wait mode, when SCAN, READ, or LOAD (in ADF mode) is issued, 603141cc406Sopenharmony_ci * the scanner waits until start button is pressed on operation panel 604141cc406Sopenharmony_ci * When abort button is pressed, the command is cancelled 605141cc406Sopenharmony_ci * In ADF mode, when there are no originals on ADF, CHECK condition is 606141cc406Sopenharmony_ci * not given unless start button is pressed. */ 607141cc406Sopenharmony_ci SANE_Byte ignored[5]; 608141cc406Sopenharmony_ci} MP_SWM; /* Scan Wait */ 609141cc406Sopenharmony_ci 610141cc406Sopenharmony_citypedef struct mode_page_service 611141cc406Sopenharmony_ci{ /* Selectable when Send Diagnostic command is performed */ 612141cc406Sopenharmony_ci MPHdr hdr; /* Mode Page Header: 4 bytes */ 613141cc406Sopenharmony_ci SANE_Byte code; /* 7-6:Reserved; 5-0:Page Code (3EH) */ 614141cc406Sopenharmony_ci SANE_Byte len; /* Parameter Length (06H) */ 615141cc406Sopenharmony_ci SANE_Byte service; /* 7-1:Reserved; 0:Service Mode 616141cc406Sopenharmony_ci * "0" selects Self Diagnostics mode (DEFAULT when power on ) 617141cc406Sopenharmony_ci * "1" selects Optical Adjustment mode */ 618141cc406Sopenharmony_ci SANE_Byte ignored[5]; 619141cc406Sopenharmony_ci} MP_SRV; /* Service */ 620141cc406Sopenharmony_ci 621141cc406Sopenharmony_citypedef struct scsi_mode_sense_cmd 622141cc406Sopenharmony_ci{ 623141cc406Sopenharmony_ci SANE_Byte opcode; /* 1AH */ 624141cc406Sopenharmony_ci SANE_Byte dbd; /* 7-5:LUN; 4:Reserved; 3:DBD (Disable Block Description) set to "0"; 2-0:Reserved */ 625141cc406Sopenharmony_ci SANE_Byte pc; /* 7-6:PC; 5-0:Page Code 626141cc406Sopenharmony_ci * PC field indicates the type of data to be returned (bit7,bit6): 627141cc406Sopenharmony_ci * 00 Current Value (THIS IS THE ONLY VALUE WHICH WORKS!) 628141cc406Sopenharmony_ci * 01 Changeable Value 629141cc406Sopenharmony_ci * 10 Default Value 630141cc406Sopenharmony_ci * 11 Saved Value 631141cc406Sopenharmony_ci * 632141cc406Sopenharmony_ci * Page Code indicates requested page. (See PAGE_CODE defines) */ 633141cc406Sopenharmony_ci SANE_Byte reserved; 634141cc406Sopenharmony_ci SANE_Byte len; /* Allocation length */ 635141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 636141cc406Sopenharmony_ci} SENSE; 637141cc406Sopenharmony_ci/* MODE SENSE DATA FORMAT -- 638141cc406Sopenharmony_ci * The format of Sense Data to be returned is Mode Parameter Header + Page 639141cc406Sopenharmony_ci * see struct scsi_mode_parameter_header 640141cc406Sopenharmony_ci * struct mode_pages 641141cc406Sopenharmony_ci*/ 642141cc406Sopenharmony_ci 643141cc406Sopenharmony_ci/* 1-3-8 SCAN command */ 644141cc406Sopenharmony_citypedef struct scsi_start_scan_cmd 645141cc406Sopenharmony_ci{ 646141cc406Sopenharmony_ci SANE_Byte opcode; /* 1BH */ 647141cc406Sopenharmony_ci SANE_Byte byte1; /* 7-5:LUN; 4-0:Reserved */ 648141cc406Sopenharmony_ci SANE_Byte page_code; 649141cc406Sopenharmony_ci SANE_Byte reserved; 650141cc406Sopenharmony_ci SANE_Byte len; /* Transfer Length 651141cc406Sopenharmony_ci * Length of Window List in bytes 652141cc406Sopenharmony_ci * Since scanner supports up to 2 windows, len is 1 or 2 653141cc406Sopenharmony_ci */ 654141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 655141cc406Sopenharmony_ci} START_SCAN; 656141cc406Sopenharmony_ci 657141cc406Sopenharmony_ci/* 1-3-9 RECEIVE DIAGNOSTIC 658141cc406Sopenharmony_ci * 1-3-10 SEND DIAGNOSTIC */ 659141cc406Sopenharmony_ci 660141cc406Sopenharmony_ci/* BinaryFilter Byte 661141cc406Sopenharmony_ci * bit7: Noise Removal '1':removal 662141cc406Sopenharmony_ci * bit6: Smoothing '1':smoothing 663141cc406Sopenharmony_ci * bits5-2: ignored 664141cc406Sopenharmony_ci * bits1-0: Noise Removal Matrix 665141cc406Sopenharmony_ci * 00:3x3 01:4x4 666141cc406Sopenharmony_ci * 10:5x5 11:Reserved 667141cc406Sopenharmony_ci*/ 668141cc406Sopenharmony_cistruct val_id 669141cc406Sopenharmony_ci{ 670141cc406Sopenharmony_ci SANE_Byte val; 671141cc406Sopenharmony_ci SANE_Byte id; 672141cc406Sopenharmony_ci}; 673141cc406Sopenharmony_cistatic SANE_String_Const noisematrix_list[] = { 674141cc406Sopenharmony_ci "None", "3x3", "4x4", "5x5", NULL 675141cc406Sopenharmony_ci}; 676141cc406Sopenharmony_cistruct val_id noisematrix[] = { 677141cc406Sopenharmony_ci {0x03, 0}, /* dummy <reserved> value for "None" */ 678141cc406Sopenharmony_ci {0x00, 1}, 679141cc406Sopenharmony_ci {0x01, 2}, 680141cc406Sopenharmony_ci {0x02, 3} 681141cc406Sopenharmony_ci}; 682141cc406Sopenharmony_cistatic SANE_String_Const grayfilter_list[] = { 683141cc406Sopenharmony_ci "none", "averaging", "MTF correction", NULL 684141cc406Sopenharmony_ci}; 685141cc406Sopenharmony_cistruct val_id grayfilter[] = { 686141cc406Sopenharmony_ci {0x00, 0}, 687141cc406Sopenharmony_ci {0x01, 1}, 688141cc406Sopenharmony_ci {0x03, 2} 689141cc406Sopenharmony_ci}; 690141cc406Sopenharmony_ci 691141cc406Sopenharmony_cistatic SANE_String_Const paddingtype_list[] = { 692141cc406Sopenharmony_ci "Pad with 0's to byte boundary", 693141cc406Sopenharmony_ci "Pad with 1's to byte boundary", 694141cc406Sopenharmony_ci "Truncate to byte boundary", 695141cc406Sopenharmony_ci NULL 696141cc406Sopenharmony_ci}; 697141cc406Sopenharmony_cienum paddingtypes 698141cc406Sopenharmony_ci{ PAD_WITH_ZEROS = 0x01, PAD_WITH_ONES, TRUNCATE }; 699141cc406Sopenharmony_cistruct val_id paddingtype[] = { 700141cc406Sopenharmony_ci {PAD_WITH_ZEROS, 0}, 701141cc406Sopenharmony_ci {PAD_WITH_ONES, 1}, 702141cc406Sopenharmony_ci {TRUNCATE, 2} 703141cc406Sopenharmony_ci}; 704141cc406Sopenharmony_ci 705141cc406Sopenharmony_ci#define NPADDINGTYPES 3 706141cc406Sopenharmony_ci#define PADDINGTYPE_DEFAULT 2 707141cc406Sopenharmony_cistatic SANE_String_Const auto_separation_list[] = { 708141cc406Sopenharmony_ci "Off", "On", "User", NULL 709141cc406Sopenharmony_ci}; 710141cc406Sopenharmony_cistruct val_id auto_separation[] = { 711141cc406Sopenharmony_ci {0x00, 0}, 712141cc406Sopenharmony_ci {0x01, 1}, 713141cc406Sopenharmony_ci {0x80, 2} 714141cc406Sopenharmony_ci}; 715141cc406Sopenharmony_cistatic SANE_String_Const auto_binarization_list[] = { 716141cc406Sopenharmony_ci "Off", 717141cc406Sopenharmony_ci "On", 718141cc406Sopenharmony_ci "Enhancement of light characters", 719141cc406Sopenharmony_ci "Removal of background color", 720141cc406Sopenharmony_ci "User", 721141cc406Sopenharmony_ci NULL 722141cc406Sopenharmony_ci}; 723141cc406Sopenharmony_cistruct val_id auto_binarization[] = { 724141cc406Sopenharmony_ci {0x00, 0}, 725141cc406Sopenharmony_ci {0x01, 1}, 726141cc406Sopenharmony_ci {0x02, 2}, 727141cc406Sopenharmony_ci {0x03, 3}, 728141cc406Sopenharmony_ci {0x80, 4} 729141cc406Sopenharmony_ci}; 730141cc406Sopenharmony_cienum imagecomposition 731141cc406Sopenharmony_ci{ LINEART = 0x00, HALFTONE, GRAYSCALE }; 732141cc406Sopenharmony_cienum halftonecode 733141cc406Sopenharmony_ci{ DITHER = 0x02, ERROR_DIFFUSION }; 734141cc406Sopenharmony_cistatic SANE_String_Const halftone_code[] = { 735141cc406Sopenharmony_ci "Dither", "Error Diffusion", NULL 736141cc406Sopenharmony_ci}; 737141cc406Sopenharmony_cistatic SANE_String_Const halftone_pattern_list[] = { 738141cc406Sopenharmony_ci "8x4, 45 degree", 739141cc406Sopenharmony_ci "6x6, 90 degree", 740141cc406Sopenharmony_ci "4x4, spiral", 741141cc406Sopenharmony_ci "8x8, 90 degree", 742141cc406Sopenharmony_ci "70 lines", 743141cc406Sopenharmony_ci "95 lines", 744141cc406Sopenharmony_ci "180 lines", 745141cc406Sopenharmony_ci "16x8, 45 degree", 746141cc406Sopenharmony_ci "16x16, 90 degree", 747141cc406Sopenharmony_ci "8x8, Bayer", 748141cc406Sopenharmony_ci "User #1", 749141cc406Sopenharmony_ci "User #2", 750141cc406Sopenharmony_ci NULL 751141cc406Sopenharmony_ci}; 752141cc406Sopenharmony_cistruct val_id halftone[] = { 753141cc406Sopenharmony_ci {0x01, 1}, 754141cc406Sopenharmony_ci {0x02, 2}, 755141cc406Sopenharmony_ci {0x03, 3}, 756141cc406Sopenharmony_ci {0x04, 4}, 757141cc406Sopenharmony_ci {0x05, 5}, 758141cc406Sopenharmony_ci {0x06, 6}, 759141cc406Sopenharmony_ci {0x07, 7}, 760141cc406Sopenharmony_ci {0x08, 9}, 761141cc406Sopenharmony_ci {0x09, 9}, 762141cc406Sopenharmony_ci {0x0A, 10}, 763141cc406Sopenharmony_ci {0x80, 11}, 764141cc406Sopenharmony_ci {0x81, 12} 765141cc406Sopenharmony_ci}; 766141cc406Sopenharmony_ci 767141cc406Sopenharmony_ci#if 0 768141cc406Sopenharmony_cistatic struct 769141cc406Sopenharmony_ci{ 770141cc406Sopenharmony_ci SANE_Byte code; 771141cc406Sopenharmony_ci char *type; 772141cc406Sopenharmony_ci} compression_types[] = 773141cc406Sopenharmony_ci{ 774141cc406Sopenharmony_ci { 775141cc406Sopenharmony_ci 0x00, "No compression"}, 776141cc406Sopenharmony_ci { 777141cc406Sopenharmony_ci 0x01, "CCITT G3, 1-dimensional (MH)"}, 778141cc406Sopenharmony_ci { 779141cc406Sopenharmony_ci 0x02, "CCITT G3, 2-dimensional (MR)"}, 780141cc406Sopenharmony_ci { 781141cc406Sopenharmony_ci 0x03, "CCITT G4, 2-dimensional (MMR)"}, 782141cc406Sopenharmony_ci /* 04H-0FH Reserved 783141cc406Sopenharmony_ci * 10H Reserved (not supported) 784141cc406Sopenharmony_ci * 11H-7FH Reserved 785141cc406Sopenharmony_ci */ 786141cc406Sopenharmony_ci { 787141cc406Sopenharmony_ci 0x80, "CCITT G3, 1-dimensional (MH) Padding with 0's to byte boundary"} 788141cc406Sopenharmony_ci /* 80H-FFH Reserved (Vendor Unique) */ 789141cc406Sopenharmony_ci}; 790141cc406Sopenharmony_cistatic struct 791141cc406Sopenharmony_ci{ 792141cc406Sopenharmony_ci SANE_Byte code; 793141cc406Sopenharmony_ci char *argument; 794141cc406Sopenharmony_ci} compression_argument[] = 795141cc406Sopenharmony_ci{ 796141cc406Sopenharmony_ci /* 00H Reserved */ 797141cc406Sopenharmony_ci /* 01H Reserved */ 798141cc406Sopenharmony_ci { 799141cc406Sopenharmony_ci 0x02, "K factor-0~255"} 800141cc406Sopenharmony_ci /* 03H Reserved */ 801141cc406Sopenharmony_ci /* 04H-0FH Reserved */ 802141cc406Sopenharmony_ci /* 10H Reserved */ 803141cc406Sopenharmony_ci /* 11H-7FH Reserved */ 804141cc406Sopenharmony_ci /* 80H Reserved */ 805141cc406Sopenharmony_ci /* 80H-FFH Reserved */ 806141cc406Sopenharmony_ci}; 807141cc406Sopenharmony_ci#endif 808141cc406Sopenharmony_ci#define GAMMA_NORMAL 0x00 809141cc406Sopenharmony_ci#define GAMMA_SOFT 0x01 810141cc406Sopenharmony_ci#define GAMMA_SHARP 0x02 811141cc406Sopenharmony_ci#define GAMMA_LINEAR 0x03 812141cc406Sopenharmony_ci#define GAMMA_USER 0x08 813141cc406Sopenharmony_ci/* 04H-07H Reserved */ 814141cc406Sopenharmony_ci/* 09H-0FH Reserved */ 815141cc406Sopenharmony_cistatic SANE_String gamma_list[6] = { 816141cc406Sopenharmony_ci "Normal", "Soft", "Sharp", "Linear", "User", NULL 817141cc406Sopenharmony_ci}; 818141cc406Sopenharmony_ci 819141cc406Sopenharmony_ci/* 1-3-11 SET WINDOW command */ 820141cc406Sopenharmony_ci 821141cc406Sopenharmony_cistruct window_section 822141cc406Sopenharmony_ci{ /* 32 bytes */ 823141cc406Sopenharmony_ci SANE_Byte sef; /*byte1 7-2:ignored 1:SEF '0'-invalid section; '1'-valid section */ 824141cc406Sopenharmony_ci SANE_Byte ignored0; 825141cc406Sopenharmony_ci SANE_Byte ulx[4]; 826141cc406Sopenharmony_ci SANE_Byte uly[4]; 827141cc406Sopenharmony_ci SANE_Byte width[4]; 828141cc406Sopenharmony_ci SANE_Byte length[4]; 829141cc406Sopenharmony_ci SANE_Byte binary_filtering; 830141cc406Sopenharmony_ci SANE_Byte ignored1; 831141cc406Sopenharmony_ci SANE_Byte threshold; 832141cc406Sopenharmony_ci SANE_Byte ignored2; 833141cc406Sopenharmony_ci SANE_Byte image_composition; 834141cc406Sopenharmony_ci SANE_Byte halftone_id; 835141cc406Sopenharmony_ci SANE_Byte halftone_code; 836141cc406Sopenharmony_ci SANE_Byte ignored3[7]; 837141cc406Sopenharmony_ci}; 838141cc406Sopenharmony_ci/* 1-3-11 SET WINDOW COMMAND 839141cc406Sopenharmony_ci * Byte0: 24H 840141cc406Sopenharmony_ci * Byte1: 7-5: LUN; 4-0: Reserved 841141cc406Sopenharmony_ci * Byte2-5: Reserved 842141cc406Sopenharmony_ci * Byte6-8: Transfer Length 843141cc406Sopenharmony_ci * Byte9: 7-6: Vendor Unique; 5-2: Reserved; 1: Flag; 0: Link 844141cc406Sopenharmony_ci * 845141cc406Sopenharmony_ci * Transfer length indicates the byte length of Window Parameters (Set Window Data Header + 846141cc406Sopenharmony_ci * Window Descriptor Bytes transferred from the initiator in the DATA OUT PHASE 847141cc406Sopenharmony_ci * The scanner supports 2 windows, so Transfer Length is 648 bytes: 848141cc406Sopenharmony_ci * Set Window Header 8 bytes + Window Descriptor Bytes 640 (320*2) bytes). 849141cc406Sopenharmony_ci * If data length is longer than 648 bytes only the first 648 bytes are valid, The remainng data is ignored. 850141cc406Sopenharmony_ci * If data length is shorter than 648 only the specified byte length is valid data. 851141cc406Sopenharmony_ci * 852141cc406Sopenharmony_ci * 853141cc406Sopenharmony_ci * WINDOW DATA HEADER 854141cc406Sopenharmony_ci * Byte0-5: Reserved 855141cc406Sopenharmony_ci * Byte6-7: Window Descriptor Length (WDL) 856141cc406Sopenharmony_ci * WDL indicates the number of bytes of one Window Descriptor Bytes which follows. 857141cc406Sopenharmony_ci * In this scanner, this value is 640 since it supports 2 windows. 858141cc406Sopenharmony_ci * 859141cc406Sopenharmony_ci * WINDOW DESCRIPTOR BYTES 860141cc406Sopenharmony_ci*/ 861141cc406Sopenharmony_ci#define HS2P_WINDOW_DATA_SIZE 640 862141cc406Sopenharmony_cistruct hs2p_window_data 863141cc406Sopenharmony_ci{ /* HS2P_WINDOW_DATA_FORMAT */ 864141cc406Sopenharmony_ci SANE_Byte window_id; /* 0: Window Identifier */ 865141cc406Sopenharmony_ci SANE_Byte auto_bit; /* 1: 1-1:Reserved; 0:Auto */ 866141cc406Sopenharmony_ci SANE_Byte xres[2]; /* 2-3: X-Axis Resolution 100-800dpi in 1dpi steps */ 867141cc406Sopenharmony_ci SANE_Byte yres[2]; /* 4-5: Y-Axis Resolution 100-800dpi in 1dpi steps */ 868141cc406Sopenharmony_ci SANE_Byte ulx[4]; /* 6-9: X-Axis Upper Left */ 869141cc406Sopenharmony_ci SANE_Byte uly[4]; /* 10-13: Y-Axis Upper Left */ 870141cc406Sopenharmony_ci SANE_Byte width[4]; /* 14-17: Window Width */ 871141cc406Sopenharmony_ci SANE_Byte length[4]; /* 18-21: Window Length */ 872141cc406Sopenharmony_ci SANE_Byte brightness; /* 22: Brightness [0-255] dark-light 0 means default value of 128 */ 873141cc406Sopenharmony_ci SANE_Byte threshold; /* 23: Threshold [0-255] 0 means default value of 128 */ 874141cc406Sopenharmony_ci SANE_Byte contrast; /* 24: Contrast [0-255] low-high 0 means default value of 128 */ 875141cc406Sopenharmony_ci SANE_Byte image_composition; /* 25: Image Composition 876141cc406Sopenharmony_ci * 00H Lineart 877141cc406Sopenharmony_ci * 01H Dithered Halftone 878141cc406Sopenharmony_ci * 02H Gray scale 879141cc406Sopenharmony_ci */ 880141cc406Sopenharmony_ci SANE_Byte bpp; /* 26: Bits Per Pixel */ 881141cc406Sopenharmony_ci SANE_Byte halftone_code; /* 27: Halftone Code 882141cc406Sopenharmony_ci * 00H-01H Reserved 883141cc406Sopenharmony_ci * 02H Dither (partial Dot) 884141cc406Sopenharmony_ci * 03H Error Diffusion 885141cc406Sopenharmony_ci * 04H-07H Reserved 886141cc406Sopenharmony_ci */ 887141cc406Sopenharmony_ci SANE_Byte halftone_id; /* 28: Halftone ID 888141cc406Sopenharmony_ci * 00H Reserved 889141cc406Sopenharmony_ci * 01H 8x4, 45 degree 890141cc406Sopenharmony_ci * 02H 6x6, 90 degree 891141cc406Sopenharmony_ci * 03H 4x4, Spiral 892141cc406Sopenharmony_ci * 04H 8x8, 90 degree 893141cc406Sopenharmony_ci * 05H 70 lines 894141cc406Sopenharmony_ci * 06H 95 lines 895141cc406Sopenharmony_ci * 07H 180 lines 896141cc406Sopenharmony_ci * 08H 16x8, 45 degree 897141cc406Sopenharmony_ci * 09H 16x16, 90 degree 898141cc406Sopenharmony_ci * 0AH 8x8, Bayer 899141cc406Sopenharmony_ci * 0Bh-7FH Reserved 900141cc406Sopenharmony_ci * 80H Download #1 901141cc406Sopenharmony_ci * 81H Download #2 902141cc406Sopenharmony_ci * 82H-FFH Reserved 903141cc406Sopenharmony_ci */ 904141cc406Sopenharmony_ci SANE_Byte byte29; /* 29: 7: RIF (Reverse Image Format) bit inversion 905141cc406Sopenharmony_ci * Image Composition field must be lineart or dithered halftone 906141cc406Sopenharmony_ci * RIF=0: White=0 Black=1 907141cc406Sopenharmony_ci * RIF=1: White=1 Black=0 908141cc406Sopenharmony_ci * 6-3: Reserved; 909141cc406Sopenharmony_ci * 2-0: Padding Type: 910141cc406Sopenharmony_ci * 00H Reserved 911141cc406Sopenharmony_ci * 01H Pad with 0's to byte boundary 912141cc406Sopenharmony_ci * 02H Pad with 1's to byte boundary 913141cc406Sopenharmony_ci * 03H Truncate to byte boundary 914141cc406Sopenharmony_ci * 04H-FFH Reserved 915141cc406Sopenharmony_ci */ 916141cc406Sopenharmony_ci SANE_Byte bit_ordering[2]; /* 30-31: Bit Ordering: Default 0xF8 917141cc406Sopenharmony_ci * 0: 0=>output from bit0 of each byte; 1=>output from bit7 918141cc406Sopenharmony_ci * 1: 0=>output from LSB; 1=>output from MSB 919141cc406Sopenharmony_ci * 2: 0=>unpacked 4 bits gray; 1=>Packed 4 bits gray 920141cc406Sopenharmony_ci * 3: 1=>Bits arrangement from LSB in grayscale; 0=>from MSB 921141cc406Sopenharmony_ci * 4-6: reserved 922141cc406Sopenharmony_ci * 7: 1=>Mirroring; 0=>Normal output 923141cc406Sopenharmony_ci * 8-15: reserved 924141cc406Sopenharmony_ci */ 925141cc406Sopenharmony_ci SANE_Byte compression_type; /* 32: Compression Type: Unsupported in IS450 */ 926141cc406Sopenharmony_ci SANE_Byte compression_arg; /* 33: Compression Argument: Unsupported in IS450 */ 927141cc406Sopenharmony_ci SANE_Byte reserved2[6]; /* 34-39: Reserved */ 928141cc406Sopenharmony_ci SANE_Byte ignored1; /* 40: Ignored */ 929141cc406Sopenharmony_ci SANE_Byte ignored2; /* 41: Ignored */ 930141cc406Sopenharmony_ci SANE_Byte byte42; /* 42: 7: MRIF: Grayscale Reverse Image Format 931141cc406Sopenharmony_ci * MRIF=0: White=0 Black=1 932141cc406Sopenharmony_ci * MRIF=1: White=1 Black=0 933141cc406Sopenharmony_ci * 6-4: Filtering: for Grayscale 934141cc406Sopenharmony_ci * 000 No filter 935141cc406Sopenharmony_ci * 001 Averaging 936141cc406Sopenharmony_ci * 010 Reserved 937141cc406Sopenharmony_ci * 011 MTF Correction 938141cc406Sopenharmony_ci * 100 Reserved 939141cc406Sopenharmony_ci * 110 Reserved 940141cc406Sopenharmony_ci * 111 Reserved 941141cc406Sopenharmony_ci * 3-0: Gamma ID 942141cc406Sopenharmony_ci * 00H Normal 943141cc406Sopenharmony_ci * 01H Soft 944141cc406Sopenharmony_ci * 02H Sharp 945141cc406Sopenharmony_ci * 03H Linear 946141cc406Sopenharmony_ci * 04H-07H Reserved 947141cc406Sopenharmony_ci * 08H Download table 948141cc406Sopenharmony_ci * 09H-0FH Reserved 949141cc406Sopenharmony_ci */ 950141cc406Sopenharmony_ci SANE_Byte ignored3; /* 43: Ignored */ 951141cc406Sopenharmony_ci SANE_Byte ignored4; /* 44: Ignored */ 952141cc406Sopenharmony_ci SANE_Byte binary_filtering; /* 45: Binary Filtering 953141cc406Sopenharmony_ci * 0-1: Noise Removal Matrix: 954141cc406Sopenharmony_ci * 00: 3x3 955141cc406Sopenharmony_ci * 01: 4x4 956141cc406Sopenharmony_ci * 10: 5x5 957141cc406Sopenharmony_ci * 11: Reserved 958141cc406Sopenharmony_ci * 5-2: Ignored 959141cc406Sopenharmony_ci * 6: Smoothing Flag 960141cc406Sopenharmony_ci * 7: Noise Removal Flag 961141cc406Sopenharmony_ci * 962141cc406Sopenharmony_ci * Smoothing and Noise removal can be set when option IPU is installed 963141cc406Sopenharmony_ci * Setting is ignored for reverse side because optional IPU is not valid 964141cc406Sopenharmony_ci * for reverse side scanning 965141cc406Sopenharmony_ci */ 966141cc406Sopenharmony_ci /* 967141cc406Sopenharmony_ci * The following is only available when IPU is installed: 968141cc406Sopenharmony_ci * SECTION, Automatic Separation, Automatic Binarization 969141cc406Sopenharmony_ci * 46-319 is ignored for Window 2 970141cc406Sopenharmony_ci */ 971141cc406Sopenharmony_ci SANE_Byte ignored5; /* 46: Ignored */ 972141cc406Sopenharmony_ci SANE_Byte ignored6; /* 47: Ignored */ 973141cc406Sopenharmony_ci SANE_Byte automatic_separation; /* 48: Automatic Separation 974141cc406Sopenharmony_ci * 00H OFF 975141cc406Sopenharmony_ci * 01H Default 976141cc406Sopenharmony_ci * 02H-7FH Reserved 977141cc406Sopenharmony_ci * 80H Download table 978141cc406Sopenharmony_ci * 91H-FFH Reserved 979141cc406Sopenharmony_ci */ 980141cc406Sopenharmony_ci SANE_Byte ignored7; /* 49: Ignored */ 981141cc406Sopenharmony_ci SANE_Byte automatic_binarization; /* 50: Automatic Binarization 982141cc406Sopenharmony_ci * 00H OFF 983141cc406Sopenharmony_ci * 01H Default 984141cc406Sopenharmony_ci * 02H Enhancement of light characters 985141cc406Sopenharmony_ci * 03H Removal of background color 986141cc406Sopenharmony_ci * 04H-7FH Reserved 987141cc406Sopenharmony_ci * 80H Download table 988141cc406Sopenharmony_ci * 81H-FFH Reserved 989141cc406Sopenharmony_ci */ 990141cc406Sopenharmony_ci SANE_Byte ignored8[13]; /* 51-63: Ignored */ 991141cc406Sopenharmony_ci struct window_section sec[8]; /* Each window can have multiple sections, each of 32 bytes long 992141cc406Sopenharmony_ci * 53-319: = 256 bytes = 8 sections of 32 bytes 993141cc406Sopenharmony_ci * IS450 supports up to 4 sections, 994141cc406Sopenharmony_ci * IS420 supports up to 6 sections 995141cc406Sopenharmony_ci */ 996141cc406Sopenharmony_ci}; 997141cc406Sopenharmony_cistruct set_window_cmd 998141cc406Sopenharmony_ci{ 999141cc406Sopenharmony_ci SANE_Byte opcode; /* 24H */ 1000141cc406Sopenharmony_ci SANE_Byte byte2; /* 7-5:LUN 4-0:Reserve */ 1001141cc406Sopenharmony_ci SANE_Byte reserved[4]; /* Reserved */ 1002141cc406Sopenharmony_ci SANE_Byte len[3]; /* Transfer Length */ 1003141cc406Sopenharmony_ci SANE_Byte control; /* 76543210 1004141cc406Sopenharmony_ci * XX Vendor Unique 1005141cc406Sopenharmony_ci * XXXX Reserved 1006141cc406Sopenharmony_ci * X Flag 1007141cc406Sopenharmony_ci * X Link 1008141cc406Sopenharmony_ci */ 1009141cc406Sopenharmony_ci}; 1010141cc406Sopenharmony_cistruct set_window_data_hdr 1011141cc406Sopenharmony_ci{ 1012141cc406Sopenharmony_ci SANE_Byte reserved[6]; 1013141cc406Sopenharmony_ci SANE_Byte len[2]; 1014141cc406Sopenharmony_ci}; 1015141cc406Sopenharmony_citypedef struct set_window_data 1016141cc406Sopenharmony_ci{ 1017141cc406Sopenharmony_ci struct set_window_data_hdr hdr; 1018141cc406Sopenharmony_ci struct hs2p_window_data data[2]; 1019141cc406Sopenharmony_ci} SWD; 1020141cc406Sopenharmony_ci 1021141cc406Sopenharmony_ci/* 1-3-12 GET WINDOW command */ 1022141cc406Sopenharmony_cistruct get_window_cmd 1023141cc406Sopenharmony_ci{ 1024141cc406Sopenharmony_ci SANE_Byte opcode; 1025141cc406Sopenharmony_ci SANE_Byte byte1; /* 7-5: LUN; * 4-1:Reserved; * 0:Single bit is 0 */ 1026141cc406Sopenharmony_ci SANE_Byte reserved[3]; 1027141cc406Sopenharmony_ci SANE_Byte win_id; /* Window ID is either 0 or 1 */ 1028141cc406Sopenharmony_ci SANE_Byte len[3]; /* Transfer Length */ 1029141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 1030141cc406Sopenharmony_ci}; 1031141cc406Sopenharmony_ci/* The data format to be returned is Get Window Data header + Window Descriptor Bytes 1032141cc406Sopenharmony_ci * The format of Window Descriptor Bytes is the same as that for SET WINDOW 1033141cc406Sopenharmony_ci*/ 1034141cc406Sopenharmony_cistruct get_window_data_hdr 1035141cc406Sopenharmony_ci{ 1036141cc406Sopenharmony_ci SANE_Byte data_len[2]; /* Window Data Length indicates byte len of data which follows less its own 2 bytes */ 1037141cc406Sopenharmony_ci SANE_Byte reserved[4]; 1038141cc406Sopenharmony_ci SANE_Byte desc_len[2]; /* Window Descriptor Length indicates byte length of one Window Descriptor which is 640 */ 1039141cc406Sopenharmony_ci}; 1040141cc406Sopenharmony_citypedef struct get_window_data 1041141cc406Sopenharmony_ci{ 1042141cc406Sopenharmony_ci struct get_window_data_hdr hdr; 1043141cc406Sopenharmony_ci struct hs2p_window_data data[2]; 1044141cc406Sopenharmony_ci} GWD; 1045141cc406Sopenharmony_ci 1046141cc406Sopenharmony_ci/* READ/SEND DATA TYPE CODES */ 1047141cc406Sopenharmony_ci/* DATA TYPE CODES (DTC): */ 1048141cc406Sopenharmony_ci#define DATA_TYPE_IMAGE 0x00 1049141cc406Sopenharmony_ci/* 01H Reserved (Vendor Unique) */ 1050141cc406Sopenharmony_ci#define DATA_TYPE_HALFTONE 0x02 1051141cc406Sopenharmony_ci#define DATA_TYPE_GAMMA 0x03 1052141cc406Sopenharmony_ci/*04H-7FH Reserved */ 1053141cc406Sopenharmony_ci#define DATA_TYPE_ENDORSER 0x80 1054141cc406Sopenharmony_ci#define DATA_TYPE_SIZE 0x81 1055141cc406Sopenharmony_ci/* 82H Reserved */ 1056141cc406Sopenharmony_ci/* 83H Reserved (Vendor Unique) */ 1057141cc406Sopenharmony_ci#define DATA_TYPE_PAGE_LEN 0x84 1058141cc406Sopenharmony_ci#define DATA_TYPE_MAINTENANCE 0x85 1059141cc406Sopenharmony_ci#define DATA_TYPE_ADF_STATUS 0x86 1060141cc406Sopenharmony_ci/* 87H Reserved (Skew Data) */ 1061141cc406Sopenharmony_ci/* 88H-91H Reserved (Vendor Unique) */ 1062141cc406Sopenharmony_ci/* 92H Reserved (Scanner Extension I/O Access) */ 1063141cc406Sopenharmony_ci/* 93H Reserved (Vendor Unique) */ 1064141cc406Sopenharmony_ci/* 94H-FFH Reserved (Vendor Unique) */ 1065141cc406Sopenharmony_ci#define DATA_TYPE_EOL -1 /* va_end */ 1066141cc406Sopenharmony_ci 1067141cc406Sopenharmony_ci/* DATA TYPE QUALIFIER CODES when DTC=93H */ 1068141cc406Sopenharmony_ci#define DTQ 0x00 /* ignored */ 1069141cc406Sopenharmony_ci#define DTQ_AUTO_PHOTOLETTER 0x00 /* default */ 1070141cc406Sopenharmony_ci#define DTQ_DYNAMIC_THRESHOLDING 0x01 /* default */ 1071141cc406Sopenharmony_ci#define DTQ_LIGHT_CHARS_ENHANCEMENT 0x02 1072141cc406Sopenharmony_ci#define DTQ_BACKGROUND_REMOVAL 0x03 1073141cc406Sopenharmony_ci/* 04H-7FH Reserved */ 1074141cc406Sopenharmony_ci#define DTQ_AUTO_PHOTOLETTER_DOWNLOAD_TABLE 0x80 1075141cc406Sopenharmony_ci#define DTQ_DYNAMIC_THRESHOLD_DOWNLOAD_TABLE 0x81 1076141cc406Sopenharmony_ci/* 82H-FFH Reserved */ 1077141cc406Sopenharmony_ci 1078141cc406Sopenharmony_ci/* 1-3-13 READ command */ 1079141cc406Sopenharmony_ci/* 1-3-14 SEND command */ 1080141cc406Sopenharmony_cistruct scsi_rs_scanner_cmd 1081141cc406Sopenharmony_ci{ 1082141cc406Sopenharmony_ci SANE_Byte opcode; /* READ=28H SEND=2AH */ 1083141cc406Sopenharmony_ci SANE_Byte byte1; /* 7-5:LUN; 4-0:Reserved */ 1084141cc406Sopenharmony_ci SANE_Byte dtc; /* Data Type Code: See DTC DEFINES above */ 1085141cc406Sopenharmony_ci SANE_Byte reserved; 1086141cc406Sopenharmony_ci SANE_Byte dtq[2]; /* Data Type Qualifier valid only for DTC 02H,03H,93H */ 1087141cc406Sopenharmony_ci SANE_Byte len[3]; /* Transfer Length */ 1088141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 1089141cc406Sopenharmony_ci}; 1090141cc406Sopenharmony_ci/* 1091141cc406Sopenharmony_ci * Data Format for Image Data 1092141cc406Sopenharmony_ci * Non-compressed: {first_line, second_line, ... nth_line} 1093141cc406Sopenharmony_ci * MH/MR Compression: {EOL, 1st_line_compressed, EOL, 2nd_line_compressed,..., EOL, last_line_compressed, EOL,EOL,EOL,EOL,EOL,EOL 1094141cc406Sopenharmony_ci * where EOL = 000000000001 1095141cc406Sopenharmony_ci * MMR Compression: = {1st_line_compressed, 2nd_line_compressed,...,last_line_compressed, EOL,EOL} 1096141cc406Sopenharmony_ci * 1097141cc406Sopenharmony_ci * Normal Binary Output: MSB-LSB 1stbytes,2nd,3rd...Last 1098141cc406Sopenharmony_ci * Mirror Binary Output: MSB-LSB Last,...2nd,1st 1099141cc406Sopenharmony_ci * 1100141cc406Sopenharmony_ci * Normal Gray Output MSB-LSB: 1st,2nd,3rd...Last 1101141cc406Sopenharmony_ci * 4 bit/pixel gray: [32103210] 1102141cc406Sopenharmony_ci * 8 bit/pixel gray: [76543210] 1103141cc406Sopenharmony_ci * Mirror Gray Output MSB-LSB Last,...2nd,1st 1104141cc406Sopenharmony_ci * 1105141cc406Sopenharmony_ci * 1106141cc406Sopenharmony_ci * HALFTONE MASK DATA: 1byte(row,col) ={2,3,4,6,8,16} 1107141cc406Sopenharmony_ci * (r0,c0), (r0,c1), (r0,c2)...(r1,c0),(r1,c2)...(rn,cn) 1108141cc406Sopenharmony_ci * 1109141cc406Sopenharmony_ci * GAMMA FUNCTION TABLE Output (D) vs. Input (I)(0,0)=(Black,Black) (255,255)=(White,White) 1110141cc406Sopenharmony_ci * The number of gray scale M = 8 1111141cc406Sopenharmony_ci * 2^8 = 256 total table data 1112141cc406Sopenharmony_ci * D0 = D(I=0), D1=D(I=1)...D255=D(I=255) 1113141cc406Sopenharmony_ci * DATA= [1st byte ID],[2nd byte M],[D0],[D1],...[D255] 1114141cc406Sopenharmony_ci * 1115141cc406Sopenharmony_ci * ENDORSER DATA: 1st_char, 2nd_char,...last_char 1116141cc406Sopenharmony_ci * 1117141cc406Sopenharmony_ci * SIZE DATA: 1byte: 4bits-Start Position; 4bits-Width Info 1118141cc406Sopenharmony_ci * 1119141cc406Sopenharmony_ci * PAGE LENGTH: 5bytes: 1st byte is MSB, Last byte is LSB 1120141cc406Sopenharmony_ci*/ 1121141cc406Sopenharmony_ci 1122141cc406Sopenharmony_citypedef struct maintenance_data 1123141cc406Sopenharmony_ci{ 1124141cc406Sopenharmony_ci SANE_Byte nregx_adf; /* number of registers of main-scanning in ADF mode */ 1125141cc406Sopenharmony_ci SANE_Byte nregy_adf; /* number of registers of sub-scanning in ADF mode */ 1126141cc406Sopenharmony_ci SANE_Byte nregx_book; /* number of registers of main-scanning in Book mode */ 1127141cc406Sopenharmony_ci SANE_Byte nregy_book; /* number of registers of sub-scanning in Book mode */ 1128141cc406Sopenharmony_ci SANE_Byte nscans_adf[4]; /* Number of scanned pages in ADF mode */ 1129141cc406Sopenharmony_ci SANE_Byte nscans_book[4]; /* Number of scanned pages in Book mode */ 1130141cc406Sopenharmony_ci SANE_Byte lamp_time[4]; /* Lamp Time */ 1131141cc406Sopenharmony_ci SANE_Byte eo_odd; /* Adjustment data of E/O balance in black level (ODD) */ 1132141cc406Sopenharmony_ci SANE_Byte eo_even; /* Adjustment data of E/O balance in black level (EVEN) */ 1133141cc406Sopenharmony_ci SANE_Byte black_level_odd; /* The adjustment data in black level (ODD) */ 1134141cc406Sopenharmony_ci SANE_Byte black_level_even; /* The adjustment data in black level (EVEN) */ 1135141cc406Sopenharmony_ci SANE_Byte white_level_odd[2]; /* The adjustment data in white level (ODD) */ 1136141cc406Sopenharmony_ci SANE_Byte white_level_even[2]; /* The adjustment data in white level (EVEN) */ 1137141cc406Sopenharmony_ci SANE_Byte first_adj_white_odd[2]; /* First adjustment data in white level (ODD) */ 1138141cc406Sopenharmony_ci SANE_Byte first_adj_white_even[2]; /* First adjustment data in white level (EVEN) */ 1139141cc406Sopenharmony_ci SANE_Byte density_adj; /* Density adjustment */ 1140141cc406Sopenharmony_ci SANE_Byte nregx_reverse; /* The number of registers of main-scanning of the reverse-side ADF */ 1141141cc406Sopenharmony_ci SANE_Byte nregy_reverse; /* The number of registers of sub-scanning of the reverse-side ADF */ 1142141cc406Sopenharmony_ci SANE_Byte nscans_reverse_adf[4]; /* Number of scanned pages of the reverse side ADF */ 1143141cc406Sopenharmony_ci SANE_Byte reverse_time[4]; /* The period of lamp turn on of the reverse side */ 1144141cc406Sopenharmony_ci SANE_Byte nchars[4]; /* The number of endorser characters */ 1145141cc406Sopenharmony_ci SANE_Byte reserved0; 1146141cc406Sopenharmony_ci SANE_Byte reserved1; 1147141cc406Sopenharmony_ci SANE_Byte reserved2; 1148141cc406Sopenharmony_ci SANE_Byte zero[2]; /* All set as 0 */ 1149141cc406Sopenharmony_ci} MAINTENANCE_DATA; 1150141cc406Sopenharmony_ci/* ADF status 1byte: 1151141cc406Sopenharmony_ci * 7-3:Reserved; 1152141cc406Sopenharmony_ci * 2:Reserved; 1153141cc406Sopenharmony_ci * 1: '0'-ADF cover closed; '1'-ADF cover open 1154141cc406Sopenharmony_ci * 0: '0'-Document on ADF; '1'-No document on ADF 1155141cc406Sopenharmony_ci * 1156141cc406Sopenharmony_ci*/ 1157141cc406Sopenharmony_ci 1158141cc406Sopenharmony_cistruct IPU 1159141cc406Sopenharmony_ci{ 1160141cc406Sopenharmony_ci SANE_Byte byte0; /* 7-4:Reserved; 3:White mode; 2:Reserved; 1-0: Gamma Table Select */ 1161141cc406Sopenharmony_ci SANE_Byte byte1; /* 7-2:Reserved; 1-0: MTF Filter Select */ 1162141cc406Sopenharmony_ci}; 1163141cc406Sopenharmony_cistruct IPU_Auto_PhotoLetter 1164141cc406Sopenharmony_ci{ 1165141cc406Sopenharmony_ci /* Halftone Separations for each level 1166141cc406Sopenharmony_ci * 256 steps of relative value with 0 the sharpest and 255 the softest 1167141cc406Sopenharmony_ci * The relation of strength is Strength2 > Strength3 > Strength4 ... 1168141cc406Sopenharmony_ci */ 1169141cc406Sopenharmony_ci struct 1170141cc406Sopenharmony_ci { 1171141cc406Sopenharmony_ci SANE_Byte level[6]; 1172141cc406Sopenharmony_ci } halftone_separation[2]; 1173141cc406Sopenharmony_ci 1174141cc406Sopenharmony_ci /* 7-2:Reversed 1-0:Halftone 1175141cc406Sopenharmony_ci * 00 Default 1176141cc406Sopenharmony_ci * 01 Peak Detection Soft 1177141cc406Sopenharmony_ci * 10 Peak Detection Sharp 1178141cc406Sopenharmony_ci * 11 Don't Use 1179141cc406Sopenharmony_ci */ 1180141cc406Sopenharmony_ci SANE_Byte byte12; 1181141cc406Sopenharmony_ci 1182141cc406Sopenharmony_ci SANE_Byte black_correction; /* Black correction strength: 0-255 sharpest-softest */ 1183141cc406Sopenharmony_ci SANE_Byte edge_sep[4]; /* Edge Separation strengths: 0-255 sharpest-softest 1-4 */ 1184141cc406Sopenharmony_ci SANE_Byte white_background_sep_strength; /* 0-255 sharpest-softest */ 1185141cc406Sopenharmony_ci SANE_Byte byte19; /* 7-1:Reversed; 0:White mode '0'-Default; '1'-Sharp */ 1186141cc406Sopenharmony_ci SANE_Byte byte20; /* 7-1:Reversed; 0:Halftone mode '0'-widen dots; '1'-Default */ 1187141cc406Sopenharmony_ci SANE_Byte halftone_sep_levela; 1188141cc406Sopenharmony_ci SANE_Byte halftone_sep_levelb; 1189141cc406Sopenharmony_ci SANE_Byte byte23; /* 7-4:Reversed; 3-0:Adjustment of separation level: usually fixed to 0 */ 1190141cc406Sopenharmony_ci 1191141cc406Sopenharmony_ci /* 7-4:Reversed; 3-0:Judge Conditions Select 1192141cc406Sopenharmony_ci * 0XXX Black Correction OFF 1XXX Black Correction ON 1193141cc406Sopenharmony_ci * X0XX Halftone Separation OFF X1XX Halftone Separation ON 1194141cc406Sopenharmony_ci * XX0X White Separation OFF XX1X White Separation ON 1195141cc406Sopenharmony_ci * XXX0 Edge Separation OFF XXX1 Edge Separation ON 1196141cc406Sopenharmony_ci */ 1197141cc406Sopenharmony_ci SANE_Byte byte24; 1198141cc406Sopenharmony_ci 1199141cc406Sopenharmony_ci /* 7-4:Filter A; 3-0:Filter B 1200141cc406Sopenharmony_ci * FilterA: 16 types are valid from 0000 to 1111 1201141cc406Sopenharmony_ci * FilterB: 0000 to 1110 are valid; 1111 is not valid 1202141cc406Sopenharmony_ci */ 1203141cc406Sopenharmony_ci SANE_Byte MTF_correction; 1204141cc406Sopenharmony_ci 1205141cc406Sopenharmony_ci /* 7-4:Filter A; 3-0:Filter B 1206141cc406Sopenharmony_ci * 0000(soft) to 0111(sharp) are valid; 1000 to 1111 are invalid 1207141cc406Sopenharmony_ci */ 1208141cc406Sopenharmony_ci SANE_Byte MTF_strength; 1209141cc406Sopenharmony_ci 1210141cc406Sopenharmony_ci /* 7-4:Filter A; 3-0:Filter B 1211141cc406Sopenharmony_ci * slightly adjusts the strength of the filters 1212141cc406Sopenharmony_ci */ 1213141cc406Sopenharmony_ci SANE_Byte MTF_adjustment; 1214141cc406Sopenharmony_ci 1215141cc406Sopenharmony_ci /* 7-4:Reserved; 3-0: smoothing filter select 1216141cc406Sopenharmony_ci * 14 kinds are valid from 0000 to 1101; 1110 to 1111 are invalid 1217141cc406Sopenharmony_ci */ 1218141cc406Sopenharmony_ci SANE_Byte smoothing; 1219141cc406Sopenharmony_ci 1220141cc406Sopenharmony_ci /* 7-2:Reversed; 1-0: Filter Select 1221141cc406Sopenharmony_ci * 10 MTF Correction Select 1222141cc406Sopenharmony_ci * 11 Smoothing Select 1223141cc406Sopenharmony_ci * from 00 to 01 are not valid and basically it is set as 10 1224141cc406Sopenharmony_ci */ 1225141cc406Sopenharmony_ci SANE_Byte byte29; 1226141cc406Sopenharmony_ci 1227141cc406Sopenharmony_ci /* 7-4:Reserved; 3-0: MTF Correction Filter C 1228141cc406Sopenharmony_ci * 16 kinds are valid from 0000 to 1111 1229141cc406Sopenharmony_ci */ 1230141cc406Sopenharmony_ci SANE_Byte MTF_correction_c; 1231141cc406Sopenharmony_ci 1232141cc406Sopenharmony_ci /* 7-3:Reserved; 2-0: MTF Correction Filter strength C 1233141cc406Sopenharmony_ci * 000(soft) to 111(sharp) are valid 1234141cc406Sopenharmony_ci */ 1235141cc406Sopenharmony_ci SANE_Byte MTF_strength_c; 1236141cc406Sopenharmony_ci}; 1237141cc406Sopenharmony_ci/* 1238141cc406Sopenharmony_cistruct IPU_Dynamic { 1239141cc406Sopenharmony_ci to be implemented 1240141cc406Sopenharmony_ci}; 1241141cc406Sopenharmony_cisensor data 1242141cc406Sopenharmony_ci*/ 1243141cc406Sopenharmony_ci 1244141cc406Sopenharmony_ci/* for object_position command */ 1245141cc406Sopenharmony_ci#define OBJECT_POSITION_UNLOAD 0 1246141cc406Sopenharmony_ci#define OBJECT_POSITION_LOAD 1 1247141cc406Sopenharmony_ci 1248141cc406Sopenharmony_ci/* 1-3-15 OBJECT POSITION */ 1249141cc406Sopenharmony_citypedef struct scsi_object_position_cmd 1250141cc406Sopenharmony_ci{ 1251141cc406Sopenharmony_ci SANE_Byte opcode; /* 31H */ 1252141cc406Sopenharmony_ci SANE_Byte position_func; /* 7-5:LUN; 4-3:Reserved; 2-0:Position Function (bit2,bit1,bit0): 1253141cc406Sopenharmony_ci * 000 Unload Object (NO CHECK ERROR even though no document on ADF) 1254141cc406Sopenharmony_ci * 001 Load Object (NO CHECK ERROR even though document already fed to start position) 1255141cc406Sopenharmony_ci * 010 Absolute Positioning in Y-axis. Not Supported in this scanner 1256141cc406Sopenharmony_ci * 3H-7H Reserved */ 1257141cc406Sopenharmony_ci SANE_Byte count[3]; /* Reserved */ 1258141cc406Sopenharmony_ci SANE_Byte reserved[4]; 1259141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 1260141cc406Sopenharmony_ci} POSITION; 1261141cc406Sopenharmony_ci 1262141cc406Sopenharmony_ci/* 1-3-16 GET DATA BUFFER STATUS */ 1263141cc406Sopenharmony_citypedef struct scsi_get_data_buffer_status_cmd 1264141cc406Sopenharmony_ci{ 1265141cc406Sopenharmony_ci SANE_Byte opcode; /* 34H */ 1266141cc406Sopenharmony_ci SANE_Byte wait; /* 7-5:LUN; 4-1:Reserved; 0: Wait bit is "0" */ 1267141cc406Sopenharmony_ci SANE_Byte reserved[5]; 1268141cc406Sopenharmony_ci SANE_Byte len[2]; /* Allocation Length */ 1269141cc406Sopenharmony_ci SANE_Byte control; /* 7-6:Vendor Unique; 5-2:Reserved; 1:Flag; 0:Link */ 1270141cc406Sopenharmony_ci} GET_DBS_CMD; 1271141cc406Sopenharmony_citypedef struct scsi_status_hdr 1272141cc406Sopenharmony_ci{ 1273141cc406Sopenharmony_ci SANE_Byte len[3]; /* Data Buffer Status Length */ 1274141cc406Sopenharmony_ci SANE_Byte block; /* 7-1:Reserved; 0:Block bit is 0 */ 1275141cc406Sopenharmony_ci} STATUS_HDR; 1276141cc406Sopenharmony_citypedef struct scsi_status_data 1277141cc406Sopenharmony_ci{ 1278141cc406Sopenharmony_ci SANE_Byte wid; /* window identifier is 0 or 1 */ 1279141cc406Sopenharmony_ci SANE_Byte reserved; 1280141cc406Sopenharmony_ci SANE_Byte free[3]; /* Available Space Data `Buffer */ 1281141cc406Sopenharmony_ci SANE_Byte filled[3]; /* Scan Data Available (Filled Data Bufferj) */ 1282141cc406Sopenharmony_ci} STATUS_DATA; 1283141cc406Sopenharmony_ci/* BUFFER STATUS DATA FORMAT */ 1284141cc406Sopenharmony_citypedef struct scsi_buffer_status 1285141cc406Sopenharmony_ci{ 1286141cc406Sopenharmony_ci STATUS_HDR hdr; 1287141cc406Sopenharmony_ci STATUS_DATA data; 1288141cc406Sopenharmony_ci} STATUS_BUFFER; 1289