← Documents Documentation/ABI/testing/sysfs-tty GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

TTY와 serial port sysfs ABI

Active console 조회, serial_core의 TIOCGSERIAL 속성, RX FIFO trigger와 kernel console 연결을 위한 TTY sysfs ABI를 정의합니다.

Source pathDocumentation/ABI/testing/sysfs-tty
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Active console 조회

sysfs-tty:1-20

Console 목록과 현재 virtual console을 노출하고 poll()로 console 전환을 감지합니다.

TIOCGSERIAL 속성

sysfs-tty:21-144

UART clock, type, line, I/O address, IRQ, flags, FIFO, close timing과 I/O memory 배치를 sysfs에서 읽을 수 있게 합니다.

RX trigger와 console 연결

sysfs-tty:145-166

RX FIFO interrupt trigger를 device가 지원하는 값으로 조정하고 serial device의 kernel console 연결을 제어합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: /sys/class/tty/console/active
2 Date: Nov 2010
3 Contact: Kay Sievers <[email protected]>
4 Description:
5 Shows the list of currently configured
6 console devices, like 'tty1 ttyS0'.
7 The last entry in the file is the active
8 device connected to /dev/console.
9 The file supports poll() to detect virtual
10 console switches.
11
12 What: /sys/class/tty/tty<x>/active
13 Date: Nov 2010
14 Contact: Kay Sievers <[email protected]>
15 Description:
16 Shows the currently active virtual console
17 device, like 'tty1'.
18 The file supports poll() to detect virtual
19 console switches.
20
21 What: /sys/class/tty/ttyS<x>/uartclk
22 Date: Sep 2012
23 Contact: Tomas Hlavacek <[email protected]>
24 Description:
25 Shows the current uartclk value associated with the
26 UART port in serial_core, that is bound to TTY like ttyS0.
27 uartclk = 16 * baud_base
28
29 These sysfs values expose the TIOCGSERIAL interface via
30 sysfs rather than via ioctls.
31
32 What: /sys/class/tty/ttyS<x>/type
33 Date: October 2012
34 Contact: Alan Cox <[email protected]>
35 Description:
36 Shows the current tty type for this port.
37
38 These sysfs values expose the TIOCGSERIAL interface via
39 sysfs rather than via ioctls.
40
41 What: /sys/class/tty/ttyS<x>/line
42 Date: October 2012
43 Contact: Alan Cox <[email protected]>
44 Description:
45 Shows the current tty line number for this port.
46
47 These sysfs values expose the TIOCGSERIAL interface via
48 sysfs rather than via ioctls.
49
50 What: /sys/class/tty/ttyS<x>/port
51 Date: October 2012
52 Contact: Alan Cox <[email protected]>
53 Description:
54 Shows the current tty port I/O address for this port.
55
56 These sysfs values expose the TIOCGSERIAL interface via
57 sysfs rather than via ioctls.
58
59 What: /sys/class/tty/ttyS<x>/irq
60 Date: October 2012
61 Contact: Alan Cox <[email protected]>
62 Description:
63 Shows the current primary interrupt for this port.
64
65 These sysfs values expose the TIOCGSERIAL interface via
66 sysfs rather than via ioctls.
67
68 What: /sys/class/tty/ttyS<x>/flags
69 Date: October 2012
70 Contact: Alan Cox <[email protected]>
71 Description:
72 Show the tty port status flags for this port.
73
74 These sysfs values expose the TIOCGSERIAL interface via
75 sysfs rather than via ioctls.
76
77 What: /sys/class/tty/ttyS<x>/xmit_fifo_size
78 Date: October 2012
79 Contact: Alan Cox <[email protected]>
80 Description:
81 Show the transmit FIFO size for this port.
82
83 These sysfs values expose the TIOCGSERIAL interface via
84 sysfs rather than via ioctls.
85
86 What: /sys/class/tty/ttyS<x>/close_delay
87 Date: October 2012
88 Contact: Alan Cox <[email protected]>
89 Description:
90 Show the closing delay time for this port in centiseconds.
91
92 These sysfs values expose the TIOCGSERIAL interface via
93 sysfs rather than via ioctls.
94
95 What: /sys/class/tty/ttyS<x>/closing_wait
96 Date: October 2012
97 Contact: Alan Cox <[email protected]>
98 Description:
99 Show the close wait time for this port in centiseconds.
100
101 Waiting forever is represented as 0. If waiting on close is
102 disabled then the value is 65535.
103
104 These sysfs values expose the TIOCGSERIAL interface via
105 sysfs rather than via ioctls.
106
107 What: /sys/class/tty/ttyS<x>/custom_divisor
108 Date: October 2012
109 Contact: Alan Cox <[email protected]>
110 Description:
111 Show the custom divisor if any that is set on this port.
112
113 These sysfs values expose the TIOCGSERIAL interface via
114 sysfs rather than via ioctls.
115
116 What: /sys/class/tty/ttyS<x>/io_type
117 Date: October 2012
118 Contact: Alan Cox <[email protected]>
119 Description:
120 Show the I/O type that is to be used with the iomem base
121 address.
122
123 These sysfs values expose the TIOCGSERIAL interface via
124 sysfs rather than via ioctls.
125
126 What: /sys/class/tty/ttyS<x>/iomem_base
127 Date: October 2012
128 Contact: Alan Cox <[email protected]>
129 Description:
130 The I/O memory base for this port.
131
132 These sysfs values expose the TIOCGSERIAL interface via
133 sysfs rather than via ioctls.
134
135 What: /sys/class/tty/ttyS<x>/iomem_reg_shift
136 Date: October 2012
137 Contact: Alan Cox <[email protected]>
138 Description:
139 Show the register shift indicating the spacing to be used
140 for accesses on this iomem address.
141
142 These sysfs values expose the TIOCGSERIAL interface via
143 sysfs rather than via ioctls.
144
145 What: /sys/class/tty/ttyS<x>/rx_trig_bytes
146 Date: May 2014
147 Contact: Yoshihiro YUNOMAE <[email protected]>
148 Description:
149 Shows current RX interrupt trigger bytes or sets the
150 user specified value to change it for the FIFO buffer.
151 Users can show or set this value regardless of opening the
152 serial device file or not.
153
154 The RX trigger can be set one of four kinds of values for UART
155 serials. When users input a meaning less value to this I/F,
156 the RX trigger is changed to the nearest lower value for the
157 device specification. For example, when user sets 7bytes on
158 16550A, which has 1/4/8/14 bytes trigger, the RX trigger is
159 automatically changed to 4 bytes.
160
161 What: /sys/class/tty/ttyS<x>/console
162 Date: February 2020
163 Contact: Andy Shevchenko <[email protected]>
164 Description:
165 Allows user to detach or attach back the given device as
166 kernel console. It shows and accepts a boolean variable.
167

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

TTY와 serial port sysfs ABI: active

1-11
항목한국어 전문 번역
What/sys/class/tty/console/active
Date2010년 11월
ContactKay Sievers <[email protected]>
Description`/sys/class/tty/console/active`는 현재 구성된 console device 목록을 `tty1 ttyS0` 같은 형식으로 표시합니다. 파일의 마지막 항목은 `/dev/console`에 연결된 active device입니다. 이 파일은 virtual console 전환을 감지할 수 있도록 `poll()`을 지원합니다.
Console active device 해석
Read /sys/class/tty/console/activeParse space-separated console devicesUse final entry as /dev/console active device
poll() waitsVirtual console switchReader receives readiness notification

목록의 순서와 마지막 항목이 `/dev/console` 연결을 나타냅니다.

TTY와 serial port sysfs ABI: active

12-20
항목한국어 전문 번역
What/sys/class/tty/tty<x>/active
Date2010년 11월
ContactKay Sievers <[email protected]>
Description`/sys/class/tty/tty<x>/active`는 `tty1`처럼 현재 active 상태인 virtual console device를 표시합니다. 이 파일은 virtual console 전환을 감지할 수 있도록 `poll()`을 지원합니다.

TTY와 serial port sysfs ABI: uartclk

21-31
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/uartclk
Date2012년 9월
ContactTomas Hlavacek <[email protected]>
Description`/sys/class/tty/ttyS<x>/uartclk`는 serial_core에서 해당 UART port와 연결되고 `ttyS0` 같은 TTY에 bind된 현재 `uartclk` 값을 표시합니다. 관계식은 `uartclk = 16 * baud_base`입니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.
Serial core 기본 속성
AttributeValue
uartclkUART clock; uartclk = 16 * baud_base
typeTTY type
lineTTY line number
portPort I/O address
irqPrimary interrupt
flagsPort status flags
xmit_fifo_sizeTransmit FIFO size

