1/* sane - Scanner Access Now Easy. 2 3 pieusb_usb.h 4 5 Copyright (C) 2012-2015 Jan Vleeshouwers, Michael Rickmann, Klaus Kaempf 6 7 This file is part of the SANE package. 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License as 11 published by the Free Software Foundation; either version 2 of the 12 License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, but 15 WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <https://www.gnu.org/licenses/>. 21 22 As a special exception, the authors of SANE give permission for 23 additional uses of the libraries contained in this release of SANE. 24 25 The exception is that, if you link a SANE library with other files 26 to produce an executable, this does not by itself cause the 27 resulting executable to be covered by the GNU General Public 28 License. Your use of that executable is in no way restricted on 29 account of linking the SANE library code into it. 30 31 This exception does not, however, invalidate any other reasons why 32 the executable file might be covered by the GNU General Public 33 License. 34 35 If you submit changes to SANE to the maintainers to be included in 36 a subsequent release, you agree by submitting the changes that 37 those changes may be distributed with this exception intact. 38 39 If you write modifications of your own for SANE, it is your choice 40 whether to permit this exception to apply to your modifications. 41 If you do not wish that, delete this exception notice. */ 42 43#ifndef PIEUSB_USB_H 44#define PIEUSB_USB_H 45 46#define PIEUSB_WAIT_BUSY 1 /* seconds to wait on busy condition */ 47 48#define SCSI_COMMAND_LEN 6 49 50SANE_Status sanei_pieusb_usb_reset(SANE_Int device_number); 51 52SANE_Status sanei_pieusb_convert_status(PIEUSB_Status status); 53 54SANE_String sanei_pieusb_decode_sense(struct Pieusb_Sense* sense, PIEUSB_Status *status); 55 56PIEUSB_Status sanei_pieusb_command(SANE_Int device_number, SANE_Byte command[], SANE_Byte data[], SANE_Int size); 57 58/* ========================================================================= 59 * 60 * Pieusb scanner commands 61 * 62 * ========================================================================= */ 63 64/* Standard SCSI command codes */ 65#define SCSI_TEST_UNIT_READY 0x00 66#define SCSI_REQUEST_SENSE 0x03 67#define SCSI_READ 0x08 68#define SCSI_WRITE 0x0A 69#define SCSI_PARAM 0x0F 70#define SCSI_INQUIRY 0x12 71#define SCSI_MODE_SELECT 0x15 72#define SCSI_COPY 0x18 73#define SCSI_MODE_SENSE 0x1A 74#define SCSI_SCAN 0x1B 75 76/* Non-standard SCSI command codes */ 77#define SCSI_SLIDE 0xD1 78#define SCSI_SET_SCAN_HEAD 0xD2 79#define SCSI_READ_GAIN_OFFSET 0xD7 80#define SCSI_WRITE_GAIN_OFFSET 0xDC 81#define SCSI_READ_STATE 0xDD 82 83/* Additional SCSI READ/WRITE codes, |0x80 for Read */ 84#define SCSI_POWER_SAVE_CONTROL 0x01 85#define SCSI_GAMMA_TABLE 0x10 86#define SCSI_HALFTONE_PATTERN 0x11 87#define SCSI_SCAN_FRAME 0x12 88#define SCSI_EXPOSURE 0x13 89#define SCSI_HIGHLIGHT_SHADOW 0x14 90#define SCSI_CALIBRATION_INFO 0x15 91#define SCSI_CAL_DATA 0x16 92#define SCSI_CMD_17 0x17 /* used by CyberView */ 93 94/* Standard SCSI Sense keys, see http://www.t10.org/lists/2sensekey.htm */ 95#define SCSI_SENSE_NO_SENSE 0x00 96#define SCSI_SENSE_RECOVERED_ERROR 0x01 97#define SCSI_SENSE_NOT_READY 0x02 98#define SCSI_SENSE_MEDIUM_ERROR 0x03 99#define SCSI_SENSE_HARDWARE_ERROR 0x04 100#define SCSI_SENSE_ILLEGAL_REQUEST 0x05 101#define SCSI_SENSE_UNIT_ATTENTION 0x06 102#define SCSI_SENSE_DATA_PROTECT 0x07 103#define SCSI_SENSE_BLANK_CHECK 0x08 104#define SCSI_SENSE_VENDOR_SPECIFIC 0x09 105#define SCSI_SENSE_COPY_ABORTED 0x0A 106#define SCSI_SENSE_ABORTED_COMMAND 0x0B 107#define SCSI_SENSE_EQUAL 0x0C 108#define SCSI_SENSE_VOLUME_OVERFLOW 0x0D 109#define SCSI_SENSE_MISCOMPARE 0x0E 110#define SCSI_SENSE_COMPLETED 0x0F 111 112#endif /* PIEUSB_USB_H */ 113