repositorypackage
0.1.0
Repository: https://github.com/amenzhinsky/rfkill.git
Documentation: pkg.go.dev
# README
rfkill
A golang client for rfkill. It supports reading available rfkill devices, subscribing to events and blocking/unblocking devices.
Documentation
Detailed API documentation can be found here.
Usage
package main
import (
"fmt"
"os"
"github.com/amenzhinsky/rfkill"
)
func main() {
if err := rfkill.Each(func(ev rfkill.Event) error {
if ev.Soft == 0 {
return nil
}
name, err := rfkill.NameByIdx(ev.Idx)
if err != nil {
return err
}
fmt.Printf("unblocking: %s\n", name)
return rfkill.BlockByIdx(ev.Idx, false)
}); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(1)
}
}