# `InputEvent`
[🔗](https://github.com/nerves-web-kiosk/input_event/blob/v1.4.2/lib/input_event.ex#L1)

Elixir interface to Linux input event devices

# `code`

```elixir
@type code() :: atom() | code_number()
```

Event code

Usually these are translated to an atom that corresponds with the Linux event code.
Event codes depend on the event type.

# `code_number`

```elixir
@type code_number() :: 0..65535
```

# `event`

```elixir
@type event() :: {type(), code(), value()}
```

Event structure

# `events_message`

```elixir
@type events_message() :: {:input_event, String.t(), [event()]}
```

Message that is sent to the caller when input event received

# `options`

```elixir
@type options() :: [
  path: String.t(),
  grab: boolean(),
  receiver: pid() | atom(),
  repeat_delay: pos_integer(),
  repeat_period: pos_integer()
]
```

Options for the InputEvent Genserver

# `type`

```elixir
@type type() :: type_name() | type_number()
```

Event type

Usually these are translated to an atom that corresponds with the Linux event type.

# `type_name`

```elixir
@type type_name() ::
  :ev_syn
  | :ev_key
  | :ev_rel
  | :ev_abs
  | :ev_msc
  | :ev_sw
  | :ev_led
  | :ev_snd
  | :ev_rep
  | :ev_ff
  | :ev_pwr
  | :ev_ff_status
```

The type of event

# `type_number`

```elixir
@type type_number() :: 0..65535
```

An unknown event type

# `value`

```elixir
@type value() :: integer()
```

Event value

See the event type and code for how to interpret the value. For example, it could be a
0 or 1 signifying a key press or release, or it could be an x or y coordinate or delta.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `enumerate`

```elixir
@spec enumerate() :: [{String.t(), InputEvent.Info.t()}]
```

Scan the system for input devices and return information on each one.

# `info`

```elixir
@spec info(GenServer.server()) :: InputEvent.Info.t()
```

Return information about this input event device

# `start_link`

```elixir
@spec start_link(String.t() | options()) :: GenServer.on_start()
```

Start a GenServer that reports events from the specified input event device

Options:
* `:path` - the path to the input event device (e.g., `"/dev/input/event0"`)
* `:grab` - set to true to prevent events from being passed to other applications (defaults to `false`)
* `:repeat_delay` - delay in milliseconds before a key press repeats
* `:repeat_period` - period in milliseconds in which a key press will repeat
* `:receiver` - the pid or name of the process that receives events (defaults to the process that calls `start_link/1`

Note that passing the device path rather than a keyword list to
`start_link/1` is deprecated.

When adjusting the key repeat rate, you must set BOTH `:repeat_delay` and
`:repeat_period` for `input_event` to make the change. Be careful setting
repeat timing in multiple places on the same device path! You might override
your own settings!

# `stop`

```elixir
@spec stop(GenServer.server()) :: :ok
```

Stop the InputEvent GenServer.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
