Skip to content

Go bindings for libsensors.so from the lm-sensors project via cgo

License

Notifications You must be signed in to change notification settings

md14454/gosensors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gosensors

Go bindings for libsensors.so from the lm-sensors project via cgo.

Example

package main

import (
	"fmt"

	"github.com/md14454/gosensors"
)

func main() {
	gosensors.Init()
	defer gosensors.Cleanup()

	chips := gosensors.GetDetectedChips()

	for i := 0; i < len(chips); i++ {
		chip := chips[i]

		fmt.Printf("%v\n", chip)
		fmt.Printf("Adapter: %v\n", chip.AdapterName())

		features := chip.GetFeatures()

		for j := 0; j < len(features); j++ {
			feature := features[j]

			fmt.Printf("%v ('%v'): %.1f\n", feature.Name, feature.GetLabel(), feature.GetValue())

			subfeatures := feature.GetSubFeatures()

			for k := 0; k < len(subfeatures); k++ {
				subfeature := subfeatures[k]

				fmt.Printf("  %v: %.1f\n", subfeature.Name, subfeature.GetValue())
			}
		}

		fmt.Printf("\n")
	}
}

About

Go bindings for libsensors.so from the lm-sensors project via cgo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages