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 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 { if debug {
@ -376,9 +384,6 @@ fn handle_setup(
return; return;
} }
*pending = Some(PendingRequest { interface, selector }); *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 { if debug {
eprintln!( eprintln!(
"[lesavka-uvc] SET_CUR queued len={} iface={} sel={}", "[lesavka-uvc] SET_CUR queued len={} iface={} sel={}",
@ -452,6 +457,8 @@ fn maybe_update_ctrl_len(state: &mut UvcState, w_length: u16, debug: bool) {
} }
fn handle_data( fn handle_data(
fd: i32,
uvc_send_response: libc::c_ulong,
state: &mut UvcState, state: &mut UvcState,
pending: &mut Option<PendingRequest>, pending: &mut Option<PendingRequest>,
interfaces: UvcInterfaces, interfaces: UvcInterfaces,
@ -507,6 +514,7 @@ fn handle_data(
); );
} }
} }
let _ = send_response(fd, uvc_send_response, &[]);
} }
} }