Add selectUSB and fix error when pressing ESC

This commit is contained in:
HikariKnight 2023-10-27 08:54:46 +02:00
parent e8bac3c741
commit f219f686f6
2 changed files with 100 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package pages
import (
"fmt"
"os"
lsiommu "github.com/HikariKnight/quickpassthrough/internal/lsiommu"
"github.com/HikariKnight/quickpassthrough/pkg/command"
@ -19,11 +20,20 @@ func SelectGPU() {
// Generate a list of choices based on the GPUs and get the users selection
choice := menu.GenIOMMUMenu("Select a GPU to view the IOMMU groups of", gpus)
// View the selected GPU
ViewGPU(choice)
// Parse the choice
switch choice {
case "back":
Welcome()
case "":
// If ESC is pressed
fmt.Println("")
os.Exit(0)
default:
viewGPU(choice)
}
}
func ViewGPU(id string, ext ...int) {
func viewGPU(id string, ext ...int) {
// Clear the screen
command.Clear()
@ -63,10 +73,14 @@ func ViewGPU(id string, ext ...int) {
switch choice {
case "ext":
// Run an extended relative search
ViewGPU(id, 1)
viewGPU(id, 1)
case "n":
// Go back to selecting a gpu
SelectGPU()
case "y":
// Go to the select a usb controller
selectUSB()
}
}