← Documents Documentation/hwmon/sysfs-interface.rst GitHub 원문 ↗

Linux 6.18.37 · Hardware Monitoring

Naming and data format standards for sysfs files

hwmon sysfs의 표준 이름, 단위, 접근 권한, 센서별 속성, 경보와 안전한 쓰기값 해석 규칙을 정의합니다.

Source pathDocumentation/hwmon/sysfs-interface.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

sysfs-interface.rst:1-656

이 문서는 칩 독립적인 사용자 공간 도구가 hwmon 드라이버를 일관되게 사용할 수 있도록 sysfs 파일의 이름과 데이터 형식을 정의합니다. 전압·팬·PWM·온도·전류·전력·에너지·습도·경보·침입 감지·평균 샘플 속성을 망라하며, 숫자 문자열을 드라이버가 안전하게 받아들이는 규칙까지 설명합니다.

핵심은 드라이버가 하드웨어 기능을 그대로 표준 ABI로 노출하고, 보드별 변환과 레이블 지정은 libsensors 설정이 맡는다는 점입니다. 경보는 드라이버의 임의 비교 결과가 아니라 칩이 직접 기록한 상태이며, 쓰기값은 `long`으로 변환한 뒤 연속값은 범위에 고정하고 비연속값은 잘못된 경우 `-EINVAL`로 거부합니다.

문서 개요
항목
SourceDocumentation/hwmon/sysfs-interface.rst
분량656 source lines
파일 형식`<type><number>_<item>`, 파일당 값 하나
주요 종류`in`, `fan`, `pwm`, `temp`, `curr`, `power`, `energy`, `humidity`
접근 원칙모두 읽기 가능, 쓰기는 권한 사용자만
쓰기 오류연속값은 clamp, 비연속값은 `-EINVAL`

원문 범위와 주요 규칙을 요약합니다.

hwmon 표준 사용 흐름
드라이버가 칩 기능 탐지지원 기능만 표준 sysfs 속성으로 생성칩이 측정값·경보 제공libsensors가 변환·레이블·숨김 적용응용 프로그램이 일관된 센서 데이터 사용

