uvc: send SET_CUR response after data

This commit is contained in:
Brad Stein 2026-01-07 02:56:27 -03:00
parent cb024953f1
commit 1b9a0f7ee2

View File

@ -215,7 +215,15 @@ fn main() -> Result<()> {
data.length
);
}
handle_data(&mut state, &mut pending, interfaces, data, debug);
handle_data(
fd,
uvc_send_response,
&mut state,
&mut pending,
interfaces,
data,
debug,
);
}
_ => {
if debug {
@ -370,18 +378,15 @@ fn handle_setup(
}
let interface = map_interface(interface_raw, selector, interfaces, debug);
if !is_in && req.b_request == UVC_SET_CUR {
if interface != interfaces.streaming {
let _ = send_stall(fd, uvc_send_response);
return;
}
*pending = Some(PendingRequest { interface, selector });
let len = req.w_length as usize;
let payload = vec![0u8; len.min(UVC_DATA_SIZE)];
let _ = send_response(fd, uvc_send_response, &payload);
if debug {
eprintln!(
"[lesavka-uvc] SET_CUR queued len={} iface={} sel={}",
if !is_in && req.b_request == UVC_SET_CUR {
if interface != interfaces.streaming {
let _ = send_stall(fd, uvc_send_response);
return;
}
*pending = Some(PendingRequest { interface, selector });
if debug {
eprintln!(
"[lesavka-uvc] SET_CUR queued len={} iface={} sel={}",
req.w_length, interface, selector
);
}
@ -452,6 +457,8 @@ fn maybe_update_ctrl_len(state: &mut UvcState, w_length: u16, debug: bool) {
}
fn handle_data(
fd: i32,
uvc_send_response: libc::c_ulong,
state: &mut UvcState,
pending: &mut Option<PendingRequest>,
interfaces: UvcInterfaces,
@ -507,6 +514,7 @@ fn handle_data(
);
}
}
let _ = send_response(fd, uvc_send_response, &[]);
}
}