[coreboot-gerrit] New patch to review for coreboot: 088ebaf autoport: Improve keyboard detection.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Sat May 30 00:04:51 CEST 2015


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10376

-gerrit

commit 088ebaf841467149b5955f1014cf8bb2714fb5a0
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Fri May 29 23:53:37 2015 +0200

    autoport: Improve keyboard detection.
    
    Previously I tried to see if Linux think that port 0x60 is in use by keyboard.
    Unfortunately it always thinks that it is. Instead just base off real input
    busses used.
    
    Change-Id: I4bb744938f623d29f38396165a1694fee78c3d32
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 util/autoport/ec_fixme.go   |  2 +-
 util/autoport/log_maker.go  | 19 +++++++++++++++++++
 util/autoport/log_reader.go | 16 ++++++++++++++++
 util/autoport/main.go       |  1 +
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/util/autoport/ec_fixme.go b/util/autoport/ec_fixme.go
index d7dff52..850998d 100644
--- a/util/autoport/ec_fixme.go
+++ b/util/autoport/ec_fixme.go
@@ -6,7 +6,7 @@ func FIXMEEC(ctx Context) {
 	ap := Create(ctx, "acpi/platform.asl")
 	defer ap.Close()
 
-	hasKeyboard := IsIOPortUsedBy(ctx, 0x60, "keyboard")
+	hasKeyboard := ctx.InfoSource.HasPS2()
 
 	sbGPE := GuessECGPE(ctx)
 	var GPEUnsure bool
diff --git a/util/autoport/log_maker.go b/util/autoport/log_maker.go
index fccc452..3f36963 100644
--- a/util/autoport/log_maker.go
+++ b/util/autoport/log_maker.go
@@ -103,4 +103,23 @@ func MakeLogs(outDir string) {
 		defer out.Close()
 		io.Copy(out, in)
 	}
+
+	out, err := os.Create(outDir + "/input_bustypes.log")
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer out.Close()
+
+	ClassInputDir := "/sys/class/input/"
+	files, _ = ioutil.ReadDir(ClassInputDir)
+	for _, f := range files {
+		if strings.HasPrefix(f.Name(), "input") && !f.Mode().IsRegular() { /* Allow both dirs and symlinks.  */
+			in, err := os.Open(ClassInputDir + f.Name() + "/id/bustype")
+			defer in.Close()
+			if err != nil {
+				log.Fatal(err)
+			}
+			io.Copy(out, in)
+		}
+	}
 }
diff --git a/util/autoport/log_reader.go b/util/autoport/log_reader.go
index 58f1182..c94d182 100644
--- a/util/autoport/log_reader.go
+++ b/util/autoport/log_reader.go
@@ -359,6 +359,22 @@ func (l *LogDevReader) GetCPUModel() (ret []uint32) {
 	return
 }
 
+func (l *LogDevReader) HasPS2() bool {
+	file, err := os.Open(l.InputDirectory + "/input_bustypes.log")
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer file.Close()
+	scanner := bufio.NewScanner(file)
+	for scanner.Scan() {
+		line := scanner.Text()
+		if strings.Index(line, "0011") >= 0 {
+			return true
+		}
+	}
+	return false
+}
+
 var FlagLogInput = flag.String("input_log", ".", "Input log directory")
 var FlagLogMkLogs = flag.Bool("make_logs", false, "Dump logs")
 
diff --git a/util/autoport/main.go b/util/autoport/main.go
index c25e565..f38346c 100644
--- a/util/autoport/main.go
+++ b/util/autoport/main.go
@@ -59,6 +59,7 @@ type DevReader interface {
 	GetCPUModel() []uint32
 	GetEC() []byte
 	GetIOPorts() []IOPorts
+	HasPS2() bool
 }
 
 type IOPorts struct {



More information about the coreboot-gerrit mailing list