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

Linux 6.18.37 · ABI / testing

1-Wire thermometer sysfs ABI

1-Wire thermometer의 alarms, EEPROM, power source, resolution, temperature, bulk conversion, conversion time과 optional feature bitmask를 설명합니다.

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

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

1. 요약·해설

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

Per-device temperature and persistence controls

sysfs-driver-w1_therm:1-110

Alarm·resolution·temperature와 raw slave interface는 RAM/EEPROM persistence와 conversion resolution에 따라 동작이 달라집니다.

Bulk conversion timing and feature checks

sysfs-driver-w1_therm:111-190

Bus-wide bulk conversion, measured conversion timeout과 success/completion checks를 bitmask로 제어합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 What: /sys/bus/w1/devices/.../alarms
2 Date: May 2020
3 Contact: Akira Shimahara <akira215corp@gmail.com>
4 Description:
5 (RW) read or write TH and TL (Temperature High an Low) alarms.
6 Values shall be space separated and in the device range
7 (typical -55 degC to 125 degC), if not values will be trimmed
8 to device min/max capabilities. Values are integer as they are
9 stored in a 8bit register in the device. Lowest value is
10 automatically put to TL. Once set, alarms could be search at
11 master level, refer to Documentation/w1/w1-generic.rst for
12 detailed information
13 Users: any user space application which wants to communicate with
14 w1_term device
15
16
17 What: /sys/bus/w1/devices/.../eeprom_cmd
18 Date: May 2020
19 Contact: Akira Shimahara <akira215corp@gmail.com>
20 Description:
21 (WO) writing that file will either trigger a save of the
22 device data to its embedded EEPROM, either restore data
23 embedded in device EEPROM. Be aware that devices support
24 limited EEPROM writing cycles (typical 50k)
25
26 * 'save': save device RAM to EEPROM
27 * 'restore': restore EEPROM data in device RAM
28
29 Users: any user space application which wants to communicate with
30 w1_term device
31
32
33 What: /sys/bus/w1/devices/.../ext_power
34 Date: May 2020
35 Contact: Akira Shimahara <akira215corp@gmail.com>
36 Description:
37 (RO) return the power status by asking the device
38
39 * '0': device parasite powered
40 * '1': device externally powered
41 * '-xx': xx is kernel error when reading power status
42
43 Users: any user space application which wants to communicate with
44 w1_term device
45
46
47 What: /sys/bus/w1/devices/.../resolution
48 Date: May 2020
49 Contact: Akira Shimahara <akira215corp@gmail.com>
50 Description:
51 (RW) get or set the device resolution (on supported devices,
52 if not, this entry is not present). Note that the resolution
53 will be changed only in device RAM, so it will be cleared when
54 power is lost. Trigger a 'save' to EEPROM command to keep
55 values after power-on. Read or write are :
56
57 * '9..14': device resolution in bit
58 or resolution to set in bit
59 * '-xx': xx is kernel error when reading the resolution
60 * Anything else: do nothing
61
62 Some DS18B20 clones are fixed in 12-bit resolution, so the
63 actual resolution is read back from the chip and verified. Error
64 is reported if the results differ.
65 Users: any user space application which wants to communicate with
66 w1_term device
67
68
69 What: /sys/bus/w1/devices/.../temperature
70 Date: May 2020
71 Contact: Akira Shimahara <akira215corp@gmail.com>
72 Description:
73 (RO) return the temperature in 1/1000 degC.
74
75 * If a bulk read has been triggered, it will directly
76 return the temperature computed when the bulk read
77 occurred, if available. If not yet available, nothing
78 is returned (a debug kernel message is sent), you
79 should retry later on.
80 * If no bulk read has been triggered, it will trigger
81 a conversion and send the result. Note that the
82 conversion duration depend on the resolution (if
83 device support this feature). It takes 94ms in 9bits
84 resolution, 750ms for 12bits.
85
86 Users: any user space application which wants to communicate with
87 w1_term device
88
89
90 What: /sys/bus/w1/devices/.../w1_slave
91 Date: May 2020
92 Contact: Akira Shimahara <akira215corp@gmail.com>
93 Description:
94 (RW) return the temperature in 1/1000 degC.
95 *read*: return 2 lines with the hexa output data sent on the
96 bus, return the CRC check and temperature in 1/1000 degC
97 *write*:
98
99 * '0' : save the 2 or 3 bytes to the device EEPROM
100 (i.e. TH, TL and config register)
101 * '9..14' : set the device resolution in RAM
102 (if supported)
103 * Anything else: do nothing
104
105 refer to Documentation/w1/slaves/w1_therm.rst for detailed
106 information.
107 Users: any user space application which wants to communicate with
108 w1_term device
109
110
111 What: /sys/bus/w1/devices/w1_bus_masterXX/therm_bulk_read
112 Date: May 2020
113 Contact: Akira Shimahara <akira215corp@gmail.com>
114 Description:
115 (RW) trigger a bulk read conversion. read the status
116
117 *read*:
118 * '-1':
119 conversion in progress on at least 1 sensor
120 * '1' :
121 conversion complete but at least one sensor
122 value has not been read yet
123 * '0' :
124 no bulk operation. Reading temperature will
125 trigger a conversion on each device
126
127 *write*:
128 'trigger': trigger a bulk read on all supporting
129 devices on the bus
130
131 Note that if a bulk read is sent but one sensor is not read
132 immediately, the next access to temperature on this device
133 will return the temperature measured at the time of issue
134 of the bulk read command (not the current temperature).
135 Users: any user space application which wants to communicate with
136 w1_term device
137
138
139 What: /sys/bus/w1/devices/.../conv_time
140 Date: July 2020
141 Contact: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru>
142 Description:
143 (RW) Get, set, or measure a temperature conversion time. The
144 setting remains active until a resolution change. Then it is
145 reset to default (datasheet) conversion time for a new
146 resolution.
147
148 *read*:
149 Actual conversion time in milliseconds.
150
151 *write*:
152 * '0':
153 Set the default conversion time from the datasheet.
154 * '1':
155 Measure and set the conversion time. Make a single
156 temperature conversion, measure an actual value.
157 Increase it by 20% for temperature range. A new
158 conversion time can be obtained by reading this
159 same attribute.
160 * other positive value:
161 Set the conversion time in milliseconds.
162
163 Users: An application using the w1_term device
164
165
166 What: /sys/bus/w1/devices/.../features
167 Date: July 2020
168 Contact: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru>
169 Description:
170 (RW) Control optional driver settings.
171 Bit masks to read/write (bitwise OR):
172
173 == ============================================================
174 1 Enable check for conversion success. If byte 6 of
175 scratchpad memory is 0xC after conversion, and
176 temperature reads 85.00 (powerup value) or 127.94
177 (insufficient power) - return a conversion error.
178
179 2 Enable poll for conversion completion. Generate read cycles
180 after the conversion start and wait for 1's. In parasite
181 power mode this feature is not available.
182 == ============================================================
183
184 *read*:
185 Currently selected features.
186
187 *write*:
188 Select features.
189
190 Users: An application using the w1_term device
191

3. 한국어 전문 번역

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

1-Wire temperature alarm thresholds

1-16
항목한국어 전문 번역
What/sys/bus/w1/devices/.../alarms
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionTH와 TL(Temperature High/Low) alarms를 읽거나 씁니다. Values는 space-separated integers이고 device range, 일반적으로 -55°C~125°C 안이어야 합니다. 범위를 벗어난 값은 device minimum/maximum capability로 trimmed됩니다. Device의 8-bit register에 저장되므로 integer만 사용하며 두 값 중 낮은 값이 자동으로 TL에 배치됩니다. 설정 후 master level에서 alarms를 검색할 수 있고 자세한 내용은 `Documentation/w1/w1-generic.rst`를 참조합니다.
AccessRead-write
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire alarm assignment
RuleBehavior
InputTwo space-separated integers
Typical range-55°C to 125°C
Out-of-rangeTrim to device capability
OrderingLower value becomes TL

입력값 정규화와 TH/TL 배치 규칙입니다.

1-Wire thermometer EEPROM command

17-32
항목한국어 전문 번역
What/sys/bus/w1/devices/.../eeprom_cmd
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionDevice data를 embedded EEPROM에 저장하거나 EEPROM data를 device RAM으로 복원합니다. Devices의 EEPROM write cycles는 제한적이며 일반적으로 약 50,000회입니다. `save`는 device RAM을 EEPROM에 저장하고 `restore`는 EEPROM data를 device RAM으로 복원합니다.
AccessWrite-only
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire EEPROM commands
CommandOperation
saveDevice RAM to EEPROM
restoreEEPROM to device RAM