하드웨어에서 사용자 응용 프로그램까지의 전체 경로입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 Naming and data format standards for sysfs files
2 ================================================
3
4 The libsensors library offers an interface to the raw sensors data
5 through the sysfs interface. Since lm-sensors 3.0.0, libsensors is
6 completely chip-independent. It assumes that all the kernel drivers
7 implement the standard sysfs interface described in this document.
8 This makes adding or updating support for any given chip very easy, as
9 libsensors, and applications using it, do not need to be modified.
10 This is a major improvement compared to lm-sensors 2.
11
12 Note that motherboards vary widely in the connections to sensor chips.
13 There is no standard that ensures, for example, that the second
14 temperature sensor is connected to the CPU, or that the second fan is on
15 the CPU. Also, some values reported by the chips need some computation
16 before they make full sense. For example, most chips can only measure
17 voltages between 0 and +4V. Other voltages are scaled back into that
18 range using external resistors. Since the values of these resistors
19 can change from motherboard to motherboard, the conversions cannot be
20 hard coded into the driver and have to be done in user space.
21
22 For this reason, even if we aim at a chip-independent libsensors, it will
23 still require a configuration file (e.g. /etc/sensors.conf) for proper
24 values conversion, labeling of inputs and hiding of unused inputs.
25
26 An alternative method that some programs use is to access the sysfs
27 files directly. This document briefly describes the standards that the
28 drivers follow, so that an application program can scan for entries and
29 access this data in a simple and consistent way. That said, such programs
30 will have to implement conversion, labeling and hiding of inputs. For
31 this reason, it is still not recommended to bypass the library.
32
33 Each chip gets its own directory in the sysfs /sys/devices tree. To
34 find all sensor chips, it is easier to follow the device symlinks from
35 `/sys/class/hwmon/hwmon*`.
36
37 Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes
38 in the "physical" device directory. Since lm-sensors 3.0.1, attributes found
39 in the hwmon "class" device directory are also supported. Complex drivers
40 (e.g. drivers for multifunction chips) may want to use this possibility to
41 avoid namespace pollution. The only drawback will be that older versions of
42 libsensors won't support the driver in question.
43
44 All sysfs values are fixed point numbers.
45
46 There is only one value per file, unlike the older /proc specification.
47 The common scheme for files naming is: <type><number>_<item>. Usual
48 types for sensor chips are "in" (voltage), "temp" (temperature) and
49 "fan" (fan). Usual items are "input" (measured value), "max" (high
50 threshold, "min" (low threshold). Numbering usually starts from 1,
51 except for voltages which start from 0 (because most data sheets use
52 this). A number is always used for elements that can be present more
53 than once, even if there is a single element of the given type on the
54 specific chip. Other files do not refer to a specific element, so
55 they have a simple name, and no number.
56
57 Alarms are direct indications read from the chips. The drivers do NOT
58 make comparisons of readings to thresholds. This allows violations
59 between readings to be caught and alarmed. The exact definition of an
60 alarm (for example, whether a threshold must be met or must be exceeded
61 to cause an alarm) is chip-dependent.
62
63 When setting values of hwmon sysfs attributes, the string representation of
64 the desired value must be written, note that strings which are not a number
65 are interpreted as 0! For more on how written strings are interpreted see the
66 "sysfs attribute writes interpretation" section at the end of this file.
67
68 Attribute access
69 ----------------
70
71 Hardware monitoring sysfs attributes are displayed by unrestricted userspace
72 applications. For this reason, all standard ABI attributes shall be world
73 readable. Writeable standard ABI attributes shall be writeable only for
74 privileged users.
75
76 -------------------------------------------------------------------------
77
78 ======= ===========================================
79 `[0-*]` denotes any positive number starting from 0
80 `[1-*]` denotes any positive number starting from 1
81 RO read only value
82 WO write only value
83 RW read/write value
84 ======= ===========================================
85
86 Read/write values may be read-only for some chips, depending on the
87 hardware implementation.
88
89 All entries (except name) are optional, and should only be created in a
90 given driver if the chip has the feature.
91
92 See Documentation/ABI/testing/sysfs-class-hwmon for a complete description
93 of the attributes.
94
95 *****************
96 Global attributes
97 *****************
98
99 `name`
100 The chip name.
101
102 `label`
103 A descriptive label that allows to uniquely identify a device
104 within the system.
105
106 `update_interval`
107 The interval at which the chip will update readings.
108
109
110 ********
111 Voltages
112 ********
113
114 `in[0-*]_min`
115 Voltage min value.
116
117 `in[0-*]_lcrit`
118 Voltage critical min value.
119
120 `in[0-*]_max`
121 Voltage max value.
122
123 `in[0-*]_crit`
124 Voltage critical max value.
125
126 `in[0-*]_input`
127 Voltage input value.
128
129 `in[0-*]_average`
130 Average voltage
131
132 `in[0-*]_lowest`
133 Historical minimum voltage
134
135 `in[0-*]_highest`
136 Historical maximum voltage
137
138 `in[0-*]_reset_history`
139 Reset inX_lowest and inX_highest
140
141 `in_reset_history`
142 Reset inX_lowest and inX_highest for all sensors
143
144 `in[0-*]_label`
145 Suggested voltage channel label.
146
147 `in[0-*]_enable`
148 Enable or disable the sensors.
149
150 `cpu[0-*]_vid`
151 CPU core reference voltage.
152
153 `vrm`
154 Voltage Regulator Module version number.
155
156 `in[0-*]_rated_min`
157 Minimum rated voltage.
158
159 `in[0-*]_rated_max`
160 Maximum rated voltage.
161
162 Also see the Alarms section for status flags associated with voltages.
163
164
165 ****
166 Fans
167 ****
168
169 `fan[1-*]_min`
170 Fan minimum value
171
172 `fan[1-*]_max`
173 Fan maximum value
174
175 `fan[1-*]_input`
176 Fan input value.
177
178 `fan[1-*]_div`
179 Fan divisor.
180
181 `fan[1-*]_pulses`
182 Number of tachometer pulses per fan revolution.
183
184 `fan[1-*]_target`
185 Desired fan speed
186
187 `fan[1-*]_label`
188 Suggested fan channel label.
189
190 `fan[1-*]_enable`
191 Enable or disable the sensors.
192
193 Also see the Alarms section for status flags associated with fans.
194
195
196 ***
197 PWM
198 ***
199
200 `pwm[1-*]`
201 Pulse width modulation fan control.
202
203 `pwm[1-*]_enable`
204 Fan speed control method.
205
206 `pwm[1-*]_mode`
207 direct current or pulse-width modulation.
208
209 `pwm[1-*]_freq`
210 Base PWM frequency in Hz.
211
212 `pwm[1-*]_auto_channels_temp`
213 Select which temperature channels affect this PWM output in
214 auto mode.
215
216 `pwm[1-*]_auto_point[1-*]_pwm` / `pwm[1-*]_auto_point[1-*]_temp` / `pwm[1-*]_auto_point[1-*]_temp_hyst`
217 Define the PWM vs temperature curve.
218
219 `temp[1-*]_auto_point[1-*]_pwm` / `temp[1-*]_auto_point[1-*]_temp` / `temp[1-*]_auto_point[1-*]_temp_hyst`
220 Define the PWM vs temperature curve.
221
222 There is a third case where trip points are associated to both PWM output
223 channels and temperature channels: the PWM values are associated to PWM
224 output channels while the temperature values are associated to temperature
225 channels. In that case, the result is determined by the mapping between
226 temperature inputs and PWM outputs. When several temperature inputs are
227 mapped to a given PWM output, this leads to several candidate PWM values.
228 The actual result is up to the chip, but in general the highest candidate
229 value (fastest fan speed) wins.
230
231
232 ************
233 Temperatures
234 ************
235
236 `temp[1-*]_type`
237 Sensor type selection.
238
239 `temp[1-*]_max`
240 Temperature max value.
241
242 `temp[1-*]_min`
243 Temperature min value.
244
245 `temp[1-*]_max_hyst`
246 Temperature hysteresis value for max limit.
247
248 `temp[1-*]_min_hyst`
249 Temperature hysteresis value for min limit.
250
251 `temp[1-*]_input`
252 Temperature input value.
253
254 `temp[1-*]_crit`
255 Temperature critical max value, typically greater than
256 corresponding temp_max values.
257
258 `temp[1-*]_crit_hyst`
259 Temperature hysteresis value for critical limit.
260
261 `temp[1-*]_emergency`
262 Temperature emergency max value, for chips supporting more than
263 two upper temperature limits.
264
265 `temp[1-*]_emergency_hyst`
266 Temperature hysteresis value for emergency limit.
267
268 `temp[1-*]_lcrit`
269 Temperature critical min value, typically lower than
270 corresponding temp_min values.
271
272 `temp[1-*]_lcrit_hyst`
273 Temperature hysteresis value for critical min limit.
274
275 `temp[1-*]_offset`
276 Temperature offset which is added to the temperature reading
277 by the chip.
278
279 `temp[1-*]_label`
280 Suggested temperature channel label.
281
282 `temp[1-*]_lowest`
283 Historical minimum temperature
284
285 `temp[1-*]_highest`
286 Historical maximum temperature
287
288 `temp[1-*]_reset_history`
289 Reset temp_lowest and temp_highest
290
291 `temp_reset_history`
292 Reset temp_lowest and temp_highest for all sensors
293
294 `temp[1-*]_enable`
295 Enable or disable the sensors.
296
297 `temp[1-*]_rated_min`
298 Minimum rated temperature.
299
300 `temp[1-*]_rated_max`
301 Maximum rated temperature.
302
303 Some chips measure temperature using external thermistors and an ADC, and
304 report the temperature measurement as a voltage. Converting this voltage
305 back to a temperature (or the other way around for limits) requires
306 mathematical functions not available in the kernel, so the conversion
307 must occur in user space. For these chips, all temp* files described
308 above should contain values expressed in millivolt instead of millidegree
309 Celsius. In other words, such temperature channels are handled as voltage
310 channels by the driver.
311
312 Also see the Alarms section for status flags associated with temperatures.
313
314
315 ********
316 Currents
317 ********
318
319 `curr[1-*]_max`
320 Current max value.
321
322 `curr[1-*]_min`
323 Current min value.
324
325 `curr[1-*]_lcrit`
326 Current critical low value
327
328 `curr[1-*]_crit`
329 Current critical high value.
330
331 `curr[1-*]_input`
332 Current input value.
333
334 `curr[1-*]_average`
335 Average current use.
336
337 `curr[1-*]_lowest`
338 Historical minimum current.
339
340 `curr[1-*]_highest`
341 Historical maximum current.
342
343 `curr[1-*]_reset_history`
344 Reset currX_lowest and currX_highest
345
346 WO
347
348 `curr_reset_history`
349 Reset currX_lowest and currX_highest for all sensors.
350
351 `curr[1-*]_enable`
352 Enable or disable the sensors.
353
354 `curr[1-*]_rated_min`
355 Minimum rated current.
356
357 `curr[1-*]_rated_max`
358 Maximum rated current.
359
360 Also see the Alarms section for status flags associated with currents.
361
362 *****
363 Power
364 *****
365
366 `power[1-*]_average`
367 Average power use.
368
369 `power[1-*]_average_interval`
370 Power use averaging interval.
371
372 `power[1-*]_average_interval_max`
373 Maximum power use averaging interval.
374
375 `power[1-*]_average_interval_min`
376 Minimum power use averaging interval.
377
378 `power[1-*]_average_highest`
379 Historical average maximum power use
380
381 `power[1-*]_average_lowest`
382 Historical average minimum power use
383
384 `power[1-*]_average_max`
385 A poll notification is sent to `power[1-*]_average` when
386 power use rises above this value.
387
388 `power[1-*]_average_min`
389 A poll notification is sent to `power[1-*]_average` when
390 power use sinks below this value.
391
392 `power[1-*]_input`
393 Instantaneous power use.
394
395 `power[1-*]_input_highest`
396 Historical maximum power use
397
398 `power[1-*]_input_lowest`
399 Historical minimum power use.
400
401 `power[1-*]_reset_history`
402 Reset input_highest, input_lowest, average_highest and
403 average_lowest.
404
405 `power[1-*]_accuracy`
406 Accuracy of the power meter.
407
408 `power[1-*]_cap`
409 If power use rises above this limit, the
410 system should take action to reduce power use.
411
412 `power[1-*]_cap_hyst`
413 Margin of hysteresis built around capping and notification.
414
415 `power[1-*]_cap_max`
416 Maximum cap that can be set.
417
418 `power[1-*]_cap_min`
419 Minimum cap that can be set.
420
421 `power[1-*]_max`
422 Maximum power.
423
424 `power[1-*]_crit`
425 Critical maximum power.
426
427 If power rises to or above this limit, the
428 system is expected take drastic action to reduce
429 power consumption, such as a system shutdown or
430 a forced powerdown of some devices.
431
432 Unit: microWatt
433
434 RW
435
436 `power[1-*]_enable`
437 Enable or disable the sensors.
438
439 When disabled the sensor read will return
440 -ENODATA.
441
442 - 1: Enable
443 - 0: Disable
444
445 RW
446
447 `power[1-*]_rated_min`
448 Minimum rated power.
449
450 Unit: microWatt
451
452 RO
453
454 `power[1-*]_rated_max`
455 Maximum rated power.
456
457 Unit: microWatt
458
459 RO
460
461 Also see the Alarms section for status flags associated with power readings.
462
463 ******
464 Energy
465 ******
466
467 `energy[1-*]_input`
468 Cumulative energy use
469
470 Unit: microJoule
471
472 RO
473
474 `energy[1-*]_enable`
475 Enable or disable the sensors.
476
477 When disabled the sensor read will return
478 -ENODATA.
479
480 - 1: Enable
481 - 0: Disable
482
483 RW
484
485 ********
486 Humidity
487 ********
488
489 `humidity[1-*]_input`
490 Humidity.
491
492 `humidity[1-*]_enable`
493 Enable or disable the sensors.
494
495 `humidity[1-*]_rated_min`
496 Minimum rated humidity.
497
498 `humidity[1-*]_rated_max`
499 Maximum rated humidity.
500
501 ******
502 Alarms
503 ******
504
505 Each channel or limit may have an associated alarm file, containing a
506 boolean value. 1 means than an alarm condition exists, 0 means no alarm.
507
508 Usually a given chip will either use channel-related alarms, or
509 limit-related alarms, not both. The driver should just reflect the hardware
510 implementation.
511
512 +-------------------------------+-----------------------+
513 | **`in[0-*]_alarm`, | Channel alarm |
514 | `curr[1-*]_alarm`, | |
515 | `power[1-*]_alarm`, | - 0: no alarm |
516 | `fan[1-*]_alarm`, | - 1: alarm |
517 | `temp[1-*]_alarm`** | |
518 | | RO |
519 +-------------------------------+-----------------------+
520
521 **OR**
522
523 +-------------------------------+-----------------------+
524 | **`in[0-*]_min_alarm`, | Limit alarm |
525 | `in[0-*]_max_alarm`, | |
526 | `in[0-*]_lcrit_alarm`, | - 0: no alarm |
527 | `in[0-*]_crit_alarm`, | - 1: alarm |
528 | `curr[1-*]_min_alarm`, | |
529 | `curr[1-*]_max_alarm`, | RO |
530 | `curr[1-*]_lcrit_alarm`, | |
531 | `curr[1-*]_crit_alarm`, | |
532 | `power[1-*]_cap_alarm`, | |
533 | `power[1-*]_max_alarm`, | |
534 | `power[1-*]_crit_alarm`, | |
535 | `fan[1-*]_min_alarm`, | |
536 | `fan[1-*]_max_alarm`, | |
537 | `temp[1-*]_min_alarm`, | |
538 | `temp[1-*]_max_alarm`, | |
539 | `temp[1-*]_lcrit_alarm`, | |
540 | `temp[1-*]_crit_alarm`, | |
541 | `temp[1-*]_emergency_alarm`** | |
542 +-------------------------------+-----------------------+
543
544 Each input channel may have an associated fault file. This can be used
545 to notify open diodes, unconnected fans etc. where the hardware
546 supports it. When this boolean has value 1, the measurement for that
547 channel should not be trusted.
548
549 `fan[1-*]_fault` / `temp[1-*]_fault`
550 Input fault condition.
551
552 Some chips also offer the possibility to get beeped when an alarm occurs:
553
554 `beep_enable`
555 Master beep enable.
556
557 `in[0-*]_beep`, `curr[1-*]_beep`, `fan[1-*]_beep`, `temp[1-*]_beep`,
558 Channel beep.
559
560 In theory, a chip could provide per-limit beep masking, but no such chip
561 was seen so far.
562
563 Old drivers provided a different, non-standard interface to alarms and
564 beeps. These interface files are deprecated, but will be kept around
565 for compatibility reasons:
566
567 `alarms`
568 Alarm bitmask.
569
570 `beep_mask`
571 Bitmask for beep.
572
573
574 *******************
575 Intrusion detection
576 *******************
577
578 `intrusion[0-*]_alarm`
579 Chassis intrusion detection.
580
581 `intrusion[0-*]_beep`
582 Chassis intrusion beep.
583
584 ****************************
585 Average sample configuration
586 ****************************
587
588 Devices allowing for reading {in,power,curr,temp}_average values may export
589 attributes for controlling number of samples used to compute average.
590
591 +--------------+---------------------------------------------------------------+
592 | samples | Sets number of average samples for all types of measurements. |
593 | | |
594 | | RW |
595 +--------------+---------------------------------------------------------------+
596 | in_samples | Sets number of average samples for specific type of |
597 | power_samples| measurements. |
598 | curr_samples | |
599 | temp_samples | Note that on some devices it won't be possible to set all of |
600 | | them to different values so changing one might also change |
601 | | some others. |
602 | | |
603 | | RW |
604 +--------------+---------------------------------------------------------------+
605
606 sysfs attribute writes interpretation
607 -------------------------------------
608
609 hwmon sysfs attributes always contain numbers, so the first thing to do is to
610 convert the input to a number, there are 2 ways todo this depending whether
611 the number can be negative or not::
612
613 unsigned long u = simple_strtoul(buf, NULL, 10);
614 long s = simple_strtol(buf, NULL, 10);
615
616 With buf being the buffer with the user input being passed by the kernel.
617 Notice that we do not use the second argument of strto[u]l, and thus cannot
618 tell when 0 is returned, if this was really 0 or is caused by invalid input.
619 This is done deliberately as checking this everywhere would add a lot of
620 code to the kernel.
621
622 Notice that it is important to always store the converted value in an
623 unsigned long or long, so that no wrap around can happen before any further
624 checking.
625
626 After the input string is converted to an (unsigned) long, the value should be
627 checked if its acceptable. Be careful with further conversions on the value
628 before checking it for validity, as these conversions could still cause a wrap
629 around before the check. For example do not multiply the result, and only
630 add/subtract if it has been divided before the add/subtract.
631
632 What to do if a value is found to be invalid, depends on the type of the
633 sysfs attribute that is being set. If it is a continuous setting like a
634 tempX_max or inX_max attribute, then the value should be clamped to its
635 limits using clamp_val(value, min_limit, max_limit). If it is not continuous
636 like for example a tempX_type, then when an invalid value is written,
637 -EINVAL should be returned.
638
639 Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees)::
640
641 long v = simple_strtol(buf, NULL, 10) / 1000;
642 v = clamp_val(v, -128, 127);
643 /* write v to register */
644
645 Example2, fan divider setting, valid values 2, 4 and 8::
646
647 unsigned long v = simple_strtoul(buf, NULL, 10);
648
649 switch (v) {
650 case 2: v = 1; break;
651 case 4: v = 2; break;
652 case 8: v = 3; break;
653 default:
654 return -EINVAL;
655 }
656 /* write v to register */
657