TIOCGSERIAL information을 sysfs attribute별로 정리합니다.

TTY와 serial port sysfs ABI: type

32-40
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/type
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/type`은 이 port의 현재 TTY type을 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: line

41-49
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/line
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/line`은 이 port의 현재 TTY line number를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: port

50-58
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/port
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/port`는 이 TTY port의 현재 I/O address를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: irq

59-67
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/irq
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/irq`는 이 port의 현재 primary interrupt를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: flags

68-76
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/flags
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/flags`는 이 TTY port의 status flags를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: xmit fifo size

77-85
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/xmit_fifo_size
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/xmit_fifo_size`는 이 port의 transmit FIFO size를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: close delay

86-94
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/close_delay
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/close_delay`는 이 port의 close delay time을 centiseconds 단위로 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.
Serial close timing
Attribute/valueMeaning
close_delayClosing delay in centiseconds
closing_waitClose wait in centiseconds
closing_wait = 0Wait forever
closing_wait = 65535Waiting on close is disabled

Close delay와 wait의 단위 및 special values를 구분합니다.

TTY와 serial port sysfs ABI: closing wait

95-106
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/closing_wait
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/closing_wait`는 이 port가 close될 때 기다리는 시간을 centiseconds 단위로 표시합니다. 무한 대기는 `0`, close 대기를 disable한 상태는 `65535`로 나타냅니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: custom divisor

107-115
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/custom_divisor
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/custom_divisor`는 이 port에 설정된 custom divisor가 있으면 그 값을 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: io type

116-125
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/io_type
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/io_type`은 I/O memory base address와 함께 사용할 I/O type을 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.
I/O memory 배치 속성
AttributeMeaning
io_typeI/O type used with iomem base
iomem_baseI/O memory base address
iomem_reg_shiftRegister spacing shift

Memory-mapped serial register 접근에 필요한 값을 묶어 봅니다.

TTY와 serial port sysfs ABI: iomem base

126-134
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/iomem_base
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/iomem_base`는 이 port의 I/O memory base를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: iomem reg shift

135-144
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/iomem_reg_shift
Date2012년 10월
ContactAlan Cox <[email protected]>
Description`/sys/class/tty/ttyS<x>/iomem_reg_shift`는 이 I/O memory address에 접근할 때 사용할 register 간격을 나타내는 register shift를 표시합니다. 이 sysfs 값은 ioctl 대신 sysfs를 통해 `TIOCGSERIAL` interface를 노출합니다.

TTY와 serial port sysfs ABI: rx trig bytes

145-160
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/rx_trig_bytes
Date2014년 5월
ContactYoshihiro YUNOMAE <[email protected]>
Description`/sys/class/tty/ttyS<x>/rx_trig_bytes`는 현재 RX interrupt trigger byte 수를 표시하거나 FIFO buffer의 trigger를 바꾸기 위해 사용자가 지정한 값을 설정합니다. Serial device file의 open 여부와 관계없이 이 값을 조회하거나 설정할 수 있습니다. UART serial의 RX trigger는 네 가지 값 가운데 하나로 설정할 수 있습니다. 사용자가 이 interface에 의미 없는 값을 쓰면 device specification에서 그 값보다 작거나 같은 가장 가까운 trigger 값으로 자동 조정됩니다. 예를 들어 trigger가 `1/4/8/14` byte인 16550A에 `7` byte를 설정하면 RX trigger는 자동으로 `4` byte가 됩니다.
RX trigger 값 조정
Write requested RX trigger bytesCompare with four supported UART valuesSelect nearest supported value <= request
16550A values: 1 / 4 / 8 / 14Request: 7 bytesApplied: 4 bytes

지원하지 않는 입력은 device가 지원하는 가장 가까운 lower value로 내립니다.

TTY와 serial port sysfs ABI: console

161-166
항목한국어 전문 번역
What/sys/class/tty/ttyS<x>/console
Date2020년 2월
ContactAndy Shevchenko <[email protected]>
Description`/sys/class/tty/ttyS<x>/console`은 지정한 device를 kernel console에서 detach하거나 다시 attach할 수 있게 합니다. Boolean 값을 표시하고 입력으로도 받습니다.
Kernel console 연결 제어
OperationResult
ReadShow whether device is a kernel console
Write falseDetach device from kernel console
Write trueAttach device back as kernel console

Boolean attribute의 read/write 의미입니다.