1 /* sane - Scanner Access Now Easy.
2    Artec AS6E backend.
3    Copyright (C) 2000 Eugene S. Weiss
4    This file is part of the SANE package.
5 
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License as
8    published by the Free Software Foundation; either version 2 of the
9    License, or (at your option) any later version.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program.  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    This file implements a backend for the Artec AS6E by making a bridge
41    to the as6edriver program.  The as6edriver program can be found at
42    http://as6edriver.sourceforge.net .  */
43 
44 #ifndef as6e_h
45 #define as6e_h
46 
47 #include <sys/stat.h>
48 #include <sys/types.h>
49 #include "../include/sane/sane.h"
50 
51 
52 typedef enum
53 {
54 	OPT_NUM_OPTS = 0,
55 	OPT_MODE,
56 	OPT_RESOLUTION,
57 
58 	OPT_TL_X,			/* top-left x */
59 	OPT_TL_Y,			/* top-left y */
60 	OPT_BR_X,			/* bottom-right x */
61 	OPT_BR_Y,			/* bottom-right y */
62 
63 	OPT_BRIGHTNESS,
64 	OPT_CONTRAST,
65 
66 	/* must come last */
67 	NUM_OPTIONS
68   } AS6E_Option;
69 
70 typedef struct
71 {
72 	int color;
73 	int resolution;
74 	int startpos;
75 	int stoppos;
76 	int startline;
77 	int stopline;
78 	int ctloutpipe;
79 	int ctlinpipe;
80 	int datapipe;
81 } AS6E_Params;
82 
83 
84 typedef struct AS6E_Device
85 {
86 	struct AS6E_Device *next;
87 	SANE_Device sane;
88 } AS6E_Device;
89 
90 
91 
92 typedef struct AS6E_Scan
93 {
94 	struct AS6E_Scan *next;
95 	SANE_Option_Descriptor options_list[NUM_OPTIONS];
96 	Option_Value value[NUM_OPTIONS];
97 	SANE_Bool scanning;
98 	SANE_Bool cancelled;
99 	SANE_Parameters sane_params;
100 	AS6E_Params	as6e_params;
101 	pid_t child_pid;
102 	size_t bytes_to_read;
103 	SANE_Byte *scan_buffer;
104 	SANE_Byte *line_buffer;
105 	SANE_Word scan_buffer_count;
106 	SANE_Word image_counter;
107 } AS6E_Scan;
108 
109 
110 #ifndef PATH_MAX
111 #define PATH_MAX	1024
112 #endif
113 
114 #define AS6E_CONFIG_FILE "as6e.conf"
115 
116 #define READPIPE 0
117 #define WRITEPIPE 1
118 
119 
120 #define SCAN_BUF_SIZE 32768
121 
122 #endif /* as6e_h */
123