// Copyright 2016 the Go-FUSE Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Mounts ConfigNodeFs for testing purposes. package main import ( "flag" "fmt" "os" "time" ) type change struct { kind string value string } func main() { // Scans the arg list and sets up flags //debug := flag.Bool("debug", false, "print debugging messages.") flag.Parse() if flag.NArg() < 1 { // TODO - where to get program name? fmt.Println("usage: main MOUNTPOINT") os.Exit(2) } mountPoint := flag.Arg(0) monitorBrightness := "100" fanSpeed := "50" configs := map[string]*string{ "monitor/brightness": &monitorBrightness, "fan/throttle": &fanSpeed, } go StartFuse(mountPoint, configs) changechan := make(chan change) go StartPwm(changechan) oldBright := "" oldSpeed := "" for { if oldBright != monitorBrightness { changechan <- change{kind: "monitorBrightness", value: monitorBrightness} oldBright = monitorBrightness } if oldSpeed != fanSpeed { changechan <- change{kind: "fanSpeed", value: fanSpeed} oldSpeed = fanSpeed } fmt.Printf("monitorBrightness:%s fanSpeed: %s\n", monitorBrightness, fanSpeed) time.Sleep(time.Second * 1) } }