3. 한국어 전문 번역

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

sysfs 이름·데이터 형식 표준의 목적

1-67

libsensors 라이브러리는 sysfs 인터페이스를 통해 가공되지 않은 센서 데이터에 접근하는 인터페이스를 제공합니다. lm-sensors 3.0.0부터 libsensors는 칩에 완전히 독립적이며, 모든 커널 드라이버가 이 문서에 설명된 표준 sysfs 인터페이스를 구현한다고 가정합니다. 따라서 특정 칩 지원을 추가하거나 갱신해도 libsensors와 이를 사용하는 응용 프로그램을 수정할 필요가 없어 lm-sensors 2에 비해 크게 개선되었습니다.

메인보드마다 센서 칩 연결 방식은 크게 다릅니다. 예를 들어 두 번째 온도 센서가 CPU에 연결된다거나 두 번째 팬이 CPU 팬이라는 보장은 없습니다. 칩이 보고한 일부 값은 의미 있는 값이 되기 전에 계산도 필요합니다. 대다수 칩은 0~+4 V만 측정할 수 있어 다른 전압은 외부 저항으로 이 범위까지 낮춥니다. 저항값이 메인보드마다 다르므로 이 변환은 드라이버에 하드코딩할 수 없고 사용자 공간에서 수행해야 합니다.

이 때문에 칩 독립적인 libsensors를 지향하더라도 올바른 값 변환, 입력 레이블 지정, 사용하지 않는 입력 숨김을 위해 `/etc/sensors.conf` 같은 설정 파일이 필요합니다.

일부 프로그램은 sysfs 파일에 직접 접근합니다. 이 문서는 응용 프로그램이 항목을 검색하고 일관된 방법으로 데이터에 접근할 수 있도록 드라이버가 따르는 표준을 간략히 설명합니다. 다만 이런 프로그램은 변환·레이블 지정·입력 숨김을 직접 구현해야 하므로 라이브러리를 우회하는 방식은 여전히 권장되지 않습니다.

각 칩은 sysfs의 `/sys/devices` 트리에 자체 디렉터리를 갖습니다. 모든 센서 칩을 찾을 때는 `/sys/class/hwmon/hwmon*`의 장치 심볼릭 링크를 따라가는 편이 쉽습니다.

lm-sensors 3.0.0까지 libsensors는 물리 장치 디렉터리에서 하드웨어 모니터링 속성을 찾았습니다. 3.0.1부터는 hwmon 클래스 장치 디렉터리의 속성도 지원합니다. 다기능 칩용 복합 드라이버는 이 기능으로 이름 공간 오염을 피할 수 있지만, 구버전 libsensors는 해당 드라이버를 지원하지 못합니다.

모든 sysfs 값은 고정소수점 수입니다. 예전 `/proc` 명세와 달리 파일 하나에는 값 하나만 둡니다. 일반적인 파일 이름은 `<type><number>_<item>` 형식입니다. 센서 형식은 보통 전압 `in`, 온도 `temp`, 팬 `fan`이며 항목은 측정값 `input`, 상한 `max`, 하한 `min`입니다. 번호는 보통 1부터 시작하지만 전압은 데이터시트 관례에 따라 0부터 시작합니다. 같은 형식의 요소가 한 개뿐이어도 여러 번 존재할 수 있는 요소에는 항상 번호를 붙입니다. 특정 요소를 가리키지 않는 파일은 번호 없는 단순 이름을 사용합니다.

경보는 칩에서 직접 읽은 표시입니다. 드라이버는 측정값과 임계값을 비교하지 않습니다. 따라서 두 번의 읽기 사이에 발생한 위반도 칩이 포착해 경보로 남길 수 있습니다. 임계값에 도달할 때인지 초과할 때인지와 같은 정확한 경보 조건은 칩에 따라 다릅니다.

hwmon sysfs 속성에 값을 설정할 때는 원하는 값의 문자열 표현을 써야 합니다. 숫자가 아닌 문자열은 `0`으로 해석된다는 점에 유의하십시오. 자세한 해석 규칙은 문서 끝의 'sysfs attribute writes interpretation' 절에서 설명합니다.

hwmon 파일 이름 구성
구성의미
`<type>`센서 종류`in`, `temp`, `fan`
`<number>`같은 종류의 채널 번호전압은 보통 0부터, 나머지는 1부터
`<item>`값 또는 설정의 종류`input`, `max`, `min`
파일 내용파일당 고정소수점 값 하나예전 `/proc`의 다중 값 형식과 다름

표준 파일 이름의 각 부분과 번호 규칙을 구조화했습니다.

libsensors 데이터 경로
센서 칩이 원시 측정값·경보 기록커널 드라이버가 표준 sysfs 속성 제공libsensors가 속성 탐색설정 파일로 변환·레이블·숨김 적용응용 프로그램에 칩 독립 값 제공

하드웨어 값이 응용 프로그램에 전달되는 기본 흐름입니다.

Naming and data format standards for sysfs files
================================================

The libsensors library offers an interface to the raw sensors data
through the sysfs interface. Since lm-sensors 3.0.0, libsensors is
completely chip-independent. It assumes that all the kernel drivers
implement the standard sysfs interface described in this document.
This makes adding or updating support for any given chip very easy, as
libsensors, and applications using it, do not need to be modified.
This is a major improvement compared to lm-sensors 2.

