-->

Previous | Table of Contents | Next

Page 1091

int ioctl(int fd, LPABORT, int arg) If arg is 0, the printer driver will retry on errors; otherwise, it will abort. The default is 0.
int ioctl(int fd, LPABORTOPEN, int arg) If arg is 0, open(2) will be aborted on error; otherwise, the error will be ignored. The default is to ignore it.
int ioctl(int fd, LPCAREFUL, int arg) If arg is 0, then the out-of-paper, offline, and error signals are required to be false on all writes; otherwise, they are ignored. The default is to ignore them.
int ioctl(int fd, LPWAIT, int arg) Sets the number of busy-wait iterations to wait before strobing the printer to accept a just-written character and the number of iterations to wait before turning the strobe off again to arg. The specification says this time should be 0.5 microseconds, but experience has shown the delay caused by the code is already enough. For that reason, the default value is 0. This is used for both the polling and the interrupt driver.
int ioctl(int fd, LPSETIRQ, int arg) This ioctl() requires superuser privileges. It takes an int containing the new IRQ as argument. As a side effect, the printer is reset. When arg is 0, the polling driver will be used, which is also default.
int ioctl(int fd, LPGETIRQ, int *arg) Stores the currently used IRQ in arg.
int ioctl(int fd, LPGETSTATUS, int *arg) Stores the value of the status port in arg. The bits have the following meaning:
LP_PBUSY Inverted busy input, active high
LP_PACK Unchanged acknowledge input, active low
LP_POUTPA Unchanged out-of-paper input, active high
LP_PSELECD Unchanged selected input, active high
LP_PERRORP Unchanged error input, active low
Refer to your printer manual for the meaning of the signals. Note that undocumented bits can also be set, depending on your printer.
int ioctl(int fd, LPRESET) Resets the printer. No argument is used.

FILES


/dev/lp*

AUTHORS

The printer driver was originally written by Jim Weigand and Linus Torvalds. It was further improved by Michael K. Johnson. The interrupt code was written by Nigel Gamble. Alan Cox modularized it. LPCAREFUL, LPABORT, LPGETSTATUS were added by Chris Metcalf.

SEE ALSO


mknod(1), chown(1), chmod(1), tunelp(8), lpcntl(8)

15 January 1995

mem, kmem, port

mem, kmem, port—System memory, kernel memory, and system ports

DESCRIPTION

mem is a character device file that is an image of the main memory of the computer. It can be used, for example, to examine (and even patch) the system.

Page 1092

Byte addresses in mem are interpreted as physical memory addresses. References to non-existent locations cause errors to be returned.

Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present.

It is typically created by


mknod -m 660 /dev/mem c 1 1

chown root.mem /dev/mem

The file kmem is the same as mem, except that the kernel virtual memory rather than physical memory is accessed.

It is typically created by


mknod -m 640 /dev/kmem c 1 2

chown root.mem /dev/kmem

port is similar to mem, but the IO ports are accessed.

It is typically created by


mknod -m 660 /dev/port c 1 4

chown root.mem /dev/port

FILES


/dev/mem

/dev/kmem

/dev/port

SEE ALSO


mknod(1), chown(1), ioperm(2)

Linux, 21 November 1992

mouse

mouse—Serial mouse interface.

CONFIG

Serial mice are connected to a serial RS232/V24 dialout line; see cua(4) for a description.

DESCRIPTION

The pinout of the usual 9 pin plug as used for serial mice is

Pin Name Used for
2 RX Data
3 TX -12 V, Imax = 10 mA
4 DTR +12 V, Imax = 10 mA
7 RTS +12 V, Imax = 10 mA
5 GND Ground

This is the specification; in fact, 9 V suffices with most mice.

The mouse driver can recognize a mouse by dropping RTS to low. About 14ms later, the mouse will send 0x4D on the data line. After a further 63ms, Microsoft-compatible mice will send 0x33. Other mice send different values.

Page 1093

The relative mouse movement is sent as dx (positive means right) and dy (positive means down). Various mice can operate at different speeds. To select speeds, cycle through the speeds 9600, 4800, 2400, and 1200 bits/sec, each time writing the two characters from the table below and waiting 0.1 seconds. The following table shows available speeds and the strings that select them:

Bits/sec String
9600 *q
4800 *p
2400 *o
1200 *n

The first byte of a data packet can be used to synchronization purposes.

MICROSOFT PROTOCOL

The Microsoft protocol uses 1 start bit, 7 data bits, no parity, and 1 stop bit at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte packets. The dx and dy movements are sent as two's-complement, lb (rb) is set when the left (right) button is pressed:

Byte d6 d5 d4 d3 d2 d1 d0
1 1 lb rb dy7 dy6 dx7 dx7
2 0 dx5 dx4 dx3 dx2 dx1 dx0
3 0 dy5 dy4 dy3 dy2 dy1 dy0

Original Microsoft mice have only two buttons. However, there are some three-button mice that also use the Microsoft protocol. Pressing the third button is reported by sending a packet with zero movement and no buttons pressed.

MOUSESYSTEMS PROTOCOL

The MouseSystems protocol uses 1 start bit, 8 data bits, no parity, and 2 stop bits at the speed of 1200 bits/sec. Data is sent to RxD in 5-byte packets. dx is sent as the sum of the two two's-complement values, dy is send as negated sum of the two two's-complement values. lb (mb, rb) is cleared when the left (middle, right) button is pressed:

Byte d7 d6 d5 d4 d3 d2 d1 d0
1 1 ? ? ? ? lb mb rb
2 0 dxa6 dxa5 dxa4 dxa3 dxa2 dxa1 dxa0
3 0 dxb6 dxb5 dxb4 dxb3 dxb2 dxb1 dxb0
4 0 dya6 dya5 dya4 dya3 dya2 dya1 dya0
5 0 dyb6 dyb5 dyb4 dyb3 dyb2 dyb1 dyb0

SUN PROTOCOL

The Sun protocol uses 1 start bit, 8 data bits, no parity, and 2 stop bits at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte packets. dx is sent as single two's-complement value, dy as negated two's-complement value. lb (mb, rb) is cleared when the left (middle, right) button is pressed:

Byte d7 d6 d5 d4 d3 d2 d1 d0
1 1 ? ? ? ? lb mb rb
2 0 dx6 dx5 dx4 dx3 dx2 dx1 dx0
3 0 dy6 dy5 dy4 dy3 dy2 dy1 dy0

Previous | Table of Contents | Next