1#ifndef _HP5400_SANEI_H_ 2#define _HP5400_SANEI_H_ 3 4/* sane - Scanner Access Now Easy. 5 Copyright (C) 2003 Martijn van Oosterhout <kleptog@svana.org> 6 Copyright (C) 2003 Thomas Soumarmon <thomas.soumarmon@cogitae.net> 7 Copyright (c) 2003 Henning Meier-Geinitz, <henning@meier-geinitz.de> 8 9 Originally copied from HP3300 testtools. Original notice follows: 10 11 Copyright (C) 2001 Bertrik Sikken (bertrik@zonnet.nl) 12 13 This file is part of the SANE package. 14 15 This program is free software; you can redistribute it and/or 16 modify it under the terms of the GNU General Public License 17 as published by the Free Software Foundation; either version 2 18 of the License, or (at your option) any later version. 19 20 This program is distributed in the hope that it will be useful, 21 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 GNU General Public License for more details. 24 25 You should have received a copy of the GNU General Public License 26 along with this program. If not, see <https://www.gnu.org/licenses/>. 27 28 As a special exception, the authors of SANE give permission for 29 additional uses of the libraries contained in this release of SANE. 30 31 The exception is that, if you link a SANE library with other files 32 to produce an executable, this does not by itself cause the 33 resulting executable to be covered by the GNU General Public 34 License. Your use of that executable is in no way restricted on 35 account of linking the SANE library code into it. 36 37 This exception does not, however, invalidate any other reasons why 38 the executable file might be covered by the GNU General Public 39 License. 40 41 If you submit changes to SANE to the maintainers to be included in 42 a subsequent release, you agree by submitting the changes that 43 those changes may be distributed with this exception intact. 44 45 If you write modifications of your own for SANE, it is your choice 46 whether to permit this exception to apply to your modifications. 47 If you do not wish that, delete this exception notice. 48 49 Transport layer for communication with HP5400/5470 scanner. 50 51 Implementation using sanei_usb 52 53 Additions to support bulk data transport. Added debugging info - 19/02/2003 Martijn 54 Changed to use sanei_usb instead of direct /dev/usb/scanner access - 15/04/2003 Henning 55*/ 56 57 58 59#define CMD_INITBULK1 0x0087 /* send 0x14 */ 60#define CMD_INITBULK2 0x0083 /* send 0x24 */ 61#define CMD_INITBULK3 0x0082 /* transfer length 0xf000 */ 62 63 64 65HP5400_SANE_STATIC void _UsbWriteControl (int fd, int iValue, int iIndex, void *pabData, int iSize); 66 67HP5400_SANE_STATIC void hp5400_command_write_noverify (int fd, int iValue, void *pabData, int iSize); 68 69HP5400_SANE_STATIC void _UsbReadControl (int fd, int iValue, int iIndex, void *pabData, int iSize); 70 71HP5400_SANE_STATIC int hp5400_open (const char *filename); 72 73HP5400_SANE_STATIC void hp5400_close (int iHandle); 74 75/* returns value > 0 if verify ok */ 76HP5400_SANE_STATIC int hp5400_command_verify (int iHandle, int iCmd); 77 78/* returns > 0 if command OK */ 79HP5400_SANE_STATIC int hp5400_command_read_noverify (int iHandle, int iCmd, int iLen, void *pbData); 80 81/* returns > 0 if command OK */ 82HP5400_SANE_STATIC int hp5400_command_read (int iHandle, int iCmd, int iLen, void *pbData); 83 84/* returns >0 if command OK */ 85HP5400_SANE_STATIC int hp5400_command_write (int iHandle, int iCmd, int iLen, void *pbData); 86 87#ifdef STANDALONE 88/* returns >0 if command OK */ 89HP5400_SANE_STATIC int hp5400_bulk_read (int iHandle, size_t len, int block, FILE * file); 90#endif 91 92/* returns >0 if command OK */ 93HP5400_SANE_STATIC int hp5400_bulk_read_block (int iHandle, int iCmd, void *cmd, int cmdlen, 94 void *buffer, int len); 95 96/* returns >0 if command OK */ 97HP5400_SANE_STATIC int hp5400_bulk_command_write (int iHandle, int iCmd, void *cmd, int cmdlen, 98 int datalen, int block, char *data); 99 100/** 101 ScannerIsOn 102 retrieve on/off status from scanner 103 @return 1 if is on 0 if is off -1 if is not reachable 104*/ 105HP5400_SANE_STATIC int hp5400_isOn (int iHandle); 106 107#endif 108