Re: [PATCH 1/3] input: add event codes for user programmable switch events

From: Dmitry Torokhov
Date: Wed Aug 10 2022 - 18:33:41 EST


Hi Caleb,

On Mon, May 16, 2022 at 02:22:57PM +0000, Caleb Connolly wrote:
> Add SW_PROG{1,2,3,4} for device switches which are handled by userspace.
>
> This can be used for devices with "generic" switches which are intended
> to be user-programmable, for example OnePlus phones contain a tri-state
> key which can be used for switching between mute/vibrate/ring, or
> programmed by the user to perform any arbitrary actions.
>
> These are analogous to the keys KEY_PROG{1,2,3,4} found on some
> keyboards.

This has been proposed a few times but this goes against the spirit of
the input subsystem where each key or switch has a defined [default]
purpose and userspace is normally expected to act upon input events
without paying attention to what device they actually are coming from.
IOW if you want to deal with particular GPIO signals you are better off
using GPIO subsystem.

In this context adding KEY_PROG1-4 was actually a mistake and we should
try not extend it further.

As fas as modeling the sliders with multiple settings goes I'd look into
ABS events, probably ABS_MISC, with a set of values.

Thanks.

--
Dmitry