ASC(4)

NAME
asc - device driver for a GI1904-based hand scanner

SYNOPSIS
device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr

DESCRIPTION
The asc character device driver currently handles the GI1904-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.

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 pbm(5); thus the scans can easily processed by most graphics packages.

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 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 pbm(5) file using cat(1). One can obtain a similar effect by using dd(1) with the driver in raw mode.

IOCTLS
The ioctl(2) commands applicable to asc are listed below. The sasc(1) provides user-level access to these commands.

ASC_GRES
    (int) Get current resolution in dots per inch (dpi).

ASC_GWIDTH
    (int) Get current width of the bitmap in pixels.

ASC_SHEIGHT
    (int) Set the height of the bitmap in 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.

ASC_GHEIGHT
    (int) Get the current height of the bitmap.

ASC_SBLEN
    (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 ENOMEM error is returned if the requested length would exceed this limit.

ASC_GBLEN
    (int) Get the current buffer length in lines.

ASC_SBTIME
    (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 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.

ASC_GBTIME
    (int) Get the current buffer timeout.

All ioctl() requests that modify a parameter except 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 not reset when the device is opened or closed.

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 ioctl() requests.

The 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.

Note that the pbm(5) versus raw mode selection is done by the minor number, not by ioctl() requests. In raw mode, the selected height of the bitmap will have no effect.

FILES
/dev/asc0
    device node for raw output
/dev/asc0d
    device node for raw output, emitting debug messages if the ASCDEBUG option was given in the kernel configuration file
/dev/asc0p
    device node for output in pbm(5) file format
/dev/asc0pd
    device node for pbm(5) and debug mode

SEE ALSO
sasc(1) pbm(5)

BUGS
Ioctl support is not working yet.

AUTHOR
The asc driver was written by Luigi Rizzo.

HISTORY
The asc driver first appeared in FreeBSD 2.1.