Next Previous Contents

16. ¦b lpd ¤U¨Ï¥Î§Ç¦C¦¡¦Lªí¾÷

16.1 ³]©w printcap

Lpd ¦b /etc/printcap ¤¤´£¨Ñ¤F¤­­Ó¥i¥H³]©wªºÄÝ©Ê, Åý§A¥Î¨Ó±±¨î¦Lªí¾÷©Ò³s±µªº§Ç¦C°ðªº³]©w. ¾\Ū printcap ªº½u¤W¤âÉm(man page), ¨Ã½Ðª`·N br#, fc#, xc#, fs# ©M xs# ªº·N¸q. ¨ä¤¤³Ì«áªº¥|­ÓÄݩʬO¦ì¤¸²Õ¦C(bitmap), ¥Î¨Ó¥Nªí¸Ó§Ç¦C°ðªº¨Ï¥Î³]©w. ¦Ó br# ÄÝ©Ê¥u¬O³æ¯ÂªºÀj²v(baud rate), ¨Ò¦p `br#9600'.

­n±N stty ªº³]©wÂà´«¬° printcap ªººX¼Ð³]©w(flag settings) «D±`²³æ. °²¨Ï§A»Ý­n, ½Ð²{¦b´N¬Ý¬Ý stty ªº½u¤W¤âÉm.

§A¥i¥H¥Î stty ¨Ó³]©w¦Lªí¾÷°ð, ¥H«KÅý§A¥i¥H±N¤@­ÓÀÉ®× cat ¨ì¸Ó°ð, ¨Ã¥B¨Ï¥¦¥¿½T¦a¦C¦L¥X¨Ó. ³o¨à¬O§Úªº¦Lªí°ð `stty -a' ªºµ²ªG:

dina:/usr/users/andy/work/lpd/lpd# stty -a < /dev/ttyS2
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr 
-igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke
³oùØ©M¶}¾÷®É§Ç¦C°ðªì©l¤Æªº³]©w¤è¦¡°ß¤@ªº¤£¦P¦b©ó -clocal, -crtscts, ©M ixon. ®Ú¾Ú§Aªº¦Lªí¾÷ªº¬y¶q±±¨î(flow control) ¤è¦¡, §Aªº³]©w¥i¯à·|¤£¦P.

¹ê»Ú¤W, §A¬O¥H¯S®íªº¤è¦¡¨Ï¥Î stty. ¦]¬° stty ªº¹ï¶H¬O³s±µ¦b¼Ð·Ç¿é¤J(standard input) ¤Wªº²×ºÝ¾÷¸Ë¸m, §A¬O¥Î¦p¤W©Ò¥Üªº `<' ¦r¤¸, ¨Ó¨Ï±o stty ³B²z©Ò«ü©wªº§Ç¦C°ð.

¥u­n§Aªº stty ³]©w¥¿½T, `cat file > /dev/ttyS2' (¦b§Úªº¨Ò¤l¤¤) ´N¥i¥H±NÀÉ®×°e¨ì¦Lªí¾÷¤F, ½Ð¬Ý¤@¤U³o­ÓÀÉ®× /usr/src/linux/include/asm-i386/termbits.h, ¥¦¥]§t¤F«Ü¦hªº #define ©M¤@¨Ç struct (§A¥i¯à·Q§â¥¦ cat ¨ì¦Lªí¾÷ (¤w¸g¥i¥H¥Î¤F§a, ¹ï¤£¹ï?), µM«á§â¥¦·í°µ«K±ø¯È). §ä¨ì¤U­±³o¤@¦æ:

/* c_cflag bit meaning */
#define CBAUD   0000017
³o¤@¬q¦C¥X¤F fc# ©M fs# ¦ì¤¸ªº·N¸q. §A·|µo²{¨ì¨º¨àªº¦WºÙ (¦bÀj²v¤§«á) ©M stty ¿é¥Xªºµ²ªG¨ä¤¤¤@¦æ¬Û²Å¦X, §Ú¤£¬O»¡³o·|«Ü®e©ö¶Ü?

§ä¨ì¨º¨Ç¦b§Aªº stty µ²ªG¤¤«e­±¦³´î¸¹(-) ªº³]©w, §â¨º¨Ç¼Æ¦r(¬O¤K¶i¦ìªº) ¥[°_¨Ó. ³o¥Nªí¤F§A­n²M°£ªº¦ì¤¸, µ²ªG´N¬O§Aªº fc# ¯à¤O. ·íµM§A¤]¥i¥Hª½±µ¥Î `fc#0177777' (§Ú´N¬O), ¦]¬°§A±N·|¦b²M°£¤§«á¥ß¨è³]©w³o¨Ç¦ì¤¸.

²{¦b¹ï¨º¨Ç¦b stty ªºµ²ªG¤¤¨S¦³´î¸¹¦b«e­±ªº³]©w (¦b³o¤@¬q¤¤©Ò¦C¥Xªº) °µ¦P¼Ëªº¨Æ. ¦b§Úªº¨Ò¤l¤¤, ­«­nªº³]©w¦³ CS8 (0000060), HUPCL (0002000), ©M CREAD (0000200). ¦P®É¤]§ä¨ì¥Nªí§AªºÀj²vªººX¼Ð (§Úªº¬O 0000015), §â¥¦­Ì²Î²Î¥[°_¨Ó, ¦b§Úªº¨Ò¤l¤¤·|±o¨ì 0002275. ³o´N¬O§Aªº fs# ¯à¤O (`fs#02275' ¦b§Úªº¨Ò¤l¤¤¹B§@ªº«Ü¦n).

¥Î¦P¼Ëªº¤è¦¡°w¹ï³o­Ó¼ÐÃDÀÉ(include file) ¤¤ªº¤U¤@¬q, "c_lflag bits", °µ³]©w©M²M°£ªº°Ê§@. ¦b§Úªº¨Ò¤l¤¤§Ú¤£»Ý­n³]©w¥ô¦óªF¦è, ©Ò¥H¥u­n¥Î `xc#0157777' ©M `xs#0' ´N¥i¥H¤F.

16.2 ·|±¼¦rªºÂ«¬§Ç¦C¦¡¦Lªí¾÷

Jon Luckey «ü¥X¦³¨Ç¨ã¦³ ten-cent §Ç¦C¤¶­±©M¤p½w½Ä°ÏªºÂ«¬ªº§Ç¦C¦¡¦Lªí¾÷, ·í¨Ï¥Î¬y¶q±±¨î®É, »¡°±¤î´N¬O¯uªºªí¥Ü°±¤î. ¥Lµo²{¥Î setserial °±¥Î¥Lªº Linux ¾÷¾¹ªº 16550 §Ç¦C°ðªº FIFO ¥\¯à«á, ±¼¦rªº°ÝÃD´N¸Ñ¨M¤F (¦pªG§A­n³o¼Ë°µ, ¦ü¥G¥u­n±N uart ªººØÃþ«ü©w¬° 8250 ´N¥i¥H¤F).


Next Previous Contents