xref: /netbsd/sys/sys/scanio.h (revision be980594)
1 /*	$NetBSD: scanio.h,v 1.4 2016/01/22 23:42:14 dholland Exp $	*/
2 
3 /*
4  * Copyright (c) 1995 Kenneth Stailey.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *	This product includes software developed by Kenneth Stailey.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Definitions for PINT scanner drivers
34  */
35 
36 #ifndef _SYS_SCANIO_H_
37 #define _SYS_SCANIO_H_
38 
39 #include <sys/ioccom.h>
40 
41 /*
42  * XXX scancap make this sort of obsolete:
43  *
44  * Some comments about the values in the scan_io struct:
45  *
46  * All user-changeable values have minimum and maximum values for
47  * specific scanner types and are rejected by the special drivers if
48  * they are not in range. For values in the range, the driver selects
49  * the next physically possible setting for the particular scanner.
50  * So it is good practice to issue a SCIOCGET after a SCIOCSET to see
51  * what the driver has chosen.
52  *
53  * Brightness and contrast default to 100 (%) but scanners may support
54  * higher and/or lower values, though the maximum value is 255.
55  * velocity is the scan speed and defaults to 100 (%), only slower
56  * values may be possible.
57  */
58 
59 struct scan_io {
60 	unsigned long	scan_width;	 /* width in 1/1200ths of an inch */
61 	unsigned long	scan_height;	 /* height in 1/1200ths of an inch */
62 #ifdef SCAN_BC
63 # define scan_window_width scan_width
64 # define scan_window_length scan_height
65 #endif
66 	unsigned short scan_x_resolution;/* horizontal resolution in dots-per-inch */
67 	unsigned short scan_y_resolution;/* vertical resolution in dots-per-inch */
68 	unsigned long scan_x_origin;	/* horizontal coordinate of upper left corner */
69 	unsigned long scan_y_origin;	/* vertical coordinate of upper left corner */
70 	unsigned char scan_image_mode;	/* type of image data sent by scanner */
71 	unsigned char scan_brightness;	/* brightness control for those to can do it */
72 	unsigned char scan_contrast;	/* contrast control for those to can do it */
73 	unsigned char scan_quality;	/* speed of scan for instance */
74 #ifdef SCAN_BC
75 # define scan_velocity scan_quality
76 #endif
77 	unsigned long scan_window_size;	/* size of window in bytes (ro) */
78 	unsigned long scan_lines;	/* number of pixels per column (ro) */
79 	unsigned long scan_pixels_per_line;	/* number of pixels per line (ro) */
80 	unsigned short scan_bits_per_pixel;	/* number of bits per pixel (ro) */
81 	unsigned char scan_scanner_type;	/* type of scanner (ro) */
82 };
83 
84 /*
85  * defines for different commands
86  */
87 
88 #define SCIOCGET	_IOR('S', 1, struct scan_io) /* retrieve parameters */
89 #define SCIOCSET	_IOW('S', 2, struct scan_io) /* set parameters */
90 #define SCIOCRESTART	_IO('S', 3) /* restart scan */
91 #define SCIOC_USE_ADF	_IO('S', 4) /* use ADF as paper source for next scan */
92 				    /* even after close() */
93 #ifdef SCAN_BC
94 # define SCAN_GET	SCIOCGET
95 # define SCAN_SET	SCIOCSET
96 # define SCAN_REWIND	SCIOCRESTART
97 # define SCAN_USE_ADF	SCIOC_USE_ADF
98 #endif
99 
100 /*
101  * defines for scan_image_mode field
102  */
103 
104 #define SIM_BINARY_MONOCHROME	0
105 #define SIM_DITHERED_MONOCHROME	1
106 #define SIM_GRAYSCALE		2
107 #define SIM_COLOR		5
108 #define SIM_RED			103
109 #define SIM_GREEN		104
110 #define SIM_BLUE		105
111 
112 /*
113  * defines for different types of scanners & product names as comments
114  */
115 
116 #define RICOH_IS410	1	/* Ricoh IS-410 */
117 #define FUJITSU_M3096G	2	/* Fujitsu M3096G */
118 #ifdef SCAN_BC
119 # define FUJITSU	2	/* Fujitsu M3096G (deprecated) */
120 #endif
121 #define HP_SCANJET_IIC	3	/* HP ScanJet IIc */
122 #define RICOH_FS1	4	/* Ricoh FS1 */
123 #define SHARP_JX600	5	/* Sharp JX600 */
124 #define RICOH_IS50	6	/* Ricoh IS-50 */
125 #define IBM_2456	7	/* IBM 2456 */
126 #define UMAX_UC630	8	/* UMAX UC630 */
127 #define UMAX_UG630	9	/* UMAX UG630 */
128 #define MUSTEK_06000CX	10	/* Mustek MFS06000CX */
129 #define MUSTEK_12000CX	11	/* Mustek MFS12000CX */
130 #define EPSON_ES300C	12	/* epson es300c */
131 
132 #endif /* _SYS_SCANIO_H_ */
133