From 5f38467e238dbf1a5b1cd63fda1eb275f921c36c Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Sun, 9 Apr 2023 19:11:30 +0200 Subject: [PATCH] Move disableVFIOVideo into its own file --- internal/configs/config_vfio_video.go | 11 +++++++++++ internal/ui_main_functions.go | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 internal/configs/config_vfio_video.go diff --git a/internal/configs/config_vfio_video.go b/internal/configs/config_vfio_video.go new file mode 100644 index 0000000..f99f04b --- /dev/null +++ b/internal/configs/config_vfio_video.go @@ -0,0 +1,11 @@ +package configs + +import "github.com/HikariKnight/quickpassthrough/pkg/fileio" + +func DisableVFIOVideo() { + // Get the config + config := GetConfig() + + // Add to the kernel arguments that we want to disable VFIO video output on the host + fileio.AppendContent(" vfio_pci.disable_vga=1", config.Path.CMDLINE) +} diff --git a/internal/ui_main_functions.go b/internal/ui_main_functions.go index d51685e..3c4e37d 100644 --- a/internal/ui_main_functions.go +++ b/internal/ui_main_functions.go @@ -4,7 +4,6 @@ import ( "regexp" "github.com/HikariKnight/quickpassthrough/internal/configs" - "github.com/HikariKnight/quickpassthrough/pkg/fileio" ) // This function processes the enter event @@ -69,7 +68,7 @@ func (m *model) processSelection() bool { // If user selected yes then if selectedItem.(item).title == "YES" { // Add disable VFIO video to the config - m.disableVFIOVideo() + configs.DisableVFIOVideo() } // Get the device ids for the selected gpu using ls-iommu @@ -97,11 +96,3 @@ func (m *model) processSelection() bool { // Return false as we are not done return false } - -func (m *model) disableVFIOVideo() { - // Get the config - config := configs.GetConfig() - - // Add to the kernel arguments that we want to disable VFIO video output on the host - fileio.AppendContent(" vfio_pci.disable_vga=1", config.Path.CMDLINE) -}