• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 2001-2012 Stéphane Voltz <stef.dev@free.fr>
3    This file is part of the SANE package.
4 
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18    As a special exception, the authors of SANE give permission for
19    additional uses of the libraries contained in this release of SANE.
20 
21    The exception is that, if you link a SANE library with other files
22    to produce an executable, this does not by itself cause the
23    resulting executable to be covered by the GNU General Public
24    License.  Your use of that executable is in no way restricted on
25    account of linking the SANE library code into it.
26 
27    This exception does not, however, invalidate any other reasons why
28    the executable file might be covered by the GNU General Public
29    License.
30 
31    If you submit changes to SANE to the maintainers to be included in
32    a subsequent release, you agree by submitting the changes that
33    those changes may be distributed with this exception intact.
34 
35    If you write modifications of your own for SANE, it is your choice
36    whether to permit this exception to apply to your modifications.
37    If you do not wish that, delete this exception notice.
38 
39    This file implements a SANE backend for Umax PP flatbed scanners.  */
40 
41 #include <stdio.h>
42 #include "../include/sane/config.h"
43 
44 /*****************************************************************************/
45 /*                 set port to 'idle state' and get iopl                     */
46 /*****************************************************************************/
47 extern int sanei_umax_pp_initPort (int port, const char *name);
48 extern int sanei_umax_pp_initScanner (int recover);
49 extern int sanei_umax_pp_initTransport (int recover);
50 extern int sanei_umax_pp_endSession (void);
51 extern int sanei_umax_pp_initCancel (void);
52 extern int sanei_umax_pp_cancel (void);
53 extern int sanei_umax_pp_checkModel (void);
54 extern int sanei_umax_pp_getauto (void);
55 extern int sanei_umax_pp_UTA (void);
56 extern void sanei_umax_pp_setauto (int mode);
57 
58 #ifndef __GLOBALES__
59 
60 #define RGB_MODE	0x10
61 #define RGB12_MODE	0x11
62 #define BW_MODE		0x08
63 #define BW12_MODE       0x09
64 #define BW2_MODE        0x04
65 
66 
67 
68 #define __GLOBALES__
69 #endif /* __GLOBALES__ */
70 
71 
72 
73 #ifndef PRECISION_ON
74 #define PRECISION_ON	1
75 #define PRECISION_OFF	0
76 
77 #define LAMP_STATE	0x20
78 #define MOTOR_BIT	0x40
79 #define ASIC_BIT	0x100
80 
81 #define UMAX_PP_PARPORT_PS2      0x01
82 #define UMAX_PP_PARPORT_BYTE     0x02
83 #define UMAX_PP_PARPORT_EPP      0x04
84 #define UMAX_PP_PARPORT_ECP      0x08
85 
86 #endif
87 
88 extern int sanei_umax_pp_scan (int x, int y, int width, int height, int dpi,
89 			       int color, int gain, int offset);
90 extern int sanei_umax_pp_move (int distance, int precision,
91 			       unsigned char *buffer);
92 extern int sanei_umax_pp_setLamp (int on);
93 extern int sanei_umax_pp_completionWait (void);
94 extern int sanei_umax_pp_commitScan (void);
95 extern int sanei_umax_pp_park (void);
96 extern int sanei_umax_pp_parkWait (void);
97 extern int sanei_umax_pp_readBlock (long len, int window, int dpi, int last,
98 				    unsigned char *buffer);
99 extern int sanei_umax_pp_startScan (int x, int y, int width, int height,
100 				    int dpi, int color, int gain,
101 				    int offset, int *rbpp, int *rtw,
102 				    int *rth);
103 
104 extern void sanei_umax_pp_setport (int port);
105 extern int sanei_umax_pp_getport (void);
106 extern void sanei_umax_pp_setparport (int fd);
107 extern int sanei_umax_pp_getparport (void);
108 extern void sanei_umax_pp_setastra (int mod);
109 extern int sanei_umax_pp_getastra (void);
110 extern void sanei_umax_pp_setLeft (int mod);
111 extern int sanei_umax_pp_getLeft (void);
112 extern void sanei_umax_pp_setfull (int mod);
113 extern int sanei_umax_pp_getfull (void);
114 extern int sanei_umax_pp_scannerStatus (void);
115 extern int sanei_umax_pp_probeScanner (int recover);
116 
117 extern char **sanei_parport_find_port (void);
118 extern char **sanei_parport_find_device (void);
119 
120 extern int sanei_umax_pp_cmdSync (int cmd);
121 extern void sanei_umax_pp_gamma (int *red, int *green, int *blue);
122