Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/amenzhinsky/rfkill
- Owner: amenzhinsky
- License: mit
- Created: 2018-07-04T17:45:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-25T20:21:51.000Z (almost 5 years ago)
- Last Synced: 2024-10-27T14:25:44.212Z (19 days ago)
- Topics: golang, linux, rfkill
- Language: Go
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 mainimport (
"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)
}
}
```