server: default UVC control to nonblocking
This commit is contained in:
parent
d8b0d739a5
commit
dccc6601b1
@ -120,6 +120,8 @@ fn main() -> Result<()> {
|
||||
);
|
||||
|
||||
let debug = env::var("LESAVKA_UVC_DEBUG").is_ok();
|
||||
let nonblock = env::var("LESAVKA_UVC_BLOCKING").is_err();
|
||||
eprintln!("[lesavka-uvc] nonblock={}", if nonblock { 1 } else { 0 });
|
||||
let mut setup_seen: u64 = 0;
|
||||
let mut data_seen: u64 = 0;
|
||||
let mut dq_err_seen: u64 = 0;
|
||||
@ -302,10 +304,11 @@ fn read_interface(path: &str) -> Option<u8> {
|
||||
}
|
||||
|
||||
fn open_with_retry(path: &str) -> Result<std::fs::File> {
|
||||
let nonblock = env::var("LESAVKA_UVC_BLOCKING").is_err();
|
||||
for attempt in 1..=200 {
|
||||
let mut opts = OpenOptions::new();
|
||||
opts.read(true).write(true);
|
||||
if env::var("LESAVKA_UVC_NONBLOCK").is_ok() {
|
||||
if nonblock {
|
||||
opts.custom_flags(libc::O_NONBLOCK);
|
||||
}
|
||||
match opts.open(path) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user