utils

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SensorPath = "/sys/class/hwmon"

Variables

This section is empty.

Functions

func FindSensorPath added in v0.7.0

func FindSensorPath(name, label string) (string, error)

Searches all directories under SensorPath, following symbolic links, for an hwmonX/name file whose contents matches name and a *_input file whose corresponding *_label file matches label. Returns the full path to the matching *_input file containing the sensor data, or an error if no match was was found.

func GetSensorValue

func GetSensorValue(sensor string) (int64, error)

Returns the sensor value in its raw form as exposed by the /sys file system. For example, with the Intel Core i9-12900k, the temperature will be returned as an integer value in degrees Celcius. Fractional parts of the temperature (if supported by the CPU) will require conversion. Simply put, if the temperature is 20.5 degrees Celcius, the value returned by this function will be 20500.

The sensor string must be a valid full path to the sensor:

  • /sys/class/hwmon/hwmon1/temp1_input

Any error that prevents reading the value will be returned.

func ReadSensorValue

func ReadSensorValue(value int64) float64

Converts a value returned by GetSensorValue into a float64 temperature in degrees Celcius.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL