This repository was archived by the owner on May 3, 2026. It is now read-only.
Commit d5df344
committed
fix: prevent GPU-not-found crash when switching to hybrid mode
Two related bugs caused envycontrol to crash with 'Could not find Nvidia
GPU' even when switching to a mode that doesn't need the GPU visible:
1. get_current_mode() required BOTH the blacklist file AND the udev
removal rule to report 'integrated'. If only the udev rule existed
(e.g. after a partial or interrupted previous switch), the function
returned 'hybrid', misleading the CachedConfig adapter.
Fix: any single EnvyControl-specific integrated-mode file is now
sufficient to report integrated mode, since all three paths
(/etc/modprobe.d/blacklist-nvidia.conf,
/etc/udev/rules.d/50-remove-nvidia.rules,
/lib/udev/rules.d/50-remove-nvidia.rules)
are written exclusively by envycontrol for that mode.
2. CachedConfig.adapter() called create_cache_file() whenever the
current mode was detected as hybrid, including when the requested
switch target was also hybrid. create_cache_file() calls
get_nvidia_gpu_pci_bus() which parses lspci output; if a stale udev
removal rule was hiding the NVIDIA device the function called
sys.exit(1), aborting before cleanup() ever ran.
Fix: skip cache creation when the target switch is 'hybrid', since
hybrid mode never consumes the cached PCI bus value.1 parent 87f94af commit d5df344
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
717 | 721 | | |
718 | 722 | | |
719 | 723 | | |
720 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
721 | 727 | | |
722 | 728 | | |
723 | 729 | | |
| |||
0 commit comments