LBP(4) — UNIX Programmer’s Manual
NAME
lbp − NEWS laser beam printer interface
SYNOPSIS
lb0 at iop addr ffedd0 intr 108
/dev/lbp
#include <newsiop/lbp.h>
DESCRIPTION
lbp provides the interface to NEWS laser beam printer (NWP-533/537, NWB-240A/241A). Operations will be done through open(2), ioctl(2), write(2) and close(2) system call to /dev/lbp.
Following list shows a basic control sequence.
1. Open the device.
2. Send frame data to the device.
2.1 Wait for the device to be ready.
2.2 Seek to the top of the device file.
2.3 Send data to the device.
2.4 Start printing.
2.5 Repeat 2.1 to 2.4 until all the frame is sent.
3. Close the device.
3.1 Wait for the device to be ready to be closed.
3.2 Close the device.
To control the device, following header files are needed to be included.
#include <stdio.h>
#include <sys/ioctl.h>
#include <newsiop/lbp.h>
Open the Device
How to open the device is described below.
int lbp /∗ LBP file descriptor ∗/
lbp = open("/dev/lbp",O_WRONLY);
If the device file is opened successfully, file descriptor is returned, −1 otherwise.
Send data to the device
How to send data to the device is described below.
1. Wait for the device to be ready. (Not necessary on 1st page)
ioctl(lbp, LBIOCSTOP; 0);
Zero is returned by ioctl system call if terminated normally, −1 is returned in the case of some error. If error occurred, you should execute the operation 4 again, after eliminating the cause of the error.
2. Seek to the top of the device file. (Not necessary on 1st page)
lseek(lbp,0,0);
3. Send data to the device file.
Using write system call, the data can be written out to the buffer in the device.
#define FRAME_SIZE (3136∗4516/8)
char frame[FRAME_SIZE];
write(lbp, frame, FRAME_SIZE);
The number of the written bytes is returned by write system call if finished normally, −1 is returned if some error occurred. In the case of error, following data is set to the global variable "errono".
EIO
Frame memory in the laser beam printer interface is not accessible.
EFAULT
Specified data in write system call is not accessible.
The length of output data should be less than or equal to the size of the frame buffer. (i.e. NWP-533: 1770272 bytes (3136 x 4516/8) NWP-537: 2732800 bytes (3904 x 5600)).
4. Start printing
The output data written to the frame buffer is now actually send to the laser beam printer.
ioctl(lbp, LBIOCSTART, 0);
Zero is returned by ioctl system call if finished normally, −1 is returned if some error was detected. If error occurred, you need to execute it after eliminating the cause of the error.
IOCTL
LBIOCRESET
Initialize the laser beam printer interface.
ioctl(lbp, LBIOCRESET, 0);
LBIOCSTART
Start printing.
ioctl(lbp, LBIOCSTART, 0);
LBIOCSTOP
Wait for the termination of current print job.
ioctl(lbp, LBIOCSTOP);
LBIOCSTATUS
Get the status of the laser beam printer.
ioctl(lbp, LBIOCSTATUS, status);
Structure of the status is as follows;
struct lbp_stat {
unsigned char stat[6];
};
The effective status bytes is first four bytes. MSB (bit 7) of each byte is always Zero and LSB (bit 0) is used for parity bit (odd parity). For their details, see DIAGNOSTICS.
LBIOCHAND
This request switches to manual supply mode.
ioctl(lbp, LBIOCHAND, 0);
LBIOCCASSETTE
This request switches to cassette supply mode. This mode is default.
ioctl(lbp, LBIOCCASSETE, 0);
LBIOCGETSIZE
Get vertical/horizontal size of the printable regions by dot unit.
ioctl(lbp, LBIOCGETSIZE, size);
Structure is as follows;
struct lbp_size {
int lbp_x;
int lbp_y;
};
Close the device
At the last of the printing job, you should wait for the device to be ready and then the device should be closed.
ioctl(lbp, LBIOCSTOP; 0);
close(lbp);
Format of the output data
The NEWS’s laser beam printer (NWP-533/537, NWB-240A/241A) has a resolution of 400 pixel/inch and the maximum printable region of 4516 pixel (vertical) by 3136 pixel (horizontal) with NWP-533 and 3904 pixel (vertical) by 5600 pixel (horizontal) with NWP-537.
The raster data are placed from the top to the bottom in the frame data. The byte data are placed from left to right in a raster. In each byte, MSB (bit 7) corresponds to the most left pixel in the image.
FILES
/dev/lbplaser beam printer buffer
DIAGNOSTICS
BYTE 0 (Basic status)
bit 4 ST0_REPRINT_REQ
Reprint request. (a paper jammed or so)
bit 3 ST0_WAIT
The fixer is not heated up enough.
bit 2 ST0_PAUSE
The fixer and the main motor stopped.
bit 1 ST0_CALL
The operator call or the service call occurs.
BYTE 1 (Operator call status)
bit 6 ST1_NO_CARTRIGE
Cartridge is not equipped or not set properly.
bit 4 ST1_NO_PAPER
Out of paper.
bit 3 ST1_JAM
A paper is jamming.
bit 2 ST1_OPEN
The top door of the printer is open.
bit 1 ST1_TEST
Now, test printing.
BYTE 2 (Service call status)
bit 6 ST2_FIXER
Fixer got some trouble.
bit 5 ST2_SCANNER
Printer scanner is out of order.
bit 4 ST2_MOTOR
Motor of the printer scanner does not work.
BYTE 3 (Number of the sheets to be requested to resend)
bit 6 − 1
This byte indicates the number of sheets of paper to be requested to resend. The actual number is got using NREPRINT(x) macro.
BYTE 4 (paper size status)
bit 6 − 1
This byte indicates the size of the attached casset. The actual code is got using PAPERSIZE(x) macro. When the code is 00H, there is no casset. When 01H, there is the A4 size casset. When 05H, there is the B4 size casset.
BYTE 5 (S status)
bit 6 ST5_NO_TONER
The warning of no toner.
FILES
/dev/lbp
NEWS-OSRelease 3.3