mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: autoport: Add prompt for enabling unsafe inteltool glx option
BUG=None BRANCH=None TEST=None Change-Id: Ib674ab7ca8b6464de553a86536b1762fda98d94e Original-Signed-off-by: Chris Ching <chingcodes@google.com> Original-Reviewed-on: https://review.coreboot.org/14901 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Martin Roth <martinroth@google.com> Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/351789 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
parent
0f0acd053c
commit
b4be0ab09e
1 changed files with 43 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
@ -45,13 +47,52 @@ func RunAndSave(output string, name string, arg ...string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAXPROMPTRETRY = 3
|
||||||
|
|
||||||
|
func PromptUser(prompt string, opts []string) (match string, err error) {
|
||||||
|
for i := 1; i < MAXPROMPTRETRY; i++ {
|
||||||
|
fmt.Println("%s. (%s) Default:%s", prompt, strings.Join(opts, "/"), opts[0])
|
||||||
|
var usrInput string
|
||||||
|
fmt.Scanln(&usrInput)
|
||||||
|
|
||||||
|
// Check for default entry
|
||||||
|
if usrInput == "" {
|
||||||
|
match = opts[0]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
if opt == usrInput {
|
||||||
|
match = opt
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = errors.New("max retries exceeded")
|
||||||
|
fmt.Fprintln(os.Stderr, "ERROR: max retries exceeded")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func MakeLogs(outDir string) {
|
func MakeLogs(outDir string) {
|
||||||
os.MkdirAll(outDir, 0700)
|
os.MkdirAll(outDir, 0700)
|
||||||
RunAndSave(outDir+"/lspci.log", "lspci", "-nnvvvxxxx")
|
RunAndSave(outDir+"/lspci.log", "lspci", "-nnvvvxxxx")
|
||||||
RunAndSave(outDir+"/dmidecode.log", "dmidecode")
|
RunAndSave(outDir+"/dmidecode.log", "dmidecode")
|
||||||
RunAndSave(outDir+"/acpidump.log", "acpidump")
|
RunAndSave(outDir+"/acpidump.log", "acpidump")
|
||||||
/* FIXME:XX */
|
|
||||||
RunAndSave(outDir+"/inteltool.log", "../inteltool/inteltool", "-a")
|
inteltoolArgs := "-a"
|
||||||
|
opt, err := PromptUser("WARNING: The following tool MAY cause your system to hang when it attempts "+
|
||||||
|
"to probe for graphics registers. Having the graphics registers will help create a better port. "+
|
||||||
|
"Should autoport probe these registers?",
|
||||||
|
[]string{"y", "yes", "n", "no"})
|
||||||
|
|
||||||
|
// Continue even if there is an error
|
||||||
|
|
||||||
|
switch opt {
|
||||||
|
case "y", "yes":
|
||||||
|
opt += " -f"
|
||||||
|
}
|
||||||
|
|
||||||
|
RunAndSave(outDir+"/inteltool.log", "../inteltool/inteltool", inteltoolArgs)
|
||||||
RunAndSave(outDir+"/ectool.log", "../ectool/ectool")
|
RunAndSave(outDir+"/ectool.log", "../ectool/ectool")
|
||||||
|
|
||||||
SysDir := "/sys/class/sound/card0/"
|
SysDir := "/sys/class/sound/card0/"
|
||||||
|
|
Loading…
Add table
Reference in a new issue