2 .\" Copyright (c) Michael Haardt (michael@cantor.informatik.rwth-aachen.de),
3 .\" Sun Jan 15 19:16:33 1995
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25 .\" Modified, Sun Feb 26 15:02:58 1995, faith@cs.unc.edu
27 .\" Japanese Version Copyright (c) 1996,1997,1998
28 .\" ISHIKAWA Mutsumi, TAKAHASHI Mutsuji
29 .\" all rights reserved.
30 .\" Translated Tue Feb 13 22:48:47 JST 1997
31 .\" by ISHIKAWA Mutsumi <ishikawa@linux.or.jp>
32 .\" and TAKAHASHI Mutsuji <muz@ilp.iijnet.or.jp>
34 .\" Japanese Version Last Modified Sun Jan 11 03:42:56 JST 1998
35 .\" by ISHIKAWA Mutsumi <ishikawa@linux.or.jp>
37 .\" WORD: printer ¥×¥ê¥ó¥¿¡¼
38 .\" WORD: parallel ¥Ñ¥é¥ì¥ë
39 .\" WORD: polling ¥Ý¡¼¥ê¥ó¥°
40 .\" WORD: interrupt ³ä¤ê¹þ¤ß
41 .\" WORD: dot matrix printer ¥É¥Ã¥È¥Þ¥È¥ê¥¯¥¹¥×¥ê¥ó¥¿¡¼
42 .\" WORD: default ¥Ç¥Õ¥©¥ë¥È
43 .\" WORD: modularize ¥â¥¸¥å¡¼¥ë²½
44 .\" WORD: driver ¥É¥é¥¤¥Ð
45 .\" WORD: buffer ¥Ð¥Ã¥Õ¥¡
47 .TH LP 4 1995-01-15 "Linux" "Linux Programmer's Manual"
49 lp \- ¥é¥¤¥ó¥×¥ê¥ó¥¿¡¼¥Ç¥Ð¥¤¥¹
51 .B #include <linux/lp.h>
53 \fBlp\fP[0\(en2] ¤Ï¥Ñ¥é¥ì¥ë¥×¥ê¥ó¥¿¡¼¤Î¤¿¤á¤Î¥¥ã¥é¥¯¥¿¥Ç¥Ð¥¤¥¹¤Ç¥á¥¸¥ã¡¼
54 ¥Ê¥ó¥Ð¡¼ 6 ¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼ 0\(en2 ¤ò»ý¤Ä¡£¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼¤Ï¡¢¥Ù¡¼¥¹
55 ¥¢¥É¥ì¥¹ 0x03bc, 0x0378, 0x0278 ¤Î¤½¤ì¤¾¤ì¤Î¥×¥ê¥ó¥¿¡¼¥Ý¡¼¥È¤ËÂбþ¤¹¤ë
56 Ä̾¤³¤Î¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë¤Ï¥â¡¼¥É 220 ¥ª¡¼¥Ê¡¼ root ¥°¥ë¡¼¥× lp ¤È¤Ê¤Ã
57 ¤Æ¤¤¤ë¡£¥×¥ê¥ó¥¿¡¼¥Ý¡¼¥È¤Ï¥Ý¡¼¥ê¥ó¥°(polling)¤Þ¤¿¤Ï³ä¤ê¹þ¤ß
58 (interrupts) ¤Î¤É¤Á¤é¤òÍѤ¤¤Æ¤âÍøÍѤǤ¤ë¡£³ä¤ê¹þ¤ß¤ÎÍøÍѤϡ¢¹âÉé²Ù¤¬
59 ͽÁÛ¤µ¤ì¤ë»þ¡¢Î㤨¤Ð¥ì¡¼¥¶¡¼¥×¥ê¥ó¥¿¡¼¤ò¥×¥ê¥ó¥¿¥Ý¡¼¥È¤ËÀܳ¤¹¤ë¾ì¹ç¤Ê
60 ¤É¤Ë¿ä¾©¤µ¤ì¤ë¡£ÉáÄ̤Υɥåȥޥȥꥯ¥¹¥×¥ê¥ó¥¿¡¼¤Ç¤Ï¡¢¥Ý¡¼¥ê¥ó¥°¤ÎÍøÍÑ
61 ¤ÇÄ̾ï¤Ï½½Ê¬¤Ç¤¢¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥Ý¡¼¥ê¥ó¥°¤òÍøÍѤ¹¤ë¡£
65 ¥³¡¼¥ë¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
66 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPTIME, int \fP\fIarg\fP\fB)\fP"
67 ¥×¥ê¥ó¥¿¡¼¤Î¥Ð¥Ã¥Õ¥¡( buffer ) ¤¬¤¤¤Ã¤Ñ¤¤¤Ë¤Ê¤Ã¤¿»þ¡¢¥É¥é¥¤¥Ð¤¬¥×¥ê¥ó¥¿¡¼
68 ¤òºÆ¥Á¥§¥Ã¥¯¤¹¤ë¤Þ¤Ç¤ËµÙ»ß¤¹¤ë»þ´Ö¤ò \fIarg\fP ¤È¤¹¤ë¡£¹â®¤Ê¥×¥ê¥ó¥¿¡¼
69 ¤Î»þ¤Ï¤³¤ì¤ò¸º¤é¤·¡¢ÃÙ¤¤¥×¥ê¥ó¥¿¡¼¤Î»þ¤Ë¤ÏÁý¤ä¤¹¡£Ã±°Ì¤Ï1ÉäÎ100ʬ¤Î1
70 ¤Ç¡¢¥Ç¥Õ¥©¥ë¥È¤Î2¤Ï0.02Éäˤ¢¤¿¤ë¡£¥Ý¡¼¥ê¥ó¥°¥É¥é¥¤¥Ð( polling driver
72 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPCHAR, int \fP\fIarg\fP\fB)\fP"
73 ¥Ý¡¼¥ê¥ó¥°¥É¥é¥¤¥Ð¤¬¥×¥ê¥ó¥¿¡¼¤Îʸ»ú¼õ¼è¤ê½àÈ÷¤¬¤Ç¤¤ë¤Î¤òÂÔ
74 ¤Ä¥Ó¥¸¡¼¥¦¥¨¥¤¥È(busy-wait)¤Î²ó¿ô¤ÎºÇÂçÃͤò \fIarg\fP¤È¤¹¤ë¡£
75 ¤â¤·°õºþ¤¬ÃÙ¤¹¤®¤ë»þ¤Ï¤³¤ì¤òÁý¤ä¤·¡¢¥·¥¹¥Æ¥à¤¬ÃÙ¤¯¤Ê¤ê¤¹¤®¤ë»þ¤Ë¤Ï
76 ¸º¤é¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ï 1000 ¤Ç¤¢¤ë¡£¥Ý¡¼¥ê¥ó¥°¥É¥é¥¤¥Ð¤Î¤ß¤Ë±Æ¶Á¤¹¤ë¡£
77 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPABORT, int \fP\fIarg\fP\fB)\fP"
78 ¤â¤·¡¢\fIarg\fP ¤¬ 0 ¤Ê¤é¡¢¥×¥ê¥ó¥¿¡¼¥É¥é¥¤¥Ð¤Ï¥¨¥é¡¼¤Ë¤Ä¤¤¤ÆºÆ»î¹Ô
79 ¤ò¹Ô¤¦¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤ÏÃæ»ß¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ï 0 ¤Ç¤¢¤ë¡£
80 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPABORTOPEN, int \fP\fIarg\fP\fB)\fP"
81 ¤â¤·¡¢\fIarg\fP ¤¬ 0 ¤Ê¤é
83 ¤Î·ë²Ì¤¬¥¨¥é¡¼¤Î¾ì¹ç¡¢Æ°ºî¤¬Ãæ»ß¤µ¤ì¤ë¡£¤½¤ì°Ê³°¤Ê¤é¥¨¥é¡¼¤Ï̵
84 »ë¤µ¤ì¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥¨¥é¡¼¤Ï̵»ë¤µ¤ì¤ë¡£
85 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPCAREFUL, int \fP\fIarg\fP\fB)\fP"
86 \fIarg\fP¤¬0¤Î¤È¤¤Ë¤Ï¡¢¤¹¤Ù¤Æ¤Î½ñ¤½Ð¤·¤Î»þ¤Ë¡¢»æÀڤ졢¥ª¥Õ¥é¥¤¥ó¡¢¥¨
87 ¥é¡¼¤Î¥·¥°¥Ê¥ë¤¬µ¶(false)¤Ç¤¢¤ë¤³¤È¤¬É¬ÍפȤµ¤ì¤ë¤¬¡¢0 °Ê³°¤Ê¤é¤³¤ì
88 ¤é¤Î¥·¥°¥Ê¥ë¤Ï̵»ë¤µ¤ì¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤â¤³¤ì¤é¤Î¥·¥°¥Ê¥ë¤Ï̵»ë¤µ¤ì¤ë¡£
89 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPWAIT, int \fP\fIarg\fP\fB)\fP"
90 ¥×¥ê¥ó¥¿¡¼¤¬Á÷¤é¤ì¤¿Ê¸»ú¤ò¼õ¤±¼è¤ë¤Î¤òÂԤĤ¿¤á¡¢¥É¥é¥¤¥Ð¤¬Ê¸»ú¤òÁ÷¤Ã
91 ¤Æ¤«¤é¥¹¥È¥í¡¼¥Ö(strobe)¤¹¤ë¤Þ¤Ç¤ÎÂÔ¤Á¤Î·«¤êÊÖ¤·¤Î²ó¿ô¤È¡¢¥¹¥È¥í¡¼¥Ö
92 ¤òºÆ¤Ó¥ª¥Õ¤Ë¤¹¤ë¤Þ¤Ç¤ÎÂÔ¤Á¤Î·«¤êÊÖ¤·¤Î²ó¿ô¤ò \fIarg\fP¤ËÀßÄê
93 ¤¹¤ë¡£»ÅÍͤˤè¤ì¤Ð¤³¤Î»þ´Ö¤Ï 0.5 ¥Þ¥¤¥¯¥íÉäȤ¹¤ë¤Ù¤¤À¤¬¡¢·Ð¸³¤Ë¤è¤ì¤Ð
94 ¤³¤Î¥³¡¼¥É¤Ë¤è¤Ã¤ÆÀ¸¤¸¤ëÃÙ¤ì¤Ç½½Ê¬¤Ç¤¢¤ë¡£¤½¤Î¤¿¤á¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï 0 ¤Ç
95 ¤¢¤ë¡£¤³¤ì¤Ï¡¢¥Ý¡¼¥ê¥ó¥°¤È³ä¤ê¹þ¤ß¥É¥é¥¤¥Ð¤ÎξÊý¤Ç»È¤ï¤ì¤ë¡£
96 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPSETIRQ, int \fP\fIarg\fP\fB)\fP"
99 ¤ò»È¤¦¤Ë¤Ï¡¢¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Î¸¢¸Â¤¬É¬ÍפǤ¢¤ë¡£¿·¤·¤¤IRQ¤ò¼¨¤¹
101 ¤ò°ú¿ô¤È¤·¤Æ¤È¤ë¡£¤Þ¤¿¡¢ÉûºîÍѤȤ·¤Æ¥×¥ê¥ó¥¿¡¼¤Ï¥ê¥»¥Ã¥È¤µ¤ì¤ë¡£
102 \fIarg\fP¤¬0¤Î»þ¤Þ¤¿¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ç¤Ï¡¢¥Ý¡¼¥ê¥ó¥°¥É¥é¥¤¥Ð¡¼¤¬»È¤ï
104 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPGETIRQ, int *\fP\fIarg\fP\fB)\fP"
105 ¸½ºß»È¤ï¤ì¤Æ¤¤¤ëIRQ¤ò\fIarg\fP¤Ë¤¤¤ì¤ë¡£
106 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPGETSTATUS, int *\fP\fIarg\fP\fB)\fP"
107 ¥¹¥Æ¡¼¥¿¥¹¥Ý¡¼¥È¤ÎÃͤò\fIarg\fP¤Ë¼ý¤á¤ë¡£³Æ¥Ó¥Ã¥È¤Ë¤Ï¼¡¤Î¤è¤¦¤Ê°ÕÌ£¤¬
111 LP_PBUSY ¥Ó¥¸¡¼¿®¹æ¤Îȿž¡¢¥Ï¥¤¤¬¥¢¥¯¥Æ¥£¥Ö
112 LP_PACK ¥¢¥¯¥Î¥ê¥Ã¥¸¿®¹æ¡¢¥í¡¼¤¬¥¢¥¯¥Æ¥£¥Ö
113 LP_POUTPA »æÀڤ쿮¹æ¡¢¥Ï¥¤¤¬¥¢¥¯¥Æ¥£¥Ö
114 LP_PSELECD ÁªÂò¿®¹æ¡¢¥Ï¥¤¤¬¥¢¥¯¥Æ¥£¥Ö
115 LP_PERRORP ¥¨¥é¡¼¿®¹æ¡¢¥í¡¼¤¬¥¢¥¯¥Æ¥£¥Ö
118 ¿®¹æ¤Î°ÕÌ£¤Ë¤Ä¤¤¤Æ¤Ï³Æ¼«¤Î¥×¥ê¥ó¥¿¡¼¤Î¥Þ¥Ë¥å¥¢¥ë¤ò»²¾È¤Î¤³¤È¡£¥×¥ê¥ó¥¿¡¼
119 ¤Ë¤è¤Ã¤Æ¤ÏµºÜ¤Î¤Ê¤¤¥Ó¥Ã¥È¤â¥»¥Ã¥È¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¤Î¤Ç¡¢Ãí°Õ¤Î¤³¤È¡£
120 .IP "\fBint ioctl(int \fP\fIfd\fP\fB, LPRESET)\fP"
121 ¥×¥ê¥ó¥¿¡¼¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£°ú¿ô¤Ï¤È¤é¤Ê¤¤¡£
125 .\" ¥×¥ê¥ó¥¿¡¼¥É¥é¥¤¥Ð¤Ï½é¤á¤Ï Jim Weigand ¤È Linus Torvalds ¤Ë¤è¤Ã¤Æ½ñ
126 .\" ¤«¤ì¡¢¤µ¤é¤Ë Michael K.\& Johnson ¤Ë¤è¤Ã¤Æ²þÎɤµ¤ì¤¿¡£³ä¤ê¹þ¤ß¤Î¥³¡¼¥É
127 .\" ¤Ï Nigel Gamble ¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤¿¡£¤Þ¤¿¡¢Alan Cox ¤Ï¥É¥é¥¤¥Ð¤ò¥â¥¸¥å¡¼
129 .\" LPCAREFUL, LPABORT, LPGETSTATUS ¤Ï Chris Metcalf ¤Ë¤è¤Ã¤Æ²Ã¤¨¤é¤ì¤¿¡£
137 .\" ÀÐÀî ËÓ <ishikawa@linux.or.jp>,
138 .\" ¹â¶¶ ËÓ»Ê <muz@ilp.iijnet.or.jp>
140 ¥«¡¼¥Í¥ë 2.1.x ¤Ç¤Ï¥Ñ¥é¥ì¥ë¥Ý¡¼¥È¤Þ¤ï¤ê¤¬ÂçÉý¤Ë½ñ¤Ä¾¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
141 ¤·¤¿¤¬¤Ã¤Æ¡¢¥«¡¼¥Í¥ë 2.1.x ¤Î¥Ñ¥é¥ì¥ë¥Ý¡¼¥È¥É¥é¥¤¥Ð¤Ë¤Ï¡¢
142 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¤ÎÆâÍƤϤ½¤Î¤Þ¤ÞŬÍѤǤ¤Þ¤»¤ó¡£