server: adapt UVC ctrl length from host
This commit is contained in:
parent
83f2aac696
commit
6a76be3c38
@ -359,6 +359,9 @@ fn handle_setup(
|
||||
};
|
||||
let selector = (req.w_value >> 8) as u8;
|
||||
let is_in = (req.b_request_type & USB_DIR_IN) != 0;
|
||||
if matches!(selector, UVC_VS_PROBE_CONTROL | UVC_VS_COMMIT_CONTROL) {
|
||||
maybe_update_ctrl_len(state, req.w_length, debug);
|
||||
}
|
||||
let interface = map_interface(interface_raw, selector, interfaces, debug);
|
||||
|
||||
if !is_in && req.b_request == UVC_SET_CUR {
|
||||
@ -425,6 +428,25 @@ fn map_interface(raw: u8, selector: u8, interfaces: UvcInterfaces, debug: bool)
|
||||
mapped
|
||||
}
|
||||
|
||||
fn maybe_update_ctrl_len(state: &mut UvcState, w_length: u16, debug: bool) {
|
||||
let want = w_length as usize;
|
||||
if !(want == STREAM_CTRL_SIZE_11 || want == STREAM_CTRL_SIZE_15) {
|
||||
return;
|
||||
}
|
||||
if state.ctrl_len == want {
|
||||
return;
|
||||
}
|
||||
|
||||
state.ctrl_len = want;
|
||||
state.default = build_streaming_control(&state.cfg, state.ctrl_len);
|
||||
state.probe = state.default;
|
||||
state.commit = state.default;
|
||||
|
||||
if debug {
|
||||
eprintln!("[lesavka-uvc] ctrl_len set to {}", state.ctrl_len);
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_data(
|
||||
state: &mut UvcState,
|
||||
pending: &mut Option<PendingRequest>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user