evdev-trigger

module
v0.0.0-...-949aa5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: Apache-2.0

README

evdev-trigger

evdev-trigger is a command-line tool that triggers commands by input events of evdev (Linux event devices).

  • This will work even if the device is disconnected and reconnected.
  • You can specify the interval between the next execution of the command.

Installation

# clone repository
git clone https://github.com/hareku/evdev-trigger.git
cd evdev-trigger

# build (requires golang and build-essential)
make

# put the built binary to bin path
cp .build/evdev-trigger /usr/local/bin/evdev-trigger

Usage

Create your configuration file like this.

# physical id of device
phys: a1:b2:c3:d4:e5:f6
triggers:
  # Key is the input event code to trigger the command.
  115:
    # Command to execute.
    command: ["echo", "Hello"]
    # Optional, a minimum interval between the next execution of the command.
    # Value must be parsable as Golang time.Duration.
    interval: 3s

And you can start by evdev-trigger --config /etc/evdev-trigger/myconf.yml --debug.

In --debug mode, evdev-trigger displays the device connection status and input events to stdout. If it's not in debug mode, only the results of the command execution will be displayed.

Directories

Path Synopsis
cmd
pkg
evdev/evdevmock
Package evdevmock is a generated GoMock package.
Package evdevmock is a generated GoMock package.
notify/notifymock
Package notifymock is a generated GoMock package.
Package notifymock is a generated GoMock package.
watch/watchmock
Package watchmock is a generated GoMock package.
Package watchmock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL