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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/* sane - Scanner Access Now Easy.
Copyright (C) 2001-2012 Stéphane Voltz <stef.dev@free.fr>
This file is part of the SANE package.
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.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
This file implements a SANE backend for Umax PP flatbed scanners. */
#ifdef HAVE_LINUX_PPDEV_H
#include <linux/parport.h>
#include <linux/ppdev.h>
#include <sys/ioctl.h>
#endif
#include "umax_pp_low.h"
#ifndef _UMAX1220P_
#define _UMAX1220P_
#define UMAX1220P_OK 0
#define UMAX1220P_NOSCANNER 1
#define UMAX1220P_TRANSPORT_FAILED 2
#define UMAX1220P_PROBE_FAILED 3
#define UMAX1220P_SCANNER_FAILED 4
#define UMAX1220P_PARK_FAILED 5
#define UMAX1220P_START_FAILED 6
#define UMAX1220P_READ_FAILED 7
#define UMAX1220P_BUSY 8
/*
probes the port for an umax1220p scanner
initialize transport layer
probe scanner
if name is null, direct I/O is attempted to address given in port
else ppdev is tried using the given name as device
on success returns UMAX1220P_OK,
else one of the error above.
*/
extern int sanei_umax_pp_attach (int port, char *name);
/*
recognizes 1220P from 2000P
on success returns UMAX1220P_OK,
else one of the error above.
*/
extern int sanei_umax_pp_model (int port, int *model);
/*
if on=1 -> lights scanner lamp
if on=0 -> lights off scanner lamp
on success returns UMAX1220P_OK,
else one of the error above.
*/
extern int sanei_umax_pp_lamp (int on);
/*
probes the port for an umax1220p scanner
initialize transport layer
initialize scanner
on succes returns UMAX1220P_OK,
else one of the error above.
port: addr when doing direc I/O
name: ppdev character device name
*/
extern int sanei_umax_pp_open (int port, char *name);
/*
release any ressource acquired during open
since there may be only one scanner, no port parameter
*/
extern int sanei_umax_pp_close (void);
/*
stops any pending action, then parks the head
*/
extern int sanei_umax_pp_cancel (void);
/* starts scanning:
- find scanner origin
- does channel gain calibration if needed
- does calibration
- initialize scan operation
x, y, width and height are expressed in 600 dpi unit
dpi must be 75, 150, 300, 600 or 1200
color is true for color scan, false for gray-levels
gain value is 256*red_gain+16*green_gain+blue_gain
if gain is given (ie <> 0), auto gain will not be performed
returns UMAX1220P_OK on success, or one of the error above
if successful, rbpp holds bytes/pixel, rth the height and rtw
the width of scanned area expressed in pixels
*/
extern int sanei_umax_pp_start (int x, int y, int width, int height, int dpi,
int color, int autoset, int gain,
int offset, int *rbpp, int *rtw, int *rth);
/* reads one block of data from scanner
returns UMAX1220P_OK on success, or UMAX1220P_READ_FAILED on error
it also sets internal cancel flag on error
len if the length of the block needed
window if the width in pixels of the scanned area
dpi is the resolution, it is used to choose the best read method
last is true if it is the last block of the scan
buffer will hold the data read
*/
extern int sanei_umax_pp_read (long len, int window, int dpi, int last,
unsigned char *buffer);
/* get ASIC status from scanner
returns UMAX1220P_OK if scanner idle, or UMAX1220P_BUSY if
scanner's motor is on
*/
extern int sanei_umax_pp_status (void);
/* set auto calibration 0: no, else yes */
extern void sanei_umax_pp_setauto (int mode);
/* set umax astra model number */
extern void sanei_umax_pp_setastra (int val);
/* set gamma tables */
extern void sanei_umax_pp_gamma (int *red, int *green, int *blue);
/* sets coordinate of first usable left pixel */
extern int sanei_umax_pp_getLeft (void);
#endif
|