From 77a08f86e55a7af5683a628a4d2304d8f2583896 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 6 Sep 2017 21:04:35 +0200 Subject: ... --- cmd/poll/main.go | 5 ++--- redbutton.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/poll/main.go b/cmd/poll/main.go index bb19921..6e2dd10 100644 --- a/cmd/poll/main.go +++ b/cmd/poll/main.go @@ -14,8 +14,7 @@ func main() { } defer dev.Close() - state := redbutton.Poll(dev) - for { - fmt.Println(<-state) + for state := range redbutton.Poll(dev) { + fmt.Println(state) } } diff --git a/redbutton.go b/redbutton.go index 507e720..aa26d6e 100644 --- a/redbutton.go +++ b/redbutton.go @@ -25,7 +25,7 @@ const ( func State(dev *hid.Device) (Button, bool) { buf := make([]byte, 8) - buf[0] = 0x01 + buf[0] = 0x01 // 0x08 ? buf[7] = 0x02 if _, err := dev.Write(buf); err != nil { -- cgit v1.2.3