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
|
.\" asc(4) - manual page for the scanner device driver `asc'
.\"
.\"
.\" Copyright (c) 1995 Gunther Schadow, Luigi Rizzo. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgements:
.\" This product includes software developed by Gunther Schadow.
.\" This product includes software developed by Luigi Rizzo.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.Dd January 19, 1995
.Dt ASC 4 i386
.Os FreeBSD
.Sh NAME
.Nm asc
.Nd device driver for a GI1904-based hand scanner
.Sh SYNOPSIS
.Cd "device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr"
.Sh DESCRIPTION
The
.Nm
character device driver currently handles the
.Tn GI1904 Ns -based
hand scanner (e.g. Trust Amiscan Grey).
It uses DMA and interrupts.
Up to 50 lines of scanned input data are buffered in the driver.
.Pp
The device can operate at four different resolutions: 100, 200, 300
and 400 dots per inch. It produces a simple bitmap with the most
significant bit at the left side. The driver can optionally output
the simple portable bitmap file format
.Xr pbm 5 ;
thus the scans can easily processed by most graphics packages.
.Pp
The width of the output bitmap is fixed as given by the
resolution value. However, the height of the bitmap must be
supplied when in
.Xr pbm 5
mode, since the driver must know at what time the
`end-of-file' shall be reached. The default is to produce a
square image; i.e., height equals width.
With this feature one is able to
directly copy the scanner output into a
.Xr pbm 5
file using
.Xr cat 1 .
One can obtain a similar effect by using
.Xr dd 1
with the driver
in raw mode.
.Sh IOCTLS
The
.Xr ioctl 2
commands applicable to
.Nm
are listed below.
The
.Xr sasc 1
provides user-level access to these commands.
.Bl -tag -width "ASC_GHEIGHT"
.It Dv ASC_GRES
.Pq Li int
Get current resolution in dots per inch (dpi).
.It Dv ASC_GWIDTH
.Pq Li int
Get current width of the bitmap in pixels.
.It Dv ASC_SHEIGHT
.Pq Li int
Set the height of the bitmap in
.Xr pbm 5
mode. This is actually
a limit on the amount of lines scannable after the first read
operation. When the limit is reached, read will return 0. However, the
device is turned off only when the last open file descriptor is closed.
.It Dv ASC_GHEIGHT
.Pq Li int
Get the current height of the bitmap.
.It Dv ASC_SBLEN
.Pq Li int
Set the length of the buffer used internally to do the DMA transfer.
The buffer length is supplied in lines of the bitmap. Since the buffer
size limit is (currently) 0x3000 bytes, the maximum number of lines
allowed will vary with the width of each line. An
.Er ENOMEM
error is returned if the requested length would exceed this limit.
.It Dv ASC_GBLEN
.Pq Li int
Get the current buffer length in lines.
.It Dv ASC_SBTIME
.Pq Li int
Set the timeout for the completion of reading one buffer. Since a
handy scanner is a human/computer interface timeout values are usually
higher than those of a flat scanner; the default is 15 seconds. After
timeout is reached the read operation will fail with
.Er EBUSY .
Note that
the timeout timer starts anew for each buffer to be read and thus
reducing it does not result in faster scans for longer images.
.It Dv ASC_GBTIME
.Pq Li int
Get the current buffer timeout.
.El
.Pp
All
.Fn ioctl
requests that modify a parameter except
.Dv ASC_SBTIME
do not have an effect on an ongoing scan process. The user must close
the device and open it again for the new selections to take effect.
Consequently, the selections are
.Em not
reset when the device is opened or closed.
.Pp
Similarily, requests that read a value do not report the value that is
used for the ongoing scan process. The values needed during the scan
process are saved when it starts and thus are not accessed by
.Fn ioctl
requests.
.Pp
The
.Dv ASC_SBTIME
value does, however, have an immediate effect on the ongoing scan.
Thus the timeout can, for example, be set to a large value until the
user starts scanning, and then set to a small value to react
(nearly) immediately when the user stops.
.Pp
Note that the
.Xr pbm 5
versus raw mode selection is done by the
minor number, not by
.Fn ioctl
requests. In raw mode, the selected
height of the bitmap will have no effect.
.Sh FILES
.Bl -tag -width /dev/asc0pd -compact
.It Pa /dev/asc0
device node for raw output
.It Pa /dev/asc0d
device node for raw output, emitting debug messages if the
.Dv ASCDEBUG
option was given in the kernel configuration file
.It Pa /dev/asc0p
device node for output in
.Xr pbm 5
file format
.It Pa /dev/asc0pd
device node for
.Xr pbm 5
and debug mode
.PB
.\"
.\" .Sh DIAGNOSTICS
.\"
.Sh SEE ALSO
.Xr sasc 1
.Xr pbm 5
.Sh BUGS
Ioctl support is not working yet.
.Sh AUTHOR
The
.Nm
driver was written by
Luigi Rizzo.
.Sh HISTORY
The
.Nm
driver first appeared in
.Tn FreeBSD
2.1.
|