1/* sane - Scanner Access Now Easy. 2 3 This file is part of the SANE package. 4 5 SANE is free software; you can redistribute it and/or modify it under 6 the terms of the GNU General Public License as published by the Free 7 Software Foundation; either version 2 of the License, or (at your 8 option) any later version. 9 10 SANE is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with sane; see the file COPYING. 17 If not, see <https://www.gnu.org/licenses/>. 18 19 As a special exception, the authors of SANE give permission for 20 additional uses of the libraries contained in this release of SANE. 21 22 The exception is that, if you link a SANE library with other files 23 to produce an executable, this does not by itself cause the 24 resulting executable to be covered by the GNU General Public 25 License. Your use of that executable is in no way restricted on 26 account of linking the SANE library code into it. 27 28 This exception does not, however, invalidate any other reasons why 29 the executable file might be covered by the GNU General Public 30 License. 31 32 If you submit changes to SANE to the maintainers to be included in 33 a subsequent release, you agree by submitting the changes that 34 those changes may be distributed with this exception intact. 35 36 If you write modifications of your own for SANE, it is your choice 37 whether to permit this exception to apply to your modifications. 38 If you do not wish that, delete this exception notice. 39*/ 40 41#ifndef SG_ERR_H 42#define SG_ERR_H 43 44/* Linux sg error codes taken from Doug Gilbert's sg_utils: 45 http://www.torque.net/sg/ */ 46 47/* Some of the following error/status codes are exchanged between the 48 various layers of the SCSI sub-system in Linux and should never 49 reach the user. They are placed here for completeness. What appears 50 here is copied from drivers/scsi/scsi.h which is not visible in 51 the user space. */ 52 53/* The following are 'host_status' codes */ 54#ifndef DID_OK 55#define DID_OK 0x00 56#endif 57#ifndef DID_NO_CONNECT 58#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ 59#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ 60#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ 61#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ 62#define DID_ABORT 0x05 /* Told to abort for some other reason */ 63#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ 64#define DID_ERROR 0x07 /* Internal error */ 65#define DID_RESET 0x08 /* Reset by somebody */ 66#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ 67#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ 68#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ 69#endif 70 71 72 73/* These defines are to isolate applictaions from kernel define changes */ 74#define SG_ERR_DID_OK DID_OK 75#define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT 76#define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY 77#define SG_ERR_DID_TIME_OUT DID_TIME_OUT 78#define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET 79#define SG_ERR_DID_ABORT DID_ABORT 80#define SG_ERR_DID_PARITY DID_PARITY 81#define SG_ERR_DID_ERROR DID_ERROR 82#define SG_ERR_DID_RESET DID_RESET 83#define SG_ERR_DID_BAD_INTR DID_BAD_INTR 84#define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH 85#define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR 86 87/* The following are 'driver_status' codes */ 88#ifndef DRIVER_OK 89#define DRIVER_OK 0x00 90#endif 91#ifndef DRIVER_BUSY 92#define DRIVER_BUSY 0x01 93#define DRIVER_SOFT 0x02 94#define DRIVER_MEDIA 0x03 95#define DRIVER_ERROR 0x04 96#define DRIVER_INVALID 0x05 97#define DRIVER_TIMEOUT 0x06 98#define DRIVER_HARD 0x07 99#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ 100 101/* Following "suggests" are "or-ed" with one of previous 8 entries */ 102#define SUGGEST_RETRY 0x10 103#define SUGGEST_ABORT 0x20 104#define SUGGEST_REMAP 0x30 105#define SUGGEST_DIE 0x40 106#define SUGGEST_SENSE 0x80 107#define SUGGEST_IS_OK 0xff 108#endif 109#ifndef DRIVER_MASK 110#define DRIVER_MASK 0x0f 111#endif 112#ifndef SUGGEST_MASK 113#define SUGGEST_MASK 0xf0 114#endif 115 116/* These defines are to isolate applictaions from kernel define changes */ 117#define SG_ERR_DRIVER_OK DRIVER_OK 118#define SG_ERR_DRIVER_BUSY DRIVER_BUSY 119#define SG_ERR_DRIVER_SOFT DRIVER_SOFT 120#define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA 121#define SG_ERR_DRIVER_ERROR DRIVER_ERROR 122#define SG_ERR_DRIVER_INVALID DRIVER_INVALID 123#define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT 124#define SG_ERR_DRIVER_HARD DRIVER_HARD 125#define SG_ERR_DRIVER_SENSE DRIVER_SENSE 126#define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY 127#define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT 128#define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP 129#define SG_ERR_SUGGEST_DIE SUGGEST_DIE 130#define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE 131#define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK 132#define SG_ERR_DRIVER_MASK DRIVER_MASK 133#define SG_ERR_SUGGEST_MASK SUGGEST_MASK 134 135#endif 136