diff --git a/README.md b/README.md index 60afdf5..f19baf5 100644 --- a/README.md +++ b/README.md @@ -161,8 +161,8 @@ fans: - id: cpu # The type of fan configuration, one of: hwmon | file hwmon: - # The platform of the controller which is - # connected to this fan (see sensor.platform below) + # A regex matching a controller platform displayed by `fan2go detect`, f.ex.: + # "nouveau", "coretemp", "it8620", "corsaircpro-*" etc. platform: nct6798 # The channel of this fan's RPM sensor as displayed by `fan2go detect` rpmChannel: 1 diff --git a/internal/hwmon/hwmon.go b/internal/hwmon/hwmon.go index 18172df..01e92d1 100644 --- a/internal/hwmon/hwmon.go +++ b/internal/hwmon/hwmon.go @@ -3,7 +3,7 @@ package hwmon import ( "fmt" "github.com/markusressel/fan2go/internal/ui" - "io/ioutil" + "os" "path" "path/filepath" "regexp" @@ -80,7 +80,7 @@ func GetChips() []*HwMonController { // getDeviceName read the name of a device func getDeviceName(devicePath string) string { namePath := path.Join(devicePath, "name") - content, _ := ioutil.ReadFile(namePath) + content, _ := os.ReadFile(namePath) name := string(content) return strings.TrimSpace(name) } @@ -88,14 +88,14 @@ func getDeviceName(devicePath string) string { // getDeviceModalias read the modalias of a device func getDeviceModalias(devicePath string) string { modaliasPath := path.Join(devicePath, "device", "modalias") - content, _ := ioutil.ReadFile(modaliasPath) + content, _ := os.ReadFile(modaliasPath) return strings.TrimSpace(string(content)) } // getDeviceType read the type of a device func getDeviceType(devicePath string) string { modaliasPath := path.Join(devicePath, "device", "type") - content, _ := ioutil.ReadFile(modaliasPath) + content, _ := os.ReadFile(modaliasPath) return strings.TrimSpace(string(content)) } @@ -238,7 +238,7 @@ func containsSubFeature(s []gosensors.SubFeature, e gosensors.SubFeatureType) bo // getLabel read the label of a feature func getLabel(devicePath string, featureName string) string { labelPath := path.Join(devicePath, featureName) + "_label" - content, _ := ioutil.ReadFile(labelPath) + content, _ := os.ReadFile(labelPath) label := string(content) if len(label) <= 0 { return path.Join(path.Base(devicePath), featureName)