Commit ede358b
authored
fix(fan-curve): keep the firmware watchdog alive at a steady temperature (#36)
* fix(fan-curve): keep the watchdog alive at a steady temperature
The firmware watchdog is one-shot: it counts down from the last fan
command and hands the fan back to thinkpad_acpi when it reaches zero.
arm_fan_watchdog() was called only inside the 'level changed' branch,
which reads as correct but inverts the actual risk -- a curve sitting at
a steady temperature issues no fan commands at all.
So roughly 30s after the temperature settled, the firmware silently
reclaimed the fan. last_level still matched the target, so nothing ever
rewrote it, and the UI went on emitting fan-curve-update every 2s showing
the curve as active. The failure is invisible and the steady state is the
common case, not an edge case.
Re-arms on a timer at half the watchdog interval, which leaves a full
loop tick of slack so one delayed iteration cannot lose the fan. Cleared
alongside last_level wherever the curve stops steering, so re-enabling
arms immediately rather than inheriting a stale deadline.
Verified by mutation: forcing watchdog_due() to false reproduces the old
behaviour and both tests fail, one reporting 30s without a re-arm.
* fix(fan-curve): say when a computed level was not applied
The update event carried only fan_level, taken from
last_level.unwrap_or(target_level). When every write fails -- no helper
installed, /proc/acpi/ibm/fan not writable -- last_level stays None and
the event reported the level the curve *wanted*, byte-identical to one it
had actually set.
The fan-curve-error toast fires once, guarded by permission_error_reported,
and is easy to miss or dismiss. After that the panel looked correct
indefinitely while the curve had never touched the fan.
Adds a controlling flag alongside the level. The panel appends
"(not applied)" and tints the figure when it is false. Compared with
=== false so an event without the field still reads as controlling.1 parent 4973219 commit ede358b
3 files changed
Lines changed: 122 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
252 | 268 | | |
253 | 269 | | |
254 | 270 | | |
| |||
334 | 350 | | |
335 | 351 | | |
336 | 352 | | |
| 353 | + | |
337 | 354 | | |
338 | 355 | | |
339 | 356 | | |
| |||
359 | 376 | | |
360 | 377 | | |
361 | 378 | | |
| 379 | + | |
362 | 380 | | |
363 | 381 | | |
364 | 382 | | |
| |||
380 | 398 | | |
381 | 399 | | |
382 | 400 | | |
| 401 | + | |
383 | 402 | | |
384 | 403 | | |
385 | 404 | | |
| |||
408 | 427 | | |
409 | 428 | | |
410 | 429 | | |
| 430 | + | |
411 | 431 | | |
412 | 432 | | |
413 | 433 | | |
| |||
425 | 445 | | |
426 | 446 | | |
427 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
428 | 453 | | |
429 | 454 | | |
430 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
431 | 463 | | |
432 | 464 | | |
433 | 465 | | |
434 | 466 | | |
435 | 467 | | |
436 | 468 | | |
437 | 469 | | |
| 470 | + | |
438 | 471 | | |
439 | 472 | | |
440 | 473 | | |
| |||
446 | 479 | | |
447 | 480 | | |
448 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
449 | 553 | | |
450 | 554 | | |
451 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
624 | 631 | | |
625 | 632 | | |
626 | 633 | | |
| |||
0 commit comments