LBP(4)

NAME
lbp - Laser Beam Printer interface

DESCRIPTION
The lbp device is an interface which allows user programs to send data to a laser print engine connected to the system using the Acorn Laser Beam Printer interface podule. The driver accepts a page description in the form of a simple rectangular bitmap, and transmits it in a continuous stream to the printing hardware. Only one open(2) call on the device is permitted at a time: further calls before a corresponding close(2) call will return the error EBUSY.

Data is supplied by means of the write(2) system call. In addition, a number of commands are defined, for use with the ioctl(2) system call, giving access to various driver and hardware parameters.

The format of a bitmap is that successive bits in memory (starting at the least significant bit of a word) represent dot positions on the paper in left-to-right order, across the smaller dimension of standard paper sizes. Each line of dots on the paper occupies a multiple of 128 bits (16 bytes, 4 words), according to the page format, and lines follow each other contiguously in the bitmap, starting at the top of a page (when viewed in "portrait" orientation) and proceeding downwards. A clear (0) bit in the bitmap corresponds to a non-printing dot on the paper, (i.e. white or paper-colour) and a set (1) bit corresponds to a printing dot (i.e. black).

To send a bitmap to the printer, programs use the call:

	cc = write (fd, buff, size);

where fd is the file descriptor resulting from a successful open(2) call specifying /dev/lbp for write-only activities, buff is the address of the complete page buffer, which must be aligned on a 4-word address boundary in user space, and size is its length in bytes. The call will be rejected with EINVAL unless the size of the buffer matches that required by the current page format for the print engine. During the printing process, the complete buffer (of up to about 1 Mbyte) will be locked into physical memory. In consequence, system performance may be reduced during printing (data traffic to the printer also steals a noticeable amount of cpu power).

The available ioctl commands and parameters are accessed using the C statements:

	#include <dev/fbioctl.h>
	#include <dev/lbpioctl.h>

and are summarised here for convenience. Reference should be made to the header files for more details of usage.

The command LBPIO_STATUS_RQ is used to return basic status information about the interface and print engine. If the LBP_ST_PROBLEM bit is set in the status returned, then the command LBPIO_PROBLEM_RQ can be used to recover more detailed information from the print engine. In each case the status value is placed in an int.

Commands LBPIO_GET_SIZE_CODE and LBPIO_SET_SIZE_CODE are used to read and modify the current paper size code: the parameter is the address of a char, which for the latter call is updated to contain the original code value. Normally the paper size code must be matched to the actual size of paper in the printer's paper tray: the default size used by the driver is A4. Note that the set of possible paper sizes codes is defined as a non-contiguous group of integers. Specifying a number not in the set results in the error EINVAL. The calls FBIOGSUBTYPE and FBIOSSUBTYPE are similar to LBPIO_GET_SIZE_CODE and LBPIO_SET_SIZE_CODE respectively, the differences being that they take the address of an int (rather than a char) as their parameter, and that FBIOSSUBTYPE does not return the previous code value.

The generic bitmap-device commands FBIOGCURINFO and FBIOGINFO may be used to obtain detailed dimension information about the bitmap for the current paper size (or subtype) and a specified format, respectively. The command LBPIO_GET_SIZE_INFO returns a structure describing the paper format and layout; this is different from the format used by FBIOGCURINFO and FBIOGINFO.

Finally, the parameterless call LBPIO_RESET causes a hard reset of the printer and interface to be performed.

FILES
/dev/lbp

BUGS
The driver should actively check the user-specified paper size against the printer's account of which paper cartridge is fitted. There is currently no support for custom paper sizes.