Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amenzhinsky/rfkill

Goland client for rfkill
https://github.com/amenzhinsky/rfkill

golang linux rfkill

Last synced: 2 days ago
JSON representation

Goland client for rfkill

Awesome Lists containing this project

README

        

# rfkill

A golang client for [rfkill](https://github.com/torvalds/linux/blob/master/Documentation/rfkill.txt). It supports reading available rfkill devices, subscribing to events and blocking/unblocking devices.

## Documentation

Detailed API documentation can be found [here](https://godoc.org/github.com/amenzhinsky/rfkill).

## Usage

```go
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)
}
}
```