From 8fb2268aced11f748f4aeeaec01b6eb41d2f9b9b Mon Sep 17 00:00:00 2001 From: hadelan Date: Sat, 12 Sep 2026 13:56:36 +0800 Subject: [PATCH] tof: back off before reopening the head IMU after a read failure A read failure fell straight back into open_imu: a chip that answers its ID but cannot stream was reopened in a tight loop, warning each time, on the bus the audio codec shares. Same backoff as the open-failure path, which the module docs always claimed. --- tof/src/imu.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tof/src/imu.rs b/tof/src/imu.rs index 85e588f6..325ab6a6 100644 --- a/tof/src/imu.rs +++ b/tof/src/imu.rs @@ -185,6 +185,12 @@ pub fn imu_loop( sleep_unless_shutdown(period - elapsed, shutdown); } } + + // A read failure fell straight back into `open_imu`: a chip that answers its ID but + // cannot stream was reopened in a tight loop, warning each time, on the bus the audio + // codec shares. Same backoff as the open-failure path above. + sleep_unless_shutdown(backoff, shutdown); + backoff = (backoff * 2).min(RETRY_MAX); } }