RAM과 EEPROM 사이의 data 이동 방향입니다.

1-Wire thermometer power source

33-46
항목한국어 전문 번역
What/sys/bus/w1/devices/.../ext_power
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionDevice에 질의해 power status를 반환합니다. `0`은 parasite-powered, `1`은 externally powered device이고 `-xx`는 power status를 읽는 동안 발생한 kernel error `xx`입니다.
AccessRead-only
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire power-status values
ValueMeaning
0Parasite powered
1Externally powered
-xxKernel error xx

Power source 또는 read error를 구분합니다.

1-Wire thermometer resolution

47-68
항목한국어 전문 번역
What/sys/bus/w1/devices/.../resolution
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
Description지원 device의 resolution을 읽거나 설정합니다. Unsupported device에는 이 entry가 없습니다. 변경은 device RAM에만 적용되므로 power loss 때 사라지며 power-on 후에도 유지하려면 EEPROM `save` command를 실행해야 합니다. `9..14`는 bit resolution을 읽거나 설정하고 `-xx`는 read 중 kernel error이며 다른 입력은 아무 동작도 하지 않습니다. 일부 DS18B20 clones는 12-bit로 fixed되어 있어 driver가 chip에서 actual resolution을 다시 읽어 검증하고 결과가 다르면 error를 보고합니다.
AccessRead-write
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire resolution values
ValueBehavior
9..14Read or set resolution in bits
-xxKernel read error xx
OtherNo operation
Power lossRAM setting is cleared unless saved

Accepted values, errors와 persistence입니다.

1-Wire thermometer temperature

69-89
항목한국어 전문 번역
What/sys/bus/w1/devices/.../temperature
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionTemperature를 1/1000°C 단위로 반환합니다. Bulk read가 triggered되었고 결과가 available하면 bulk read 시점의 계산된 temperature를 즉시 반환합니다. 아직 available하지 않으면 아무것도 반환하지 않고 debug kernel message를 보내므로 나중에 retry해야 합니다. Bulk read가 없으면 conversion을 trigger한 뒤 결과를 반환합니다. Conversion duration은 지원 device의 resolution에 따라 달라지며 9-bit에서 94ms, 12-bit에서 750ms입니다.
AccessRead-only
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire temperature-read paths
ConditionRead behavior
Bulk result availableReturn stored bulk temperature
Bulk result pendingReturn nothing; retry later
No bulk readTrigger conversion and return result
9-bit / 12-bitAbout 94ms / 750ms

Bulk conversion 유무에 따른 read behavior입니다.

1-Wire thermometer raw slave interface

