# Copyright 2023 Google LLC # SPDX-License-Identifier: Apache-2.0 description: | Input longpress pseudo-device Listens for key events as an input and produces key events as output corresponding to short and long press. Can be optionally be associated to a specific device to listen for events only from that device. Example configuration: #include longpress { input = <&buttons>; compatible = "zephyr,input-longpress"; input-codes = , ; short-codes = , ; long-codes = , ; long-delay-ms = <1000>; }; Example output: # short press input event: dev=buttons SYN type= 1 code= 11 value=1 # INPUT_KEY_0 press # release before one second input event: dev=buttons SYN type= 1 code= 11 value=0 # INPUT_KEY_0 release input event: dev=longpress SYN type= 1 code= 30 value=1 # INPUT_KEY_A press input event: dev=longpress SYN type= 1 code= 30 value=0 # INPUT_KEY_A release # long press input event: dev=buttons SYN type= 1 code= 11 value=1 # INPUT_KEY_0 press # hold for more than one second input event: dev=longpress SYN type= 1 code= 45 value=1 # INPUT_KEY_X press # wait for release input event: dev=buttons SYN type= 1 code= 11 value=0 # INPUT_KEY_0 release input event: dev=longpress SYN type= 1 code= 45 value=0 # INPUT_KEY_X release compatible: "zephyr,input-longpress" properties: input: type: phandle description: | Input device phandle, if not specified listen for input from all devices. input-codes: type: array required: true description: | Array of input event key codes (INPUT_KEY_* or INPUT_BTN_*). short-codes: type: array description: | Optional array of key codes to be generated for short press (INPUT_KEY_* or INPUT_BTN_*). long-codes: type: array required: true description: | Array of key codes to be generated for long press (INPUT_KEY_* or INPUT_BTN_*). long-delay-ms: type: int required: true description: Time delay to register a long press in milliseconds.