Re: [RFC PATCH 1/2] dt-bindings: input: gpio-keys: enforce node names to match all properties
From: Jeff LaBundy
Date: Sun Jun 05 2022 - 12:28:35 EST
Hi Krzysztof,
On Sun, Jun 05, 2022 at 05:12:42PM +0200, Krzysztof Kozlowski wrote:
> On 04/06/2022 05:04, Jeff LaBundy wrote:
> >> - dependencies:
> >> - wakeup-event-action: [ wakeup-source ]
> >> - linux,input-value: [ gpios ]
> >> -
> >> - unevaluatedProperties: false
> >> + "^(key|key-[a-z0-9-]+|[a-z0-9-]+-key)$":
> >
> > Maybe this would be better as:
> >
> > "^((key|switch|axis)|(key|switch|axis)-[a-z0-9-]+|[a-z0-9-]+-(key|switch|axis))$":
> >
> > ...or perhaps a more efficient version of my counter-proposal.
> >
> > The reason is because it is confusing to see a lid or dock switch named
> > as "key-lid", etc.
>
> Nice point. "switch" I understand, but can you really have "axis" on
> GPIO keys? I had impression axis is related to joysticks.
I do not think it is very common, but technically we can use gpio-keys
to create coarse sliders as follows:
- linux,code = ABS_X (or ABS_Y, etc.)
- linux,input-type = EV_ABS
- linux,input-value = 0, 10, 20...
Trying to encode all possible values for linux,input-type (EV_*) in the
pattern is not reasonable, so maybe a compromise would be to use 'event'
in place of 'key|switch' because events are what we are ultimately trying
to describe here.
That being said, these are special cases and I don't feel strongly against
simply using 'key|switch' for now as those are by far the most common use-
cases. Another compromise is 'key|switch|event', with 'event' available as
a catch-all for these special cases.
>
>
> Best regards,
> Krzysztof
Kind regards,
Jeff LaBundy