Note that motherboards vary widely in the connections to sensor chips.
There is no standard that ensures, for example, that the second
temperature sensor is connected to the CPU, or that the second fan is on
the CPU. Also, some values reported by the chips need some computation
before they make full sense. For example, most chips can only measure
voltages between 0 and +4V. Other voltages are scaled back into that
range using external resistors. Since the values of these resistors
can change from motherboard to motherboard, the conversions cannot be
hard coded into the driver and have to be done in user space.

For this reason, even if we aim at a chip-independent libsensors, it will
still require a configuration file (e.g. /etc/sensors.conf) for proper
values conversion, labeling of inputs and hiding of unused inputs.

An alternative method that some programs use is to access the sysfs
files directly. This document briefly describes the standards that the
drivers follow, so that an application program can scan for entries and
access this data in a simple and consistent way. That said, such programs
will have to implement conversion, labeling and hiding of inputs. For
this reason, it is still not recommended to bypass the library.

Each chip gets its own directory in the sysfs /sys/devices tree.  To
find all sensor chips, it is easier to follow the device symlinks from
`/sys/class/hwmon/hwmon*`.

Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes
in the "physical" device directory. Since lm-sensors 3.0.1, attributes found
in the hwmon "class" device directory are also supported. Complex drivers
(e.g. drivers for multifunction chips) may want to use this possibility to
avoid namespace pollution. The only drawback will be that older versions of
libsensors won't support the driver in question.

All sysfs values are fixed point numbers.

There is only one value per file, unlike the older /proc specification.
The common scheme for files naming is: <type><number>_<item>. Usual
types for sensor chips are "in" (voltage), "temp" (temperature) and
"fan" (fan). Usual items are "input" (measured value), "max" (high
threshold, "min" (low threshold). Numbering usually starts from 1,
except for voltages which start from 0 (because most data sheets use
this). A number is always used for elements that can be present more
than once, even if there is a single element of the given type on the
specific chip. Other files do not refer to a specific element, so
they have a simple name, and no number.

Alarms are direct indications read from the chips. The drivers do NOT
make comparisons of readings to thresholds. This allows violations
between readings to be caught and alarmed. The exact definition of an
alarm (for example, whether a threshold must be met or must be exceeded
to cause an alarm) is chip-dependent.

When setting values of hwmon sysfs attributes, the string representation of
the desired value must be written, note that strings which are not a number
are interpreted as 0! For more on how written strings are interpreted see the
"sysfs attribute writes interpretation" section at the end of this file.

속성 접근 권한과 전역 속성

68-109

하드웨어 모니터링 sysfs 속성은 제한 없는 사용자 공간 응용 프로그램에 표시됩니다. 그러므로 모든 표준 ABI 속성은 누구나 읽을 수 있어야 하며, 쓰기 가능한 표준 ABI 속성은 권한 있는 사용자만 쓸 수 있어야 합니다.

`[0-*]`는 0부터 시작하는 모든 비음수 번호, `[1-*]`는 1부터 시작하는 모든 양의 번호를 뜻합니다. `RO`는 읽기 전용, `WO`는 쓰기 전용, `RW`는 읽기/쓰기를 뜻합니다. 하드웨어 구현에 따라 `RW`로 정의된 값이 일부 칩에서는 읽기 전용일 수 있습니다.

`name`을 제외한 모든 항목은 선택 사항입니다. 드라이버는 칩에 해당 기능이 있을 때만 항목을 만들어야 합니다. 속성의 완전한 설명은 `Documentation/ABI/testing/sysfs-class-hwmon`을 참조하십시오.

전역 속성 `name`은 칩 이름입니다. `label`은 시스템 안에서 장치를 고유하게 식별할 수 있는 설명 레이블입니다. `update_interval`은 칩이 측정값을 갱신하는 간격입니다.

접근 표기와 전역 속성
표기·속성조건
`[0-*]`0부터 시작하는 번호0, 1, 2, ...
`[1-*]`1부터 시작하는 번호1, 2, 3, ...
`RO` / `WO` / `RW`읽기 전용 / 쓰기 전용 / 읽기·쓰기쓰기에는 권한 필요
`name`칩 이름유일한 필수 항목
`label`장치 고유 식별용 설명기능이 있을 때 생성
`update_interval`측정값 갱신 간격기능이 있을 때 생성

번호 범위, 접근 권한, 필수 여부를 한 표로 정리했습니다.

속성 공개 판단
칩 기능 존재 여부 확인`name`은 항상 생성지원하는 선택 속성만 생성모든 표준 속성을 누구나 읽게 설정쓰기 가능한 속성은 권한 사용자로 제한

드라이버가 표준 속성을 만들고 권한을 정하는 순서입니다.

Attribute access
----------------

Hardware monitoring sysfs attributes are displayed by unrestricted userspace
applications. For this reason, all standard ABI attributes shall be world
readable. Writeable standard ABI attributes shall be writeable only for
privileged users.

-------------------------------------------------------------------------

======= ===========================================
`[0-*]`        denotes any positive number starting from 0
`[1-*]`        denotes any positive number starting from 1
RO        read only value
WO        write only value
RW        read/write value
======= ===========================================

Read/write values may be read-only for some chips, depending on the
hardware implementation.

All entries (except name) are optional, and should only be created in a
given driver if the chip has the feature.

See Documentation/ABI/testing/sysfs-class-hwmon for a complete description
of the attributes.

*****************
Global attributes
*****************

`name`
                The chip name.

`label`
                A descriptive label that allows to uniquely identify a device
                within the system.

`update_interval`
                The interval at which the chip will update readings.

전압 속성

110-164

전압 채널은 `in[0-*]`로 번호를 붙입니다. `in[0-*]_min`과 `in[0-*]_lcrit`은 각각 최솟값과 임계 최솟값, `in[0-*]_max`와 `in[0-*]_crit`은 각각 최댓값과 임계 최댓값입니다. `in[0-*]_input`은 현재 입력 전압이고 `in[0-*]_average`는 평균 전압입니다.

`in[0-*]_lowest`와 `in[0-*]_highest`는 기록된 역사적 최저·최고 전압입니다. `in[0-*]_reset_history`는 해당 채널의 두 기록을 초기화하고, `in_reset_history`는 모든 센서의 `inX_lowest`와 `inX_highest`를 초기화합니다.

`in[0-*]_label`은 권장 전압 채널 레이블이고 `in[0-*]_enable`은 센서를 켜거나 끕니다. `cpu[0-*]_vid`는 CPU 코어 기준 전압, `vrm`은 Voltage Regulator Module 버전 번호입니다. `in[0-*]_rated_min`과 `in[0-*]_rated_max`는 정격 최소·최대 전압입니다. 전압과 연관된 상태 플래그는 경보 절도 참조하십시오.

전압 sysfs 속성
속성의미범위
`in[0-*]_input` / `_average`현재 입력 / 평균 전압채널별
`in[0-*]_min` / `_lcrit`최소 / 임계 최소채널별
`in[0-*]_max` / `_crit`최대 / 임계 최대채널별
`in[0-*]_lowest` / `_highest`역사적 최저 / 최고채널별
`in[0-*]_reset_history`해당 채널 역사 기록 초기화채널별
`in_reset_history`모든 전압 채널 역사 기록 초기화전체
`in[0-*]_label` / `_enable`권장 레이블 / 센서 활성화채널별
`cpu[0-*]_vid` / `vrm`CPU 기준 전압 / VRM 버전CPU·장치
`in[0-*]_rated_min` / `_rated_max`정격 최소 / 최대 전압채널별

전압 채널의 측정·임계·기록·식별 속성을 빠짐없이 보존했습니다.

전압 채널 사용
`inX_input`으로 현재값 읽기최소·최대·임계 한계 확인칩의 전압 경보 플래그 확인`lowest`·`highest`로 역사 기록 확인필요하면 채널별 또는 전체 기록 초기화

측정과 이력 관리의 일반적인 흐름입니다.

********
Voltages
********

`in[0-*]_min`
                Voltage min value.

`in[0-*]_lcrit`
                Voltage critical min value.

`in[0-*]_max`
                Voltage max value.

`in[0-*]_crit`
                Voltage critical max value.

`in[0-*]_input`
                Voltage input value.

`in[0-*]_average`
                Average voltage

`in[0-*]_lowest`
                Historical minimum voltage

`in[0-*]_highest`
                Historical maximum voltage

`in[0-*]_reset_history`
                Reset inX_lowest and inX_highest

`in_reset_history`
                Reset inX_lowest and inX_highest for all sensors

`in[0-*]_label`
                Suggested voltage channel label.

`in[0-*]_enable`
                Enable or disable the sensors.

`cpu[0-*]_vid`
                CPU core reference voltage.

`vrm`
                Voltage Regulator Module version number.

`in[0-*]_rated_min`
                Minimum rated voltage.

`in[0-*]_rated_max`
                Maximum rated voltage.

Also see the Alarms section for status flags associated with voltages.

팬과 PWM 속성

165-230

팬 속성은 1부터 번호를 붙입니다. `fan[1-*]_min`과 `fan[1-*]_max`는 팬 속도 최소·최댓값, `fan[1-*]_input`은 현재 팬 입력값, `fan[1-*]_div`는 팬 분주값입니다. `fan[1-*]_pulses`는 팬 1회전당 타코미터 펄스 수이고 `fan[1-*]_target`은 목표 속도입니다. `fan[1-*]_label`은 권장 레이블, `fan[1-*]_enable`은 센서 활성화 설정입니다. 팬 상태 플래그는 경보 절도 참조하십시오.

`pwm[1-*]`은 펄스 폭 변조 팬 제어값입니다. `pwm[1-*]_enable`은 팬 속도 제어 방법을 고르고, `pwm[1-*]_mode`는 직류 또는 PWM 방식을 고릅니다. `pwm[1-*]_freq`는 Hz 단위 기본 PWM 주파수입니다. `pwm[1-*]_auto_channels_temp`는 자동 모드에서 해당 PWM 출력에 영향을 주는 온도 채널을 선택합니다.

`pwm[1-*]_auto_point[1-*]_pwm`, `_temp`, `_temp_hyst` 조합 또는 `temp[1-*]_auto_point[1-*]_pwm`, `_temp`, `_temp_hyst` 조합은 PWM 대 온도 곡선을 정의합니다.

트립 지점이 PWM 출력 채널과 온도 채널 양쪽에 연결되는 세 번째 경우도 있습니다. 이때 PWM 값은 PWM 출력 채널에, 온도 값은 온도 채널에 연결됩니다. 결과는 온도 입력과 PWM 출력 사이의 매핑으로 정해집니다. 여러 온도 입력이 같은 PWM 출력에 매핑되면 후보 PWM 값도 여러 개가 됩니다. 실제 선택은 칩에 달렸지만 일반적으로 가장 큰 후보값, 즉 가장 빠른 팬 속도가 이깁니다.

팬·PWM 속성
속성의미단위·결과
`fan[1-*]_input`현재 팬 입력값팬 속도
`fan[1-*]_min` / `_max`팬 최소 / 최대한계
`fan[1-*]_div` / `_pulses`분주값 / 회전당 타코 펄스변환 설정
`fan[1-*]_target`목표 팬 속도제어 목표
`fan[1-*]_label` / `_enable`권장 레이블 / 센서 활성화식별·상태
`pwm[1-*]`PWM 팬 제어값출력
`pwm[1-*]_enable` / `_mode`제어 방법 / DC·PWM 방식모드
`pwm[1-*]_freq`기본 PWM 주파수Hz
`pwm[1-*]_auto_channels_temp`자동 모드 영향 온도 채널매핑
`*_auto_point[1-*]_{pwm,temp,temp_hyst}`PWM 대 온도 곡선트립 지점

속도 측정과 자동 제어 곡선에 쓰는 속성입니다.

자동 팬 제어 결정
온도 입력별 트립 지점 평가온도 채널을 PWM 출력에 매핑출력별 후보 PWM 값 계산칩의 선택 규칙 적용일반적으로 가장 큰 값으로 팬 구동

여러 온도 입력이 한 PWM 출력에 연결될 때의 결정 흐름입니다.

****
Fans
****

`fan[1-*]_min`
                Fan minimum value

`fan[1-*]_max`
                Fan maximum value

`fan[1-*]_input`
                Fan input value.

`fan[1-*]_div`
                Fan divisor.

`fan[1-*]_pulses`
                Number of tachometer pulses per fan revolution.

`fan[1-*]_target`
                Desired fan speed

`fan[1-*]_label`
                Suggested fan channel label.

`fan[1-*]_enable`
                Enable or disable the sensors.

Also see the Alarms section for status flags associated with fans.


***
PWM
***

`pwm[1-*]`
                Pulse width modulation fan control.

`pwm[1-*]_enable`
                Fan speed control method.

`pwm[1-*]_mode`
                direct current or pulse-width modulation.

`pwm[1-*]_freq`
                Base PWM frequency in Hz.

`pwm[1-*]_auto_channels_temp`
                Select which temperature channels affect this PWM output in
                auto mode.

`pwm[1-*]_auto_point[1-*]_pwm` / `pwm[1-*]_auto_point[1-*]_temp` / `pwm[1-*]_auto_point[1-*]_temp_hyst`
                Define the PWM vs temperature curve.

`temp[1-*]_auto_point[1-*]_pwm` / `temp[1-*]_auto_point[1-*]_temp` / `temp[1-*]_auto_point[1-*]_temp_hyst`
                Define the PWM vs temperature curve.

There is a third case where trip points are associated to both PWM output
channels and temperature channels: the PWM values are associated to PWM
output channels while the temperature values are associated to temperature
channels. In that case, the result is determined by the mapping between
temperature inputs and PWM outputs. When several temperature inputs are
mapped to a given PWM output, this leads to several candidate PWM values.
The actual result is up to the chip, but in general the highest candidate
value (fastest fan speed) wins.

온도 속성

231-314

`temp[1-*]_type`은 센서 종류를 선택합니다. `temp[1-*]_max`와 `_min`은 온도 최대·최솟값이며, `_max_hyst`와 `_min_hyst`는 각각 해당 한계의 히스테리시스입니다. `temp[1-*]_input`은 현재 온도 입력값입니다.

`temp[1-*]_crit`은 보통 대응하는 `temp_max`보다 높은 임계 최대 온도이고 `_crit_hyst`는 그 히스테리시스입니다. 상한을 두 개보다 많이 지원하는 칩에서 `_emergency`는 비상 최대 온도, `_emergency_hyst`는 비상 한계의 히스테리시스입니다. `_lcrit`은 보통 대응하는 `temp_min`보다 낮은 임계 최소 온도이고 `_lcrit_hyst`는 그 임계 최소 한계의 히스테리시스입니다.

`temp[1-*]_offset`은 칩이 온도 측정값에 더하는 오프셋이고 `_label`은 권장 온도 채널 레이블입니다. `_lowest`와 `_highest`는 역사적 최저·최고 온도이며 `_reset_history`는 해당 기록을 초기화합니다. `temp_reset_history`는 모든 센서의 최저·최고 온도 기록을 초기화합니다. `_enable`은 센서를 활성화하거나 비활성화하고 `_rated_min`과 `_rated_max`는 정격 최소·최대 온도입니다.

일부 칩은 외부 서미스터와 ADC로 온도를 측정하고 결과를 전압으로 보고합니다. 이 전압을 온도로, 또는 한계 설정을 위해 온도를 전압으로 변환하려면 커널에 없는 수학 함수가 필요하므로 사용자 공간에서 변환해야 합니다. 이런 칩의 위 `temp*` 파일은 밀리섭씨가 아니라 밀리볼트 단위 값을 담아야 합니다. 다시 말해 드라이버는 해당 온도 채널을 전압 채널처럼 취급합니다. 온도 상태 플래그는 경보 절도 참조하십시오.

온도 sysfs 속성
속성의미관계
`temp[1-*]_type` / `_input`센서 종류 / 현재 온도채널 기본값
`_min` / `_min_hyst`최소 한계 / 히스테리시스하한
`_max` / `_max_hyst`최대 한계 / 히스테리시스상한
`_lcrit` / `_lcrit_hyst`임계 최소 / 히스테리시스보통 `_min`보다 낮음
`_crit` / `_crit_hyst`임계 최대 / 히스테리시스보통 `_max`보다 높음
`_emergency` / `_emergency_hyst`비상 최대 / 히스테리시스추가 상한 지원 칩
`_offset` / `_label`칩 적용 오프셋 / 권장 레이블보정·식별
`_lowest` / `_highest`역사적 최저 / 최고이력
`_reset_history` / `temp_reset_history`채널별 / 전체 이력 초기화이력 관리
`_enable` / `_rated_min` / `_rated_max`활성화 / 정격 최소 / 정격 최대상태·정격

일반 한계, 임계·비상 한계, 이력 및 보정 속성입니다.

서미스터 온도 채널
외부 서미스터가 온도에 따라 전압 생성ADC가 전압 측정드라이버가 `temp*`에 밀리볼트 값 제공사용자 공간이 수학 함수로 온도 변환온도 레이블·한계·경보 적용

전압으로 보고되는 온도 채널의 처리 경로입니다.


************
Temperatures
************

`temp[1-*]_type`
                Sensor type selection.

`temp[1-*]_max`
                Temperature max value.

`temp[1-*]_min`
                Temperature min value.

`temp[1-*]_max_hyst`
                Temperature hysteresis value for max limit.

`temp[1-*]_min_hyst`
                Temperature hysteresis value for min limit.

`temp[1-*]_input`
                Temperature input value.

`temp[1-*]_crit`
                Temperature critical max value, typically greater than
                corresponding temp_max values.

`temp[1-*]_crit_hyst`
                Temperature hysteresis value for critical limit.

`temp[1-*]_emergency`
                Temperature emergency max value, for chips supporting more than
                two upper temperature limits.

`temp[1-*]_emergency_hyst`
                Temperature hysteresis value for emergency limit.

`temp[1-*]_lcrit`
                Temperature critical min value, typically lower than
                corresponding temp_min values.

`temp[1-*]_lcrit_hyst`
                Temperature hysteresis value for critical min limit.

`temp[1-*]_offset`
                Temperature offset which is added to the temperature reading
                by the chip.

`temp[1-*]_label`
                Suggested temperature channel label.

`temp[1-*]_lowest`
                Historical minimum temperature

`temp[1-*]_highest`
                Historical maximum temperature

`temp[1-*]_reset_history`
                Reset temp_lowest and temp_highest

`temp_reset_history`
                Reset temp_lowest and temp_highest for all sensors

`temp[1-*]_enable`
                Enable or disable the sensors.

`temp[1-*]_rated_min`
                Minimum rated temperature.

`temp[1-*]_rated_max`
                Maximum rated temperature.

Some chips measure temperature using external thermistors and an ADC, and
report the temperature measurement as a voltage. Converting this voltage
back to a temperature (or the other way around for limits) requires
mathematical functions not available in the kernel, so the conversion
must occur in user space. For these chips, all temp* files described
above should contain values expressed in millivolt instead of millidegree
Celsius. In other words, such temperature channels are handled as voltage
channels by the driver.

Also see the Alarms section for status flags associated with temperatures.

전류 속성

315-361

`curr[1-*]_max`와 `_min`은 전류 최대·최솟값이고, `_lcrit`과 `_crit`은 각각 임계 저전류·고전류 값입니다. `curr[1-*]_input`은 현재 전류 입력값, `_average`는 평균 전류 사용량입니다.

`curr[1-*]_lowest`와 `_highest`는 역사적 최소·최대 전류입니다. `_reset_history`는 해당 채널의 `currX_lowest`와 `currX_highest`를 초기화하는 쓰기 전용(`WO`) 속성입니다. `curr_reset_history`는 모든 센서의 두 기록을 초기화합니다.

`curr[1-*]_enable`은 센서를 활성화하거나 비활성화합니다. `_rated_min`과 `_rated_max`는 정격 최소·최대 전류입니다. 전류 상태 플래그는 경보 절도 참조하십시오.

전류 sysfs 속성
속성의미비고
`curr[1-*]_input` / `_average`현재 / 평균 전류측정
`_min` / `_max`최소 / 최대 전류일반 한계
`_lcrit` / `_crit`임계 저 / 고전류임계 한계
`_lowest` / `_highest`역사적 최소 / 최대이력
`_reset_history`해당 채널 이력 초기화`WO`
`curr_reset_history`모든 전류 센서 이력 초기화전체
`_enable`센서 활성화·비활성화상태
`_rated_min` / `_rated_max`정격 최소 / 최대정격

전류의 측정, 한계, 이력, 정격 속성입니다.

전류 감시
`currX_input`·`average` 읽기일반·임계 한계와 비교되는 하드웨어 상태 확인전류 경보 파일 확인역사적 최저·최고 확인필요하면 `WO` 초기화 속성에 쓰기

현재값부터 경보와 이력 초기화까지의 흐름입니다.

********
Currents
********

`curr[1-*]_max`
                Current max value.

`curr[1-*]_min`
                Current min value.

`curr[1-*]_lcrit`
                Current critical low value

`curr[1-*]_crit`
                Current critical high value.

`curr[1-*]_input`
                Current input value.

`curr[1-*]_average`
                Average current use.

`curr[1-*]_lowest`
                Historical minimum current.

`curr[1-*]_highest`
                Historical maximum current.

`curr[1-*]_reset_history`
                Reset currX_lowest and currX_highest

                WO

`curr_reset_history`
                Reset currX_lowest and currX_highest for all sensors.

`curr[1-*]_enable`
                Enable or disable the sensors.

`curr[1-*]_rated_min`
                Minimum rated current.

`curr[1-*]_rated_max`
                Maximum rated current.

Also see the Alarms section for status flags associated with currents.

전력 속성

362-462

`power[1-*]_average`는 평균 전력 사용량이고 `_average_interval`은 평균 구간입니다. `_average_interval_max`와 `_average_interval_min`은 설정할 수 있는 평균 구간의 최대·최소입니다. `_average_highest`와 `_average_lowest`는 역사적 평균 전력의 최대·최소입니다.

`power[1-*]_average_max`보다 전력 사용량이 높아지면 `power[1-*]_average`에 poll 알림을 보냅니다. `_average_min`보다 낮아져도 같은 속성에 poll 알림을 보냅니다.

`power[1-*]_input`은 순간 전력 사용량입니다. `_input_highest`와 `_input_lowest`는 역사적 순간 전력 최대·최소이며 `_reset_history`는 순간 최대·최소와 평균 최대·최소를 모두 초기화합니다. `_accuracy`는 전력계의 정확도입니다.

`power[1-*]_cap`은 전력 사용량이 이 한계를 넘을 때 시스템이 전력을 줄이기 위한 조치를 취해야 하는 제한값입니다. `_cap_hyst`는 제한과 알림 주위의 히스테리시스 여유이고 `_cap_max`·`_cap_min`은 설정 가능한 제한값의 최대·최소입니다. `_max`는 최대 전력입니다.

`power[1-*]_crit`은 임계 최대 전력입니다. 전력이 이 한계에 도달하거나 넘으면 시스템 종료 또는 일부 장치의 강제 전원 차단처럼 전력 소비를 크게 낮추는 강력한 조치를 취해야 합니다. 단위는 마이크로와트이고 접근 권한은 `RW`입니다.

`power[1-*]_enable`은 센서를 켜거나 끄는 `RW` 속성입니다. `1`은 활성화, `0`은 비활성화이며 비활성 상태에서 센서를 읽으면 `-ENODATA`를 반환합니다. `power[1-*]_rated_min`과 `_rated_max`는 마이크로와트 단위의 정격 최소·최대 전력이며 둘 다 `RO`입니다. 전력 측정의 상태 플래그는 경보 절도 참조하십시오.

전력 sysfs 속성
속성의미단위·권한
`power[1-*]_average`평균 전력 사용량측정값
`_average_interval` / `_max` / `_min`평균 구간 / 가능한 최대 / 최소구간 설정
`_average_highest` / `_average_lowest`역사적 평균 최대 / 최소이력
`_average_max` / `_average_min`상·하향 poll 알림 임계값`average`에 알림
`_input` / `_input_highest` / `_input_lowest`순간값 / 역사적 최대 / 최소측정·이력
`_reset_history`순간·평균 최대·최소 초기화이력 관리
`_accuracy`전력계 정확도정확도
`_cap` / `_cap_hyst`전력 제한 / 히스테리시스 여유제한
`_cap_max` / `_cap_min`설정 가능한 제한 최대 / 최소제한 범위
`_max` / `_crit`최대 / 임계 최대 전력`_crit`: microWatt, `RW`
`_enable`1 활성화, 0 비활성화`RW`, 비활성 읽기 `-ENODATA`
`_rated_min` / `_rated_max`정격 최소 / 최대 전력microWatt, `RO`

평균·순간 전력, 제한, 정격과 명시된 단위·권한을 정리했습니다.

전력 제한 대응
순간·평균 전력 측정평균 알림 임계값 평가`cap` 초과 시 전력 절감 조치`crit` 도달·초과 시 강력한 조치종료 또는 장치 강제 전원 차단 가능

전력 상승을 감지해 단계적으로 대응하는 의미 구조입니다.

*****
Power
*****

`power[1-*]_average`
                Average power use.

`power[1-*]_average_interval`
                Power use averaging interval.

`power[1-*]_average_interval_max`
                Maximum power use averaging interval.

`power[1-*]_average_interval_min`
                Minimum power use averaging interval.

`power[1-*]_average_highest`
                Historical average maximum power use

`power[1-*]_average_lowest`
                Historical average minimum power use

`power[1-*]_average_max`
                A poll notification is sent to `power[1-*]_average` when
                power use rises above this value.

`power[1-*]_average_min`
                A poll notification is sent to `power[1-*]_average` when
                power use sinks below this value.

`power[1-*]_input`
                Instantaneous power use.

`power[1-*]_input_highest`
                Historical maximum power use

`power[1-*]_input_lowest`
                Historical minimum power use.

`power[1-*]_reset_history`
                Reset input_highest, input_lowest, average_highest and
                average_lowest.

`power[1-*]_accuracy`
                Accuracy of the power meter.

`power[1-*]_cap`
                If power use rises above this limit, the
                system should take action to reduce power use.

`power[1-*]_cap_hyst`
                Margin of hysteresis built around capping and notification.

`power[1-*]_cap_max`
                Maximum cap that can be set.

`power[1-*]_cap_min`
                Minimum cap that can be set.

`power[1-*]_max`
                Maximum power.

`power[1-*]_crit`
                                Critical maximum power.

                                If power rises to or above this limit, the
                                system is expected take drastic action to reduce
                                power consumption, such as a system shutdown or
                                a forced powerdown of some devices.

                                Unit: microWatt

                                RW

`power[1-*]_enable`
                                Enable or disable the sensors.

                                When disabled the sensor read will return
                                -ENODATA.

                                - 1: Enable
                                - 0: Disable

                                RW

`power[1-*]_rated_min`
                                Minimum rated power.

                                Unit: microWatt

                                RO

`power[1-*]_rated_max`
                                Maximum rated power.

                                Unit: microWatt

                                RO

Also see the Alarms section for status flags associated with power readings.

에너지와 습도 속성

463-500

`energy[1-*]_input`은 누적 에너지 사용량을 마이크로줄 단위로 제공하는 `RO` 속성입니다. `energy[1-*]_enable`은 센서를 활성화하거나 비활성화하는 `RW` 속성입니다. `1`은 활성화, `0`은 비활성화이며 비활성 상태에서 읽으면 `-ENODATA`를 반환합니다.

`humidity[1-*]_input`은 습도입니다. `humidity[1-*]_enable`은 센서를 활성화하거나 비활성화합니다. `humidity[1-*]_rated_min`과 `_rated_max`는 정격 최소·최대 습도입니다.

에너지·습도 속성
속성의미단위·권한
`energy[1-*]_input`누적 에너지 사용량microJoule, `RO`
`energy[1-*]_enable`1 활성화, 0 비활성화`RW`, 비활성 읽기 `-ENODATA`
`humidity[1-*]_input`습도측정값
`humidity[1-*]_enable`습도 센서 활성화·비활성화상태
`humidity[1-*]_rated_min`정격 최소 습도정격
`humidity[1-*]_rated_max`정격 최대 습도정격

두 측정 종류의 입력·상태·정격 속성을 보존했습니다.

저전력 센서 상태 처리
`energyX_enable` 확인1이면 누적 에너지 읽기마이크로줄 값 반환0이면 읽기 거부`-ENODATA` 반환

활성화 속성을 가진 에너지 센서의 읽기 흐름입니다.

******
Energy
******

`energy[1-*]_input`
                                Cumulative energy use

                                Unit: microJoule

                                RO

`energy[1-*]_enable`
                                Enable or disable the sensors.

                                When disabled the sensor read will return
                                -ENODATA.

                                - 1: Enable
                                - 0: Disable

                                RW

********
Humidity
********

`humidity[1-*]_input`
                Humidity.

`humidity[1-*]_enable`
                Enable or disable the sensors.

`humidity[1-*]_rated_min`
                Minimum rated humidity.

`humidity[1-*]_rated_max`
                Maximum rated humidity.

경보·고장·비프 속성

501-573

각 채널 또는 한계에는 불리언 값을 담는 경보 파일이 연결될 수 있습니다. `1`은 경보 조건이 존재함을, `0`은 경보가 없음을 뜻합니다. 보통 하나의 칩은 채널 단위 경보와 한계 단위 경보 중 하나만 사용하며 둘 다 쓰지 않습니다. 드라이버는 하드웨어 구현을 그대로 반영해야 합니다.

채널 경보는 `in[0-*]_alarm`, `curr[1-*]_alarm`, `power[1-*]_alarm`, `fan[1-*]_alarm`, `temp[1-*]_alarm`입니다. 모두 `RO`이며 `0`은 경보 없음, `1`은 경보를 뜻합니다.

대신 한계 경보를 제공할 수 있습니다. 전압은 `_min_alarm`, `_max_alarm`, `_lcrit_alarm`, `_crit_alarm`, 전류도 같은 네 종류를 사용합니다. 전력은 `_cap_alarm`, `_max_alarm`, `_crit_alarm`, 팬은 `_min_alarm`, `_max_alarm`, 온도는 `_min_alarm`, `_max_alarm`, `_lcrit_alarm`, `_crit_alarm`, `_emergency_alarm`을 사용합니다. 이들도 모두 `RO`이고 `0`은 경보 없음, `1`은 경보입니다.

각 입력 채널에는 고장 파일이 연결될 수 있습니다. 하드웨어가 지원하면 열린 다이오드, 연결되지 않은 팬 등을 알리는 데 사용합니다. 이 불리언 값이 `1`이면 해당 채널의 측정값을 신뢰해서는 안 됩니다. `fan[1-*]_fault`와 `temp[1-*]_fault`가 입력 고장 상태를 나타냅니다.

일부 칩은 경보 발생 시 비프음도 지원합니다. `beep_enable`은 마스터 비프 활성화이고 `in[0-*]_beep`, `curr[1-*]_beep`, `fan[1-*]_beep`, `temp[1-*]_beep`는 채널 비프 설정입니다. 이론상 한계별 비프 마스킹도 가능하지만 지금까지 그런 칩은 발견되지 않았습니다.

구형 드라이버는 경보와 비프에 다른 비표준 인터페이스를 제공했습니다. 이 파일들은 폐기 예정이지만 호환성을 위해 유지됩니다. `alarms`는 경보 비트마스크이고 `beep_mask`는 비프 비트마스크입니다.

채널 경보
속성형식값·권한
`in[0-*]_alarm`전압 채널 경보0 없음, 1 경보, `RO`
`curr[1-*]_alarm`전류 채널 경보0 없음, 1 경보, `RO`
`power[1-*]_alarm`전력 채널 경보0 없음, 1 경보, `RO`
`fan[1-*]_alarm`팬 채널 경보0 없음, 1 경보, `RO`
`temp[1-*]_alarm`온도 채널 경보0 없음, 1 경보, `RO`

원문의 첫 번째 ASCII 표를 같은 채널 목록과 상태값으로 다시 구성했습니다.

한계 경보
종류속성 접미사값·권한
전압 `in[0-*]``_min_alarm`, `_max_alarm`, `_lcrit_alarm`, `_crit_alarm`0 없음, 1 경보, `RO`
전류 `curr[1-*]``_min_alarm`, `_max_alarm`, `_lcrit_alarm`, `_crit_alarm`0 없음, 1 경보, `RO`
전력 `power[1-*]``_cap_alarm`, `_max_alarm`, `_crit_alarm`0 없음, 1 경보, `RO`
팬 `fan[1-*]``_min_alarm`, `_max_alarm`0 없음, 1 경보, `RO`
온도 `temp[1-*]``_min_alarm`, `_max_alarm`, `_lcrit_alarm`, `_crit_alarm`, `_emergency_alarm`0 없음, 1 경보, `RO`

원문의 두 번째 ASCII 표를 센서 종류별로 구조화했습니다.

상태 플래그 해석
칩의 채널형 또는 한계형 경보 방식 확인대응하는 `*_alarm` 불리언 읽기`*_fault`가 1인지 확인고장이면 측정값을 신뢰하지 않음비프 설정과 호환용 비트마스크는 별도 처리

채널 값을 표시하기 전에 경보와 고장을 함께 판단합니다.

******
Alarms
******

Each channel or limit may have an associated alarm file, containing a
boolean value. 1 means than an alarm condition exists, 0 means no alarm.

Usually a given chip will either use channel-related alarms, or
limit-related alarms, not both. The driver should just reflect the hardware
implementation.

+-------------------------------+-----------------------+
| **`in[0-*]_alarm`,                | Channel alarm                |
| `curr[1-*]_alarm`,                |                        |
| `power[1-*]_alarm`,                |   - 0: no alarm        |
| `fan[1-*]_alarm`,                |   - 1: alarm                |
| `temp[1-*]_alarm`**                |                        |
|                                |   RO                        |
+-------------------------------+-----------------------+

**OR**

+-------------------------------+-----------------------+
| **`in[0-*]_min_alarm`,        | Limit alarm                |
| `in[0-*]_max_alarm`,                |                        |
| `in[0-*]_lcrit_alarm`,        |   - 0: no alarm        |
| `in[0-*]_crit_alarm`,                |   - 1: alarm                |
| `curr[1-*]_min_alarm`,        |                        |
| `curr[1-*]_max_alarm`,        | RO                        |
| `curr[1-*]_lcrit_alarm`,        |                        |
| `curr[1-*]_crit_alarm`,        |                        |
| `power[1-*]_cap_alarm`,        |                        |
| `power[1-*]_max_alarm`,        |                        |
| `power[1-*]_crit_alarm`,        |                        |
| `fan[1-*]_min_alarm`,                |                        |
| `fan[1-*]_max_alarm`,                |                        |
| `temp[1-*]_min_alarm`,        |                        |
| `temp[1-*]_max_alarm`,        |                        |
| `temp[1-*]_lcrit_alarm`,        |                        |
| `temp[1-*]_crit_alarm`,        |                        |
| `temp[1-*]_emergency_alarm`**        |                        |
+-------------------------------+-----------------------+

Each input channel may have an associated fault file. This can be used
to notify open diodes, unconnected fans etc. where the hardware
supports it. When this boolean has value 1, the measurement for that
channel should not be trusted.

`fan[1-*]_fault` / `temp[1-*]_fault`
                Input fault condition.

Some chips also offer the possibility to get beeped when an alarm occurs:

`beep_enable`
                Master beep enable.

`in[0-*]_beep`, `curr[1-*]_beep`, `fan[1-*]_beep`, `temp[1-*]_beep`,
                Channel beep.

In theory, a chip could provide per-limit beep masking, but no such chip
was seen so far.

Old drivers provided a different, non-standard interface to alarms and
beeps. These interface files are deprecated, but will be kept around
for compatibility reasons:

`alarms`
                Alarm bitmask.

`beep_mask`
                Bitmask for beep.

침입 감지와 평균 샘플 설정

574-605

`intrusion[0-*]_alarm`은 섀시 침입 감지 경보이고 `intrusion[0-*]_beep`는 섀시 침입 비프 설정입니다.

`{in,power,curr,temp}_average` 값을 읽을 수 있는 장치는 평균 계산에 사용하는 샘플 수를 제어하는 속성을 내보낼 수 있습니다. `samples`는 모든 측정 종류의 평균 샘플 수를 설정하는 `RW` 속성입니다.

`in_samples`, `power_samples`, `curr_samples`, `temp_samples`는 각 측정 종류의 평균 샘플 수를 설정하는 `RW` 속성입니다. 일부 장치에서는 네 값을 모두 다르게 설정할 수 없으므로 하나를 바꾸면 다른 값도 함께 바뀔 수 있습니다.

평균 샘플 설정
속성적용 범위권한·제약
`samples`모든 측정 종류의 평균 샘플 수`RW`
`in_samples`전압 평균 샘플 수`RW`
`power_samples`전력 평균 샘플 수`RW`
`curr_samples`전류 평균 샘플 수`RW`
`temp_samples`온도 평균 샘플 수`RW`
장치 제약한 속성 변경이 다른 속성도 변경할 수 있음종류별 독립 설정이 항상 가능하지 않음

원문의 샘플 구성 ASCII 표를 동일한 속성 구분으로 다시 그렸습니다.

평균 샘플 수 설정
장치의 평균 측정 지원 확인전체 `samples` 또는 종류별 속성 선택권한 있는 사용자가 값 쓰기장치가 가능한 샘플 수로 적용연동된 다른 종류의 값도 다시 읽어 확인

장치 제약을 고려해 평균 구성을 적용하는 순서입니다.

*******************
Intrusion detection
*******************

`intrusion[0-*]_alarm`
                Chassis intrusion detection.

`intrusion[0-*]_beep`
                Chassis intrusion beep.

****************************
Average sample configuration
****************************

Devices allowing for reading {in,power,curr,temp}_average values may export
attributes for controlling number of samples used to compute average.

+--------------+---------------------------------------------------------------+
| samples      | Sets number of average samples for all types of measurements. |
|               |                                                               |
|               | RW                                                               |
+--------------+---------------------------------------------------------------+
| in_samples   | Sets number of average samples for specific type of               |
| power_samples| measurements.                                                       |
| curr_samples |                                                               |
| temp_samples | Note that on some devices it won't be possible to set all of  |
|               | them to different values so changing one might also change    |
|               | some others.                                                       |
|               |                                                               |
|               | RW                                                               |
+--------------+---------------------------------------------------------------+

sysfs 속성 쓰기값 해석

606-638

hwmon sysfs 속성에는 항상 숫자가 들어가므로 먼저 입력을 숫자로 변환해야 합니다. 값이 음수가 될 수 있는지에 따라 두 방법을 사용합니다. 비음수 값은 `simple_strtoul(buf, NULL, 10)`으로 `unsigned long`에, 음수가 가능한 값은 `simple_strtol(buf, NULL, 10)`으로 `long`에 변환합니다. `buf`는 커널이 전달한 사용자 입력 버퍼입니다.

`strto[u]l`의 두 번째 인수를 사용하지 않으므로 반환된 `0`이 실제 입력 0인지 잘못된 입력 때문인지 구분할 수 없습니다. 모든 위치에서 이를 검사하면 커널 코드가 크게 늘어나므로 의도적으로 이렇게 처리합니다.

추가 검사 전에 래핑이 발생하지 않도록 변환값은 반드시 `unsigned long` 또는 `long`에 저장해야 합니다.

입력 문자열을 `(unsigned) long`으로 바꾼 뒤 허용 가능한지 검사해야 합니다. 유효성 검사 전의 추가 변환도 래핑을 일으킬 수 있으므로 주의하십시오. 예를 들어 결과에 곱셈을 하지 말고, 덧셈이나 뺄셈은 먼저 나눈 경우에만 수행해야 합니다.

유효하지 않은 값의 처리는 설정하는 sysfs 속성의 종류에 따라 다릅니다. `tempX_max`나 `inX_max`처럼 연속적인 설정은 `clamp_val(value, min_limit, max_limit)`로 허용 범위에 고정합니다. `tempX_type`처럼 비연속적인 설정에는 잘못된 값이 쓰이면 `-EINVAL`을 반환해야 합니다.

쓰기값 검증 규칙
단계규칙이유·결과
부호 선택`simple_strtoul` 또는 `simple_strtol`음수 허용 여부
저장 형식`unsigned long` 또는 `long`조기 래핑 방지
0 해석유효한 0과 잘못된 입력을 구분하지 않음코드 증가 방지
검사 전 연산곱하지 않고, 나눈 뒤에만 더하거나 뺌변환 중 래핑 방지
연속 설정`clamp_val(value, min_limit, max_limit)`범위 끝값으로 고정
비연속 설정허용 목록 밖이면 `-EINVAL`잘못된 선택 거부

문자열 변환부터 속성 종류별 오류 처리까지의 규칙입니다.

sysfs 쓰기 처리
사용자 입력 `buf` 수신부호에 맞는 함수로 long 변환추가 연산 전 원형 그대로 보관속성이 연속값인지 비연속값인지 판별범위 고정 또는 `-EINVAL` 반환

드라이버가 사용자 문자열을 안전하게 처리하는 순서입니다.

sysfs attribute writes interpretation
-------------------------------------

hwmon sysfs attributes always contain numbers, so the first thing to do is to
convert the input to a number, there are 2 ways todo this depending whether
the number can be negative or not::

        unsigned long u = simple_strtoul(buf, NULL, 10);
        long s = simple_strtol(buf, NULL, 10);

With buf being the buffer with the user input being passed by the kernel.
Notice that we do not use the second argument of strto[u]l, and thus cannot
tell when 0 is returned, if this was really 0 or is caused by invalid input.
This is done deliberately as checking this everywhere would add a lot of
code to the kernel.

Notice that it is important to always store the converted value in an
unsigned long or long, so that no wrap around can happen before any further
checking.

After the input string is converted to an (unsigned) long, the value should be
checked if its acceptable. Be careful with further conversions on the value
before checking it for validity, as these conversions could still cause a wrap
around before the check. For example do not multiply the result, and only
add/subtract if it has been divided before the add/subtract.

What to do if a value is found to be invalid, depends on the type of the
sysfs attribute that is being set. If it is a continuous setting like a
tempX_max or inX_max attribute, then the value should be clamped to its
limits using clamp_val(value, min_limit, max_limit). If it is not continuous
like for example a tempX_type, then when an invalid value is written,
-EINVAL should be returned.

온도 한계와 팬 분주값 쓰기 예제

639-656

첫 번째 예제의 `temp1_max` 레지스터는 -128~127도의 부호 있는 8비트 값입니다. 입력 문자열을 `simple_strtol`로 변환하고 1000으로 나눈 뒤 `clamp_val(v, -128, 127)`로 범위에 고정한 다음 레지스터에 씁니다.

long v = simple_strtol(buf, NULL, 10) / 1000;
v = clamp_val(v, -128, 127);
/* v를 레지스터에 쓴다 */

두 번째 예제의 팬 분주 설정은 2, 4, 8만 유효합니다. 입력을 `simple_strtoul`로 변환한 뒤 `switch`에서 2를 레지스터 값 1, 4를 2, 8을 3으로 매핑합니다. 다른 값은 `-EINVAL`을 반환하며, 유효한 경우에만 변환된 값을 레지스터에 씁니다.

unsigned long v = simple_strtoul(buf, NULL, 10);

switch (v) {
case 2: v = 1; break;
case 4: v = 2; break;
case 8: v = 3; break;
default:
        return -EINVAL;
}
/* v를 레지스터에 쓴다 */
두 쓰기 예제 비교
예제입력 범위처리
`temp1_max`연속값, -128~127°C 레지스터1000으로 나눈 뒤 `clamp_val`
팬 분주값비연속값 2, 4, 8`switch` 매핑, 나머지는 `-EINVAL`

연속값과 열거값의 검증 방식 차이를 보여 줍니다.

예제의 분기
문자열을 long 형식으로 변환연속 온도값이면 단위 변환연속값은 레지스터 범위로 고정열거형 팬 분주값은 허용 목록 매핑유효할 때만 레지스터에 쓰기

속성의 값 영역에 따라 서로 다른 검증 방식을 선택합니다.

Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees)::

        long v = simple_strtol(buf, NULL, 10) / 1000;
        v = clamp_val(v, -128, 127);
        /* write v to register */

Example2, fan divider setting, valid values 2, 4 and 8::

        unsigned long v = simple_strtoul(buf, NULL, 10);

        switch (v) {
        case 2: v = 1; break;
        case 4: v = 2; break;
        case 8: v = 3; break;
        default:
                return -EINVAL;
        }
        /* write v to register */