usbhubd: trace SetPortReset result + wait_for_reset boundaries (diagnostic)

Log SetPortFeature(PORT_RESET) result, wait_for_reset's first fetch,
and its completion/timeout outcomes at info level to pinpoint where
hub port-reset polling stalls in QEMU.
This commit is contained in:
Red Bear OS
2026-07-19 18:38:03 +09:00
parent 5164417f56
commit ef34223201
2 changed files with 9 additions and 3 deletions
+6 -3
View File
@@ -578,9 +578,12 @@ fn main() {
// then 50ms TRSTRCY recovery and C_PORT_RESET clear.
if !snap.enabled {
log::info!("reset port {port}");
if let Err(e) = set_feature(&handle, port, usb::HubPortFeature::PortReset) {
log::warn!("usbhubd: SetPortReset failed for port {}: {}", port, e);
continue;
match set_feature(&handle, port, usb::HubPortFeature::PortReset) {
Ok(()) => log::info!("HUBFLOW {port}: PortReset set ok"),
Err(e) => {
log::warn!("usbhubd: SetPortReset failed for port {}: {}", port, e);
continue;
}
}
state.ensure_attached(false);
if let Err(e) = port_ops::wait_for_reset(
+3
View File
@@ -183,18 +183,21 @@ pub fn wait_for_reset<E>(
let mut delay = HUB_SHORT_RESET_TIME_MS;
let mut cur = fetch().map_err(WaitError::Io)?;
log::info!("HUBFLOW wait_for_reset: first fetch resetting={} connected={}", cur.resetting, cur.connected);
loop {
if !cur.resetting && cur.connected {
sleep(RESET_RECOVERY_TIME_MS);
if cur.reset_changed {
clear_reset_change().map_err(WaitError::Io)?;
}
log::info!("HUBFLOW wait_for_reset: complete after {}ms", total_ms);
return Ok(cur);
}
if !cur.connected {
return Err(WaitError::Disconnected);
}
if total_ms >= HUB_RESET_TIMEOUT_MS {
log::info!("HUBFLOW wait_for_reset: timeout, still resetting={}", cur.resetting);
return Err(WaitError::Timeout);
}
sleep(delay);