Fail safe, not dead: bound the HID cancel wait, isolate sensor failures, keep the fan worker alive
- hid.py: after a timed-out HID operation, wait at most 1 s for the driver to finish the cancelled IRP; if it does not, mark the channel broken so the caller's reconnect path closes it instead of blocking forever on a wedged device. Keep abandoned OVERLAPPED/buffer references alive until close so a late IRP completion cannot write into reused memory. Check CreateEventW. - telemetry/service.py: read each source (CPU, GPU, system power, GPU memory) independently; a failing source now costs only its own readings instead of the whole sample, logged at most once a minute per source. - sensors.py: the Commander PRO iCUE ownership check runs inside a guard; if ownership cannot be established the device is released rather than risking swapped replies (and the failure no longer escapes into the sample). - cooling/control.py: an unexpected exception no longer ends fan control for the life of the process; fail safe, log at most once a minute, retry with a fresh sensor object after 5 s. failsafe() no longer raises, and control errors back off 5 s instead of re-opening the device every second.
This commit is contained in:
1 parent
7356809c0a
commit
d637d46777
5 files changed
+102
-26
No files matched your search
@@ -691,16 +691,22 @@ class CommanderPro:
|
||||
now = time.monotonic()
|
||||
if now >= self._next_check:
|
||||
self._next_check = now + self.RECHECK
|
||||
if self._corsair_software_running():
|
||||
self.close()
|
||||
self._say("iCUE is running, leaving the device to it")
|
||||
elif self.ch is None:
|
||||
try:
|
||||
self._open()
|
||||
self._say(f"reading {len(self.ports)} fans (ports {', '.join(str(p + 1) for p in self.ports)})")
|
||||
except Exception as e:
|
||||
try:
|
||||
if self._corsair_software_running():
|
||||
self.close()
|
||||
self._say(f"unavailable ({e})")
|
||||
self._say("iCUE is running, leaving the device to it")
|
||||
elif self.ch is None:
|
||||
try:
|
||||
self._open()
|
||||
self._say(f"reading {len(self.ports)} fans (ports {', '.join(str(p + 1) for p in self.ports)})")
|
||||
except Exception as e:
|
||||
self.close()
|
||||
self._say(f"unavailable ({e})")
|
||||
except Exception as e:
|
||||
# Ownership cannot be established (e.g. process enumeration failed): give the
|
||||
# device up rather than risk swapped replies, and retry on the next check.
|
||||
self.close()
|
||||
self._say(f"ownership check failed ({e}); device released, retrying in {self.RECHECK:.0f} s")
|
||||
if self.ch is not None:
|
||||
try:
|
||||
for p in self.ports:
|
||||
|
||||
Reference in new issue
Block a user