Compare commits

..

No commits in common. "129b508123e1bb2b7f32618e498f923611c9ea39" and "67cddf6a999838c689bc76ce9dd7ad85d6863986" have entirely different histories.

2 changed files with 5 additions and 20 deletions

View File

@ -96,13 +96,7 @@ case "${1:-}" in
;;
esac
cleanup() {
if [[ -n ${LESAVKA_ALLOW_GADGET_RESET:-} ]]; then
LESAVKA_DETACH_CLEAR_UDC=1 detach_gadget
else
detach_gadget
fi
}
cleanup() { echo "" >"$G/UDC" 2>/dev/null || true; }
DISABLE_UAC=${LESAVKA_DISABLE_UAC:-}
DISABLE_UVC=${LESAVKA_DISABLE_UVC:-}
@ -192,17 +186,6 @@ fi
[[ -n $UDC ]] || { log "❌ UDC not present after manual bind"; exit 1; }
log "✅ UDC detected: $UDC"
# Guard against lockups: if the gadget is already bound, don't reset unless forced.
BOUND_UDC=""
if [[ -r $G/UDC ]]; then
BOUND_UDC=$(cat "$G/UDC" 2>/dev/null || true)
fi
if [[ -n $BOUND_UDC && -z ${LESAVKA_ALLOW_GADGET_RESET:-} ]]; then
log "🔒 gadget already bound to '$BOUND_UDC' - refusing reset."
log " Set LESAVKA_ALLOW_GADGET_RESET=1 to force."
exit 0
fi
# Guard against lockups: don't reset gadget while host is attached unless forced.
UDC_STATE="$(udc_state "$UDC")"
if [[ -z ${LESAVKA_ALLOW_GADGET_RESET:-} ]] && is_attached_state "$UDC_STATE"; then

View File

@ -384,6 +384,9 @@ fn handle_setup(
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={}",
@ -522,8 +525,7 @@ fn handle_data(
);
}
}
// ACK the OUT transfer after we've processed the payload.
let _ = send_response(fd, uvc_send_response, &[]);
// No extra response required; ep0 data stage completion ends the control transfer.
}
}