1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*
Copyright (C) 2001 Bertrik Sikken (bertrik@zonnet.nl)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$Id$
*/
/*
Provides a simple interface to read and write data from the scanner,
without any knowledge whether it's a parallel or USB scanner
*/
#ifndef _NIASH_XFER_H_
#define _NIASH_XFER_H_
#include <stdio.h> /* for FILE * */
/* register codes for the USB - IEEE1284 bridge */
#define USB_SETUP 0x82
#define EPP_ADDR 0x83
#define EPP_DATA_READ 0x84
#define EPP_DATA_WRITE 0x85
#define SPP_STATUS 0x86
#define SPP_CONTROL 0x87
#define SPP_DATA 0x88
typedef enum
{
eUnknownModel = 0,
eHp3300c,
eHp3400c,
eHp4300c,
eAgfaTouch
} EScannerModel;
typedef struct
{
char *pszVendor;
char *pszName;
int iVendor;
int iProduct;
EScannerModel eModel;
} TScannerModel;
typedef int (TFnReportDevice) (TScannerModel * pModel,
const char *pszDeviceName);
/* Creates our own DBG definitions, externs are define in main.c*/
#ifndef WITH_NIASH
#define DBG fprintf
extern FILE *DBG_MSG;
extern FILE *DBG_ERR;
extern FILE *BG_ASSERT;
#endif /* NO WITH_NIASH */
/* we do not make data prototypes */
#ifndef WITH_NIASH
/* list of supported models, the actual list is in niash_xfer.c */
extern TScannerModel ScannerModels[];
#endif /* NO WITH_NIASH */
STATIC void NiashXferInit (TFnReportDevice * pfnReport);
STATIC int NiashXferOpen (const char *pszName, EScannerModel * peModel);
STATIC void NiashXferClose (int iXferHandle);
STATIC void NiashWriteReg (int iXferHandle, unsigned char bReg,
unsigned char bData);
STATIC void NiashReadReg (int iXferHandle, unsigned char bReg,
unsigned char *pbData);
STATIC void NiashWriteBulk (int iXferHandle, unsigned char *pabBuf,
int iSize);
STATIC void NiashReadBulk (int iXferHandle, unsigned char *pabBuf, int iSize);
STATIC void NiashWakeup (int iXferHandle);
STATIC SANE_Bool MatchUsbDevice (int iVendor, int iProduct,
TScannerModel ** ppeModel);
#endif /* _NIASH_XFER_H_ */
|