Message ID | 20230510-feature-ts_virtobj_patch-v2-2-f68a6bfe7a0f@wolfvision.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Input: support virtual objects on touchscreens | expand |
On 15/05/2023 17:00, Javier Carrasco wrote: > The virtual-touchscreen object defines an area within the touchscreen > where touch events are reported and their coordinates get converted to > the virtual origin. This object avoids getting events from areas that > are physically hidden by overlay frames. > > For touchscreens where overlay buttons on the touchscreen surface are > provided, the virtual-buttons object contains a node for every button > and the key event that should be reported when pressed. > > Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> > --- Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On 16/05/2023 10:10, Krzysztof Kozlowski wrote: > On 15/05/2023 17:00, Javier Carrasco wrote: >> The virtual-touchscreen object defines an area within the touchscreen >> where touch events are reported and their coordinates get converted to >> the virtual origin. This object avoids getting events from areas that >> are physically hidden by overlay frames. >> >> For touchscreens where overlay buttons on the touchscreen surface are >> provided, the virtual-buttons object contains a node for every button >> and the key event that should be reported when pressed. >> >> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> >> --- > > > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Apologies, second thoughts - why calling all this binding and properties "virtual"? That's the word which immediately raises questions, because bindings are only for real things, not virtual. Touchscreen is just clipped, not virtual, so maybe "clipped-area" instead of virtual-touchscreen? Buttons are real, so maybe just "buttons"? Best regards, Krzysztof
On 16.05.23 10:13, Krzysztof Kozlowski wrote: > On 16/05/2023 10:10, Krzysztof Kozlowski wrote: >> On 15/05/2023 17:00, Javier Carrasco wrote: >>> The virtual-touchscreen object defines an area within the touchscreen >>> where touch events are reported and their coordinates get converted to >>> the virtual origin. This object avoids getting events from areas that >>> are physically hidden by overlay frames. >>> >>> For touchscreens where overlay buttons on the touchscreen surface are >>> provided, the virtual-buttons object contains a node for every button >>> and the key event that should be reported when pressed. >>> >>> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> >>> --- >> >> >> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > Apologies, second thoughts - why calling all this binding and properties > "virtual"? That's the word which immediately raises questions, because > bindings are only for real things, not virtual. > > Touchscreen is just clipped, not virtual, so maybe "clipped-area" > instead of virtual-touchscreen? Buttons are real, so maybe just "buttons"? > > Best regards, > Krzysztof > I guess it is a matter of perspective. For a user the buttons and the clipped area are 100% real, but for a driver developer they are virtual in the sense that there is not an "active" hardware behind apart from the original touchscreen. I just wanted to avoid misunderstandings when implementing this feature for other drivers. One might wonder if the touchscreen now has mechanical keys attached to it. With the "virtual-" prefix it is clear that the objects are not additional pieces of hardware or extensions of the touchscreen functionality. For the virtual-touchscreen your point is stronger because there is indeed a real touchscreen hardware no matter the area you define, but my approach was keeping homogeneous names for the different objects in case some new ones might appear in the future: every object that gets on top of the touchscreen area is virtual, so add a new object type and name it virtual-xxx. I have nothing against about doing some renaming and I will do it if it is required, but with the documentation I think it is now more clear what everything means and in the end it might make more sense for the drivers so they can differentiate between real and virtual devices.
On 16/05/2023 11:03, Javier Carrasco wrote: > On 16.05.23 10:13, Krzysztof Kozlowski wrote: >> On 16/05/2023 10:10, Krzysztof Kozlowski wrote: >>> On 15/05/2023 17:00, Javier Carrasco wrote: >>>> The virtual-touchscreen object defines an area within the touchscreen >>>> where touch events are reported and their coordinates get converted to >>>> the virtual origin. This object avoids getting events from areas that >>>> are physically hidden by overlay frames. >>>> >>>> For touchscreens where overlay buttons on the touchscreen surface are >>>> provided, the virtual-buttons object contains a node for every button >>>> and the key event that should be reported when pressed. >>>> >>>> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> >>>> --- >>> >>> >>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> >> Apologies, second thoughts - why calling all this binding and properties >> "virtual"? That's the word which immediately raises questions, because >> bindings are only for real things, not virtual. >> >> Touchscreen is just clipped, not virtual, so maybe "clipped-area" >> instead of virtual-touchscreen? Buttons are real, so maybe just "buttons"? >> >> Best regards, >> Krzysztof >> > I guess it is a matter of perspective. For a user the buttons and the > clipped area are 100% real, but for a driver developer they are virtual > in the sense that there is not an "active" hardware behind apart from > the original touchscreen. The feature describes the hardware, not driver. To understand what does it mean, look from hardware point of view - does it have some virtual area or clipped area? > > I just wanted to avoid misunderstandings when implementing this feature > for other drivers. One might wonder if the touchscreen now has > mechanical keys attached to it. With the "virtual-" prefix it is clear > that the objects are not additional pieces of hardware or extensions of > the touchscreen functionality. But what if actual physical buttons are added there? You still would have clipped/virtual area, just without virtual buttons. > > For the virtual-touchscreen your point is stronger because there is > indeed a real touchscreen hardware no matter the area you define, but my > approach was keeping homogeneous names for the different objects in case > some new ones might appear in the future: every object that gets on top > of the touchscreen area is virtual, so add a new object type and name it > virtual-xxx. To me, word "virtual" suggests something which does not exist. Kind of something abstracted or symbolic. Opposite to "real". Here all this really exists. You have physical stickers on the touchscreen. Maybe this should be then "dedicated"? or "isolated"? Or just "overlay-area"? > > I have nothing against about doing some renaming and I will do it if it > is required, but with the documentation I think it is now more clear > what everything means and in the end it might make more sense for the > drivers so they can differentiate between real and virtual devices. Best regards, Krzysztof
On 17.05.23 10:59, Krzysztof Kozlowski wrote: > On 16/05/2023 11:03, Javier Carrasco wrote: >> On 16.05.23 10:13, Krzysztof Kozlowski wrote: >>> On 16/05/2023 10:10, Krzysztof Kozlowski wrote: >>>> On 15/05/2023 17:00, Javier Carrasco wrote: >>>>> The virtual-touchscreen object defines an area within the touchscreen >>>>> where touch events are reported and their coordinates get converted to >>>>> the virtual origin. This object avoids getting events from areas that >>>>> are physically hidden by overlay frames. >>>>> >>>>> For touchscreens where overlay buttons on the touchscreen surface are >>>>> provided, the virtual-buttons object contains a node for every button >>>>> and the key event that should be reported when pressed. >>>>> >>>>> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> >>>>> --- >>>> >>>> >>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >>> >>> Apologies, second thoughts - why calling all this binding and properties >>> "virtual"? That's the word which immediately raises questions, because >>> bindings are only for real things, not virtual. >>> >>> Touchscreen is just clipped, not virtual, so maybe "clipped-area" >>> instead of virtual-touchscreen? Buttons are real, so maybe just "buttons"? >>> >>> Best regards, >>> Krzysztof >>> >> I guess it is a matter of perspective. For a user the buttons and the >> clipped area are 100% real, but for a driver developer they are virtual >> in the sense that there is not an "active" hardware behind apart from >> the original touchscreen. > > > The feature describes the hardware, not driver. To understand what does > it mean, look from hardware point of view - does it have some virtual > area or clipped area? > >> >> I just wanted to avoid misunderstandings when implementing this feature >> for other drivers. One might wonder if the touchscreen now has >> mechanical keys attached to it. With the "virtual-" prefix it is clear >> that the objects are not additional pieces of hardware or extensions of >> the touchscreen functionality. > > But what if actual physical buttons are added there? You still would > have clipped/virtual area, just without virtual buttons. > >> >> For the virtual-touchscreen your point is stronger because there is >> indeed a real touchscreen hardware no matter the area you define, but my >> approach was keeping homogeneous names for the different objects in case >> some new ones might appear in the future: every object that gets on top >> of the touchscreen area is virtual, so add a new object type and name it >> virtual-xxx. > > To me, word "virtual" suggests something which does not exist. Kind of > something abstracted or symbolic. Opposite to "real". Here all this > really exists. You have physical stickers on the touchscreen. > > Maybe this should be then "dedicated"? or "isolated"? > > Or just "overlay-area"? > >> >> I have nothing against about doing some renaming and I will do it if it >> is required, but with the documentation I think it is now more clear >> what everything means and in the end it might make more sense for the >> drivers so they can differentiate between real and virtual devices. > > Best regards, > Krzysztof > I think the word "overlay" is more precise and does not lead to any misunderstanding, so I will rename everything to xxx-overlay and overlay-xxx in the code and the documentation if that is ok. virtual-buttons -> overlay-buttons ts_virtobj_xxx()->ts_overlay_xxx() etc.
diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml index 895592da9626..866bfb45a8cf 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml @@ -80,6 +80,145 @@ properties: touchscreen-y-plate-ohms: description: Resistance of the Y-plate in Ohms + virtual-touchscreen: + description: Clipped touchscreen area + + This object can be used to describe a frame that restricts the area + within touch events are reported, ignoring the events that occur outside + this area. This is of special interest if the touchscreen is shipped + with a physical overlay on top of it with a frame that hides some part + of the original touchscreen area. + + The x-origin and y-origin properties of this object define the offset of + a new origin from where the touchscreen events are referenced. + This offset is applied to the events accordingly. The x-size and y-size + properties define the size of the virtual-touchscreen (effective area). + + The following example shows the new touchscreen area and the new origin + (0',0') for the touch events generated by the device. + + Touchscreen (full area) + ┌────────────────────────────────────────┐ + │ ┌───────────────────────────────┐ │ + │ │ │ │ + │ ├ y-size │ │ + │ │ │ │ + │ │ virtual-touchscreen │ │ + │ │ │ │ + │ │ │ │ + │ │ x-size │ │ + │ ┌└──────────────┴────────────────┘ │ + │(0',0') │ + ┌└────────────────────────────────────────┘ + (0,0) + + where (0',0') = (0+x-origin,0+y-origin) + + type: object + + properties: + x-origin: + description: horizontal origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + virtual-buttons: + description: list of nodes defining the buttons on the touchscreen + + This object can be used to describe buttons on the touchscreen area, + reporting the touch events on their surface as key events instead of + the original touch events. + + This is of special interest if the touchscreen is shipped with a + physical overlay on top of it where a number of buttons with some + predefined functionality are printed. In that case a specific behavior + is expected from those buttons instead of raw touch events. + + The virtual-buttons properties define a per-button area as well as an + origin relative to the real touchscreen origin. Touch events within the + button area are reported as the key event defined in the linux,code + property. Given that the key events do not provide coordinates, the + button origin is only used to place the button area on the touchscreen + surface. Any event outside the virtual-buttons object is reported as a + touch event with no coordinate transformation. + + The following example shows a touchscreen with a single button on it + + Touchscreen (full area) + ┌───────────────────────────────────┐ + │ │ + │ │ + │ ┌─────────┐ │ + │ │button 0 │ │ + │ │KEY_POWER│ │ + │ └─────────┘ │ + │ │ + │ │ + ┌└───────────────────────────────────┘ + (0,0) + + The virtual-buttons object can be combined with the virtual-touchscreen + object as shown in the following example. In that case only the events + within the virtual-touchscreen object are reported as touch events. + + Touchscreen (full area) + ┌─────────┬──────────────────────────────┐ + │ │ │ + │ │ ┌───────────────────────┐ │ + │ button 0│ │ │ │ + │KEY_POWER│ │ │ │ + │ │ │ │ │ + ├─────────┤ │ virtual-touchscreen │ │ + │ │ │ │ │ + │ │ │ │ │ + │ button 1│ │ │ │ + │ KEY_INFO│ ┌└───────────────────────┘ │ + │ │(0',0') │ + ┌└─────────┴──────────────────────────────┘ + (0,0) + + type: object + + patternProperties: + '^button-': + type: object + description: + Each button (key) is represented as a sub-node. + + properties: + label: + $ref: /schemas/types.yaml#/definitions/string + description: descriptive name of the button + + linux,code: true + + x-origin: + description: horizontal origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + dependencies: touchscreen-size-x: [ touchscreen-size-y ] touchscreen-size-y: [ touchscreen-size-x ]
The virtual-touchscreen object defines an area within the touchscreen where touch events are reported and their coordinates get converted to the virtual origin. This object avoids getting events from areas that are physically hidden by overlay frames. For touchscreens where overlay buttons on the touchscreen surface are provided, the virtual-buttons object contains a node for every button and the key event that should be reported when pressed. Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> --- .../bindings/input/touchscreen/touchscreen.yaml | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+)