sysfs-interface 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. Naming and data format standards for sysfs files
  2. ------------------------------------------------
  3. The libsensors library offers an interface to the raw sensors data
  4. through the sysfs interface. See libsensors documentation and source for
  5. more further information. As of writing this document, libsensors
  6. (from lm_sensors 2.8.3) is heavily chip-dependant. Adding or updating
  7. support for any given chip requires modifying the library's code.
  8. This is because libsensors was written for the procfs interface
  9. older kernel modules were using, which wasn't standardized enough.
  10. Recent versions of libsensors (from lm_sensors 2.8.2 and later) have
  11. support for the sysfs interface, though.
  12. The new sysfs interface was designed to be as chip-independant as
  13. possible.
  14. Note that motherboards vary widely in the connections to sensor chips.
  15. There is no standard that ensures, for example, that the second
  16. temperature sensor is connected to the CPU, or that the second fan is on
  17. the CPU. Also, some values reported by the chips need some computation
  18. before they make full sense. For example, most chips can only measure
  19. voltages between 0 and +4V. Other voltages are scaled back into that
  20. range using external resistors. Since the values of these resistors
  21. can change from motherboard to motherboard, the conversions cannot be
  22. hard coded into the driver and have to be done in user space.
  23. For this reason, even if we aim at a chip-independant libsensors, it will
  24. still require a configuration file (e.g. /etc/sensors.conf) for proper
  25. values conversion, labeling of inputs and hiding of unused inputs.
  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. If you are developing a userspace application please send us feedback on
  33. this standard.
  34. Note that this standard isn't completely established yet, so it is subject
  35. to changes, even important ones. One more reason to use the library instead
  36. of accessing sysfs files directly.
  37. Each chip gets its own directory in the sysfs /sys/devices tree. To
  38. find all sensor chips, it is easier to follow the symlinks from
  39. /sys/i2c/devices/
  40. All sysfs values are fixed point numbers. To get the true value of some
  41. of the values, you should divide by the specified value.
  42. There is only one value per file, unlike the older /proc specification.
  43. The common scheme for files naming is: <type><number>_<item>. Usual
  44. types for sensor chips are "in" (voltage), "temp" (temperature) and
  45. "fan" (fan). Usual items are "input" (measured value), "max" (high
  46. threshold, "min" (low threshold). Numbering usually starts from 1,
  47. except for voltages which start from 0 (because most data sheets use
  48. this). A number is always used for elements that can be present more
  49. than once, even if there is a single element of the given type on the
  50. specific chip. Other files do not refer to a specific element, so
  51. they have a simple name, and no number.
  52. Alarms are direct indications read from the chips. The drivers do NOT
  53. make comparisons of readings to thresholds. This allows violations
  54. between readings to be caught and alarmed. The exact definition of an
  55. alarm (for example, whether a threshold must be met or must be exceeded
  56. to cause an alarm) is chip-dependent.
  57. -------------------------------------------------------------------------
  58. ************
  59. * Voltages *
  60. ************
  61. in[0-8]_min Voltage min value.
  62. Unit: millivolt
  63. Read/Write
  64. in[0-8]_max Voltage max value.
  65. Unit: millivolt
  66. Read/Write
  67. in[0-8]_input Voltage input value.
  68. Unit: millivolt
  69. Read only
  70. Actual voltage depends on the scaling resistors on the
  71. motherboard, as recommended in the chip datasheet.
  72. This varies by chip and by motherboard.
  73. Because of this variation, values are generally NOT scaled
  74. by the chip driver, and must be done by the application.
  75. However, some drivers (notably lm87 and via686a)
  76. do scale, with various degrees of success.
  77. These drivers will output the actual voltage.
  78. Typical usage:
  79. in0_* CPU #1 voltage (not scaled)
  80. in1_* CPU #2 voltage (not scaled)
  81. in2_* 3.3V nominal (not scaled)
  82. in3_* 5.0V nominal (scaled)
  83. in4_* 12.0V nominal (scaled)
  84. in5_* -12.0V nominal (scaled)
  85. in6_* -5.0V nominal (scaled)
  86. in7_* varies
  87. in8_* varies
  88. cpu[0-1]_vid CPU core reference voltage.
  89. Unit: millivolt
  90. Read only.
  91. Not always correct.
  92. vrm Voltage Regulator Module version number.
  93. Read only.
  94. Two digit number, first is major version, second is
  95. minor version.
  96. Affects the way the driver calculates the CPU core reference
  97. voltage from the vid pins.
  98. ********
  99. * Fans *
  100. ********
  101. fan[1-3]_min Fan minimum value
  102. Unit: revolution/min (RPM)
  103. Read/Write.
  104. fan[1-3]_input Fan input value.
  105. Unit: revolution/min (RPM)
  106. Read only.
  107. fan[1-3]_div Fan divisor.
  108. Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128).
  109. Some chips only support values 1, 2, 4 and 8.
  110. Note that this is actually an internal clock divisor, which
  111. affects the measurable speed range, not the read value.
  112. *******
  113. * PWM *
  114. *******
  115. pwm[1-3] Pulse width modulation fan control.
  116. Integer value in the range 0 to 255
  117. Read/Write
  118. 255 is max or 100%.
  119. pwm[1-3]_enable
  120. Switch PWM on and off.
  121. Not always present even if fan*_pwm is.
  122. 0 to turn off
  123. 1 to turn on in manual mode
  124. 2 to turn on in automatic mode
  125. Read/Write
  126. pwm[1-*]_auto_channels_temp
  127. Select which temperature channels affect this PWM output in
  128. auto mode. Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc...
  129. Which values are possible depend on the chip used.
  130. pwm[1-*]_auto_point[1-*]_pwm
  131. pwm[1-*]_auto_point[1-*]_temp
  132. pwm[1-*]_auto_point[1-*]_temp_hyst
  133. Define the PWM vs temperature curve. Number of trip points is
  134. chip-dependent. Use this for chips which associate trip points
  135. to PWM output channels.
  136. OR
  137. temp[1-*]_auto_point[1-*]_pwm
  138. temp[1-*]_auto_point[1-*]_temp
  139. temp[1-*]_auto_point[1-*]_temp_hyst
  140. Define the PWM vs temperature curve. Number of trip points is
  141. chip-dependent. Use this for chips which associate trip points
  142. to temperature channels.
  143. ****************
  144. * Temperatures *
  145. ****************
  146. temp[1-3]_type Sensor type selection.
  147. Integers 1, 2, 3 or thermistor Beta value (3435)
  148. Read/Write.
  149. 1: PII/Celeron Diode
  150. 2: 3904 transistor
  151. 3: thermal diode
  152. Not all types are supported by all chips
  153. temp[1-4]_max Temperature max value.
  154. Unit: millidegree Celcius
  155. Read/Write value.
  156. temp[1-3]_min Temperature min value.
  157. Unit: millidegree Celcius
  158. Read/Write value.
  159. temp[1-3]_max_hyst
  160. Temperature hysteresis value for max limit.
  161. Unit: millidegree Celcius
  162. Must be reported as an absolute temperature, NOT a delta
  163. from the max value.
  164. Read/Write value.
  165. temp[1-4]_input Temperature input value.
  166. Unit: millidegree Celcius
  167. Read only value.
  168. temp[1-4]_crit Temperature critical value, typically greater than
  169. corresponding temp_max values.
  170. Unit: millidegree Celcius
  171. Read/Write value.
  172. temp[1-2]_crit_hyst
  173. Temperature hysteresis value for critical limit.
  174. Unit: millidegree Celcius
  175. Must be reported as an absolute temperature, NOT a delta
  176. from the critical value.
  177. Read/Write value.
  178. If there are multiple temperature sensors, temp1_* is
  179. generally the sensor inside the chip itself,
  180. reported as "motherboard temperature". temp2_* to
  181. temp4_* are generally sensors external to the chip
  182. itself, for example the thermal diode inside the CPU or
  183. a thermistor nearby.
  184. ************
  185. * Currents *
  186. ************
  187. Note that no known chip provides current measurements as of writing,
  188. so this part is theoretical, so to say.
  189. curr[1-n]_max Current max value
  190. Unit: milliampere
  191. Read/Write.
  192. curr[1-n]_min Current min value.
  193. Unit: milliampere
  194. Read/Write.
  195. curr[1-n]_input Current input value
  196. Unit: milliampere
  197. Read only.
  198. *********
  199. * Other *
  200. *********
  201. alarms Alarm bitmask.
  202. Read only.
  203. Integer representation of one to four bytes.
  204. A '1' bit means an alarm.
  205. Chips should be programmed for 'comparator' mode so that
  206. the alarm will 'come back' after you read the register
  207. if it is still valid.
  208. Generally a direct representation of a chip's internal
  209. alarm registers; there is no standard for the position
  210. of individual bits.
  211. Bits are defined in kernel/include/sensors.h.
  212. beep_enable Beep/interrupt enable
  213. 0 to disable.
  214. 1 to enable.
  215. Read/Write
  216. beep_mask Bitmask for beep.
  217. Same format as 'alarms' with the same bit locations.
  218. Read/Write
  219. eeprom Raw EEPROM data in binary form.
  220. Read only.