diff --git a/src/device/input/input.go b/src/device/input/input.go index f1dfd15..c3ca210 100644 --- a/src/device/input/input.go +++ b/src/device/input/input.go @@ -14,6 +14,7 @@ type Input interface { func New(ctx context.Context) Input { src := raw.New(ctx) - parser := button.New(ctx, src) - return wrap.New(ctx, parser) + return wrap.New(ctx, func() button.Parser { + return button.New(ctx, src) + }) } diff --git a/src/device/input/wrap/wrap.go b/src/device/input/wrap/wrap.go index 3d1c82f..582fa79 100644 --- a/src/device/input/wrap/wrap.go +++ b/src/device/input/wrap/wrap.go @@ -12,9 +12,9 @@ type Wrap interface { Close() } -func New(ctx context.Context, src button.Parser) Wrap { +func New(ctx context.Context, srcFunc func() button.Parser) Wrap { maker := func() Wrap { - return src + return srcFunc() } if os.Getenv("WRAP_BUFFERED") == "true" { oldMaker := maker