90-110
항목한국어 전문 번역
What/sys/bus/w1/devices/.../w1_slave
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionRead하면 bus가 보낸 hexadecimal output data 두 줄, CRC check와 1/1000°C temperature를 반환합니다. Write value `0`은 2~3 bytes, 즉 TH, TL과 configuration register를 device EEPROM에 저장합니다. `9..14`는 지원되는 경우 device RAM의 resolution을 설정하고 다른 입력은 아무 동작도 하지 않습니다. 자세한 내용은 `Documentation/w1/slaves/w1_therm.rst`를 참조합니다.
AccessRead-write
Usersw1_term device와 통신하려는 모든 user-space application
w1_slave operations
OperationValue / result
ReadTwo hex lines, CRC, temperature
Write 0Save TH, TL and config to EEPROM
Write 9..14Set RAM resolution
Other writesNo operation

Raw read output과 write commands입니다.

1-Wire bus bulk temperature conversion

111-138
항목한국어 전문 번역
What/sys/bus/w1/devices/w1_bus_masterXX/therm_bulk_read
Date2020년 5월
ContactAkira Shimahara <akira215corp@gmail.com>
DescriptionBus의 지원 devices 전체에 bulk read conversion을 trigger하고 status를 읽습니다. Read `-1`은 sensor 하나 이상에서 conversion 진행 중, `1`은 conversion은 complete지만 하나 이상의 sensor value가 아직 read되지 않음, `0`은 bulk operation 없음이며 이후 temperature read가 device별 conversion을 trigger함을 뜻합니다. `trigger`를 쓰면 bulk read를 시작합니다. Bulk command 후 sensor를 즉시 읽지 않아도 다음 temperature access는 current temperature가 아니라 command issue 시점의 measurement를 반환합니다.
AccessRead-write
Usersw1_term device와 통신하려는 모든 user-space application
1-Wire bulk-read status
Value / commandMeaning
-1Conversion in progress
1Complete; at least one result unread
0No bulk operation
write triggerStart conversion on supported devices

Bulk conversion lifecycle과 write trigger입니다.

1-Wire temperature conversion time

139-165
항목한국어 전문 번역
What/sys/bus/w1/devices/.../conv_time
Date2020년 7월
ContactIvan Zaentsev <ivan.zaentsev@wirenboard.ru>
DescriptionTemperature conversion time을 읽고 설정하거나 측정합니다. Setting은 resolution 변경 전까지 유지되고 resolution이 바뀌면 새 resolution의 datasheet default로 reset됩니다. Read는 actual conversion time을 milliseconds로 반환합니다. Write `0`은 datasheet default를 설정합니다. Write `1`은 conversion 한 번의 actual time을 측정하고 temperature range를 위해 20% 늘려 설정하며 같은 attribute를 읽어 새 값을 확인할 수 있습니다. 다른 positive value는 milliseconds 단위 conversion time을 직접 설정합니다.
AccessRead-write
Usersw1_term device를 사용하는 application
Conversion-time writes
Written valueBehavior
0Use datasheet default
1Measure once and add 20%
Other positive valueSet milliseconds directly
Resolution changeReset to new default

Special values와 direct millisecond setting입니다.

1-Wire thermometer optional features

166-190
항목한국어 전문 번역
What/sys/bus/w1/devices/.../features
Date2020년 7월
ContactIvan Zaentsev <ivan.zaentsev@wirenboard.ru>
DescriptionOptional driver settings를 bitmask로 제어하며 bits는 bitwise OR할 수 있습니다. Bit 1은 conversion 성공 검사를 enable합니다. Conversion 후 scratchpad byte 6이 `0xC`이고 temperature가 85.00(power-up value) 또는 127.94(insufficient power)이면 conversion error를 반환합니다. Bit 2는 conversion-completion polling을 enable해 conversion start 후 read cycles를 생성하고 1을 기다리며 parasite-power mode에서는 사용할 수 없습니다. Read는 selected features를 반환하고 write는 features를 선택합니다.
AccessRead-write
Usersw1_term device를 사용하는 application
1-Wire feature bitmask
BitFeatureRestriction / error condition
1Check conversion successbyte 6 = 0xC and 85.00 or 127.94
2Poll conversion completionUnavailable with parasite power

Bitwise-OR 가능한 optional driver settings입니다.