Skip to content

Instantly share code, notes, and snippets.

@michelesr
Created March 19, 2022 21:11
Show Gist options
  • Save michelesr/dfa8630848405af3e242ce4912565b7f to your computer and use it in GitHub Desktop.
Save michelesr/dfa8630848405af3e242ce4912565b7f to your computer and use it in GitHub Desktop.
Turn NVIDIA discrete card on
#!/bin/bash
set -ex
CONTROLLER_BUS_ID=0000:00:01.0
DEVICE_BUS_ID=0000:01:00.0
sudo tee /sys/bus/pci/devices/${CONTROLLER_BUS_ID}/power/control <<<on
sleep 1
sudo tee /sys/bus/pci/rescan <<<1
sleep 1
sudo tee /sys/bus/pci/devices/${DEVICE_BUS_ID}/power/control <<<auto
sudo tee /sys/bus/pci/devices/${CONTROLLER_BUS_ID}/power/control <<<auto
sudo modprobe nvidia
# modeset:Enable atomic kernel modesetting (1 = enable, 0 = disable (default)) (bool)
sudo modprobe nvidia_drm modeset=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment