Crate lookit[−][src]
Expand description
The “Lookit!” crate checks for new devices in a cross-platform asynchronous
manner. Returns the RawFd
equivalent for the target platform.
- Linux: inotify on /dev/*
- Web: JavaScript event listeners
- Others: TODO
Getting Started
async fn run() {
let mut lookit = Lookit::with_input().expect("no /dev/ access?");
loop {
dbg!((&mut lookit).await);
}
}
pasts::block_on(run());
Implementation
Input
- inotify => /dev/input/event*
- window.addEventListener(“gamepadconnected”, function(e) { });
Audio
- inotify => /dev/snd/pcm*
- navigator.mediaDevices.getUserMedia(constraints).then(function(s) { }).catch(function(denied_err) {}) // only one speakers connection ever
MIDI
- inotify => /dev/snd/midi*, if no /dev/snd then /dev/midi*
- https://developer.mozilla.org/en-US/docs/Web/API/MIDIAccess
Camera
- inotify => /dev/video*
- navigator.mediaDevices.getUserMedia(constraints).then(function(s) { }).catch(function(denied_err) {})