📄 1091-1093.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:Special Files:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=04 //-->
<!-- PAGES=1063-1102 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="1089-1090.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1094-1096.html">Next</A></CENTER></P>
<A NAME="PAGENUM-1091"><P>Page 1091</P></A>
<TABLE>
<TR><TD>
int ioctl(int fd, LPABORT, int arg)
</TD><TD>
If arg is 0, the printer driver will retry on errors; otherwise, it will
abort. The default is 0.
</TD></TR><TR><TD>
int ioctl(int fd, LPABORTOPEN, int arg)
</TD><TD>
If arg is 0, open(2) will be aborted on error; otherwise, the error will
be ignored. The default is to ignore it.
</TD></TR><TR><TD>
int ioctl(int fd, LPCAREFUL, int arg)
</TD><TD>
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.
</TD></TR><TR><TD>
int ioctl(int fd, LPWAIT, int arg)
</TD><TD>
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.
</TD></TR><TR><TD>
int ioctl(int fd, LPSETIRQ, int arg)
</TD><TD>
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.
</TD></TR><TR><TD>
int ioctl(int fd, LPGETIRQ, int *arg)
</TD><TD>
Stores the currently used IRQ in
arg.
</TD></TR><TR><TD>
int ioctl(int fd, LPGETSTATUS, int *arg)
</TD><TD>
Stores the value of the status port in
arg. The bits have the following meaning:
</TD></TR><TR><TD>
LP_PBUSY
</TD><TD>
Inverted busy input, active high
</TD></TR><TR><TD>
LP_PACK
</TD><TD>
Unchanged acknowledge input, active low
</TD></TR><TR><TD>
LP_POUTPA
</TD><TD>
Unchanged out-of-paper input, active high
</TD></TR><TR><TD>
LP_PSELECD
</TD><TD>
Unchanged selected input, active high
</TD></TR><TR><TD>
LP_PERRORP
</TD><TD>
Unchanged error input, active low
</TD></TR><TR><TD>
</TD><TD>
Refer to your printer manual for the meaning of the signals. Note
that undocumented bits can also be set, depending on your printer.
</TD></TR><TR><TD>
int ioctl(int fd, LPRESET)
</TD><TD>
Resets the printer. No argument is used.
</TD></TR></TABLE>
<P><B>
FILES
</B></P>
<!-- CODE SNIP //-->
<PRE>
/dev/lp*
</PRE>
<!-- END CODE SNIP //-->
<P><B>
AUTHORS
</B></P>
<P>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.
</P>
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
mknod(1), chown(1), chmod(1), tunelp(8), lpcntl(8)
</PRE>
<!-- END CODE SNIP //-->
<P>15 January 1995
</P>
<H3><A NAME="ch04_ 10">
mem, kmem, port
</A></H3>
<P>mem, kmem, port—System memory, kernel memory, and system ports
</P>
<P><B>
DESCRIPTION
</B></P>
<P>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.
</P>
<A NAME="PAGENUM-1092"><P>Page 1092</P></A>
<P>Byte addresses in mem are interpreted as physical memory addresses. References to non-existent locations cause errors to
be returned.
</P>
<P>Examining and patching is likely to lead to unexpected results when read-only or write-only bits are present.
</P>
<P>It is typically created by
</P>
<!-- CODE SNIP //-->
<PRE>
mknod -m 660 /dev/mem c 1 1
chown root.mem /dev/mem
</PRE>
<!-- END CODE SNIP //-->
<P>The file kmem is the same as mem, except that the kernel virtual memory rather than physical memory is accessed.
</P>
<P>It is typically created by
</P>
<!-- CODE SNIP //-->
<PRE>
mknod -m 640 /dev/kmem c 1 2
chown root.mem /dev/kmem
</PRE>
<!-- END CODE SNIP //-->
<P>port is similar to mem, but the IO ports are accessed.
</P>
<P>It is typically created by
</P>
<!-- CODE SNIP //-->
<PRE>
mknod -m 660 /dev/port c 1 4
chown root.mem /dev/port
</PRE>
<!-- END CODE SNIP //-->
<P><B>
FILES
</B></P>
<!-- CODE SNIP //-->
<PRE>
/dev/mem
/dev/kmem
/dev/port
</PRE>
<!-- END CODE SNIP //-->
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
mknod(1), chown(1), ioperm(2)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux, 21 November 1992
</P>
<H3><A NAME="ch04_ 11">
mouse
</A></H3>
<P>mouse—Serial mouse interface.
</P>
<P><B>
CONFIG
</B></P>
<P>Serial mice are connected to a serial RS232/V24 dialout line; see
cua(4) for a description.
</P>
<P><B>
DESCRIPTION
</B></P>
<P>The pinout of the usual 9 pin plug as used for serial mice is
</P>
<TABLE>
<TR><TD>
Pin
</TD><TD>
Name
</TD><TD>
Used for
</TD></TR><TR><TD>
2
</TD><TD>
RX
</TD><TD>
Data
</TD></TR><TR><TD>
3
</TD><TD>
TX
</TD><TD>
-12 V, Imax = 10 mA
</TD></TR><TR><TD>
4
</TD><TD>
DTR
</TD><TD>
+12 V, Imax = 10 mA
</TD></TR><TR><TD>
7
</TD><TD>
RTS
</TD><TD>
+12 V, Imax = 10 mA
</TD></TR><TR><TD>
5
</TD><TD>
GND
</TD><TD>
Ground
</TD></TR></TABLE>
<P>This is the specification; in fact, 9 V suffices with most mice.
</P>
<P>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.
</P>
<A NAME="PAGENUM-1093"><P>Page 1093</P></A>
<P>
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:
</P>
<TABLE>
<TR><TD>
Bits/sec
</TD><TD>
String
</TD></TR><TR><TD>
9600
</TD><TD>
*q
</TD></TR><TR><TD>
4800
</TD><TD>
*p
</TD></TR><TR><TD>
2400
</TD><TD>
*o
</TD></TR><TR><TD>
1200
</TD><TD>
*n
</TD></TR></TABLE>
<P>The first byte of a data packet can be used to synchronization purposes.
</P>
<P><B>
MICROSOFT PROTOCOL
</B></P>
<P>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:
</P>
<TABLE>
<TR><TD>
Byte
</TD><TD>
d6
</TD><TD>
d5
</TD><TD>
d4
</TD><TD>
d3
</TD><TD>
d2
</TD><TD>
d1
</TD><TD>
d0
</TD></TR><TR><TD>
1
</TD><TD>
1
</TD><TD>
lb
</TD><TD>
rb
</TD><TD>
dy7
</TD><TD>
dy6
</TD><TD>
dx7
</TD><TD>
dx7
</TD></TR><TR><TD>
2
</TD><TD>
0
</TD><TD>
dx5
</TD><TD>
dx4
</TD><TD>
dx3
</TD><TD>
dx2
</TD><TD>
dx1
</TD><TD>
dx0
</TD></TR><TR><TD>
3
</TD><TD>
0
</TD><TD>
dy5
</TD><TD>
dy4
</TD><TD>
dy3
</TD><TD>
dy2
</TD><TD>
dy1
</TD><TD>
dy0
</TD></TR></TABLE>
<P>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.
</P>
<P><B>
MOUSESYSTEMS PROTOCOL
</B></P>
<P>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:
</P>
<TABLE>
<TR><TD>
Byte
</TD><TD>
d7
</TD><TD>
d6
</TD><TD>
d5
</TD><TD>
d4
</TD><TD>
d3
</TD><TD>
d2
</TD><TD>
d1
</TD><TD>
d0
</TD></TR><TR><TD>
1
</TD><TD>
1
</TD><TD>
?
</TD><TD>
?
</TD><TD>
?
</TD><TD>
?
</TD><TD>
lb
</TD><TD>
mb
</TD><TD>
rb
</TD></TR><TR><TD>
2
</TD><TD>
0
</TD><TD>
dxa6
</TD><TD>
dxa5
</TD><TD>
dxa4
</TD><TD>
dxa3
</TD><TD>
dxa2
</TD><TD>
dxa1
</TD><TD>
dxa0
</TD></TR><TR><TD>
3
</TD><TD>
0
</TD><TD>
dxb6
</TD><TD>
dxb5
</TD><TD>
dxb4
</TD><TD>
dxb3
</TD><TD>
dxb2
</TD><TD>
dxb1
</TD><TD>
dxb0
</TD></TR><TR><TD>
4
</TD><TD>
0
</TD><TD>
dya6
</TD><TD>
dya5
</TD><TD>
dya4
</TD><TD>
dya3
</TD><TD>
dya2
</TD><TD>
dya1
</TD><TD>
dya0
</TD></TR><TR><TD>
5
</TD><TD>
0
</TD><TD>
dyb6
</TD><TD>
dyb5
</TD><TD>
dyb4
</TD><TD>
dyb3
</TD><TD>
dyb2
</TD><TD>
dyb1
</TD><TD>
dyb0
</TD></TR></TABLE>
<P><B>
SUN PROTOCOL
</B></P>
<P>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:
</P>
<TABLE>
<TR><TD>
Byte
</TD><TD>
d7
</TD><TD>
d6
</TD><TD>
d5
</TD><TD>
d4
</TD><TD>
d3
</TD><TD>
d2
</TD><TD>
d1
</TD><TD>
d0
</TD></TR><TR><TD>
1
</TD><TD>
1
</TD><TD>
?
</TD><TD>
?
</TD><TD>
?
</TD><TD>
?
</TD><TD>
lb
</TD><TD>
mb
</TD><TD>
rb
</TD></TR><TR><TD>
2
</TD><TD>
0
</TD><TD>
dx6
</TD><TD>
dx5
</TD><TD>
dx4
</TD><TD>
dx3
</TD><TD>
dx2
</TD><TD>
dx1
</TD><TD>
dx0
</TD></TR><TR><TD>
3
</TD><TD>
0
</TD><TD>
dy6
</TD><TD>
dy5
</TD><TD>
dy4
</TD><TD>
dy3
</TD><TD>
dy2
</TD><TD>
dy1
</TD><TD>
dy0
</TD></TR></TABLE>
<P><CENTER>
<a href="1089-1090.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1094-1096.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -