From 37d02f0f52bd0ef7b1ae69ed913568177132e47a Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 23 Mar 2023 21:05:30 -0600 Subject: [PATCH] debugs --- src/device/input/keyboard.go | 4 ++++ src/main.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/device/input/keyboard.go b/src/device/input/keyboard.go index d6b3c1f..3c9cfc2 100644 --- a/src/device/input/keyboard.go +++ b/src/device/input/keyboard.go @@ -2,6 +2,7 @@ package input import ( "io" + "log" "os" "os/exec" "runtime" @@ -60,5 +61,8 @@ func (kb Keyboard) Read() []Button { down = true } } + if os.Getenv("DEBUG") == "true" { + log.Printf("input.Keyboard.Read() %s => %+v", b[:n], result) + } return result } diff --git a/src/main.go b/src/main.go index 05a967f..657d20c 100644 --- a/src/main.go +++ b/src/main.go @@ -2,6 +2,7 @@ package src import ( "context" + "log" "mayhem-party/src/device/input" "mayhem-party/src/device/output" "mayhem-party/src/device/output/key" @@ -37,6 +38,9 @@ func Main(ctx context.Context) error { state := map[key.Key]bool{} for block() { delta := reader.Read() + if os.Getenv("DEBUG") == "true" { + log.Printf("src.Main.reader.Read(): %+v", delta) + } for _, button := range delta { state[key.FromChar(button.Char)] = button.Down }