요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
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.
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.
********
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.
****
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.
************
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.
********
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.
*****
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.
******
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.
******
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.
*******************
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 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.
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 */
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
sysfs 이름·데이터 형식 표준의 목적
1-67libsensors 라이브러리는 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' 절에서 설명합니다.
표준 파일 이름의 각 부분과 번호 규칙을 구조화했습니다.
하드웨어 값이 응용 프로그램에 전달되는 기본 흐름입니다.
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`은 칩이 측정값을 갱신하는 간격입니다.
번호 범위, 접근 권한, 필수 여부를 한 표로 정리했습니다.
드라이버가 표준 속성을 만들고 권한을 정하는 순서입니다.
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`는 정격 최소·최대 전압입니다. 전압과 연관된 상태 플래그는 경보 절도 참조하십시오.
전압 채널의 측정·임계·기록·식별 속성을 빠짐없이 보존했습니다.
측정과 이력 관리의 일반적인 흐름입니다.
********
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 출력에 연결될 때의 결정 흐름입니다.
****
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*` 파일은 밀리섭씨가 아니라 밀리볼트 단위 값을 담아야 합니다. 다시 말해 드라이버는 해당 온도 채널을 전압 채널처럼 취급합니다. 온도 상태 플래그는 경보 절도 참조하십시오.
일반 한계, 임계·비상 한계, 이력 및 보정 속성입니다.
전압으로 보고되는 온도 채널의 처리 경로입니다.
************
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`는 정격 최소·최대 전류입니다. 전류 상태 플래그는 경보 절도 참조하십시오.
전류의 측정, 한계, 이력, 정격 속성입니다.
현재값부터 경보와 이력 초기화까지의 흐름입니다.
********
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`입니다. 전력 측정의 상태 플래그는 경보 절도 참조하십시오.
평균·순간 전력, 제한, 정격과 명시된 단위·권한을 정리했습니다.
전력 상승을 감지해 단계적으로 대응하는 의미 구조입니다.
*****
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
******
`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`는 비프 비트마스크입니다.
원문의 첫 번째 ASCII 표를 같은 채널 목록과 상태값으로 다시 구성했습니다.
원문의 두 번째 ASCII 표를 센서 종류별로 구조화했습니다.
채널 값을 표시하기 전에 경보와 고장을 함께 판단합니다.
******
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` 속성입니다. 일부 장치에서는 네 값을 모두 다르게 설정할 수 없으므로 하나를 바꾸면 다른 값도 함께 바뀔 수 있습니다.
원문의 샘플 구성 ASCII 표를 동일한 속성 구분으로 다시 그렸습니다.
장치 제약을 고려해 평균 구성을 적용하는 순서입니다.
*******************
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-638hwmon 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`을 반환해야 합니다.
문자열 변환부터 속성 종류별 오류 처리까지의 규칙입니다.
드라이버가 사용자 문자열을 안전하게 처리하는 순서입니다.
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를 레지스터에 쓴다 */
연속값과 열거값의 검증 방식 차이를 보여 줍니다.
속성의 값 영역에 따라 서로 다른 검증 방식을 선택합니다.
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 */
요약·해설
sysfs-interface.rst:1-656이 문서는 칩 독립적인 사용자 공간 도구가 hwmon 드라이버를 일관되게 사용할 수 있도록 sysfs 파일의 이름과 데이터 형식을 정의합니다. 전압·팬·PWM·온도·전류·전력·에너지·습도·경보·침입 감지·평균 샘플 속성을 망라하며, 숫자 문자열을 드라이버가 안전하게 받아들이는 규칙까지 설명합니다.
핵심은 드라이버가 하드웨어 기능을 그대로 표준 ABI로 노출하고, 보드별 변환과 레이블 지정은 libsensors 설정이 맡는다는 점입니다. 경보는 드라이버의 임의 비교 결과가 아니라 칩이 직접 기록한 상태이며, 쓰기값은 `long`으로 변환한 뒤 연속값은 범위에 고정하고 비연속값은 잘못된 경우 `-EINVAL`로 거부합니다.
원문 범위와 주요 규칙을 요약합니다.
하드웨어에서 사용자 응용 프로그램까지의 전체 경로입니다.