| Crates.io | sioctl |
| lib.rs | sioctl |
| version | 0.0.2 |
| created_at | 2020-05-02 15:43:11.112201+00 |
| updated_at | 2020-05-28 17:51:33.846022+00 |
| description | An interface for reading the state of sndio controls. |
| homepage | |
| repository | https://github.com/mjkillough/sioctl-rs |
| max_upload_size | |
| id | 236611 |
| size | 25,853 |
An interface for reading the state of sndio controls.
This crate provides a wrapper around the sioctl_open(3) APIs for reading
and watching the state of sndio controls.
An inteface to the defautl sndio device can be opened by
Sioctl::new(). The initial state of controls can be read by calling
Sioctl::controls() and callbacks for subsequent changes can be requested
via Sioctl::watch().
There is currently way to set the value of controls. If this would be useful to you, please feel free to submit a PR.
use sioctl::Sioctl;
fn main() {
let s = Sioctl::new();
// Initial state of all controls.
for control in s.controls() {
println!("{:?}", control);
}
// Watch for changes to all controls:
let mut watcher = s.watch(|control| println!("{:?}", control));
// ...
// When done, call join() to shutdown watching.
watcher.join();
}
A more complete example is available in src/bin/sioctl.rs.
The sndio-sys crate requires libclang.so which is present in the llvm package:
doas pkg_add llvm
MIT