Skip to content

Commit

Permalink
add sleep and a warning for key release
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalBlueberry committed Dec 12, 2020
1 parent 1ccf5c5 commit 32d329e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/chkb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func main() {
Debug("Set debug level")
}

// This is required to ensure that the enter key is not stuck down
// when the device is grab.
log.Info("You have 200 ms to release all keys")
time.Sleep(200 * time.Millisecond)

devs := make([]*evdev.InputDevice, 0)
for _, arg := range flag.Args() {
dev, err := evdev.Open(arg)
Expand Down Expand Up @@ -144,6 +149,7 @@ func capture(dev *evdev.InputDevice, evs chan []chkb.InputEvent) {
if err != nil {
continue
}
log.WithField("event", ev).Debug("Captured")
inputEvents = append(inputEvents, ev)
}
evs <- inputEvents
Expand Down

0 comments on commit 32d329e

Please sign in to comment.