Re: [PATCH v3 1/4] Input: ts-overlay - Add touchscreen overlay object handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Javier,

On Wed, Jun 28, 2023 at 08:44:51AM +0200, Javier Carrasco wrote:

[...]

> >>>> +static const char *const ts_overlay_names[] = {
> >>>> +	[TOUCHSCREEN] = "overlay-touchscreen",
> >>>
> >>> I'm a little confused why we need new code for this particular function; it's
> >>> what touchscreen-min-x/y and touchscreen-size-x/y were meant to define. Why
> >>> can't we keep using those?
> >>>
> >> According to the bindings, touchscreen-min-x/y define the minimum
> >> reported values, but the overlay-touchscreen is actually setting a new
> >> origin. Therefore I might be misusing those properties. On the other
> >> hand touchscreen-size-x/y would make more sense, but I also considered
> >> the case where someone would like to describe the real size of the
> >> touchscreen outside of the overlay node as well as the clipped size
> >> inside the node. In that case using the same property twice would be
> >> confusing.
> >> So in the end I thought that the origin/size properties are more precise
> >> and applicable for all objects and not only the overlay touchscreen.
> >> These properties are needed for the buttons anyways and in the future
> >> more overlay would use the same properties.
> > 
> > Ah, I understand now. touchscreen-min-x/y define the lower limits of the axes
> > reported to input but they don't move the origin. I'm aligned with the reason
> > to introduce this function.
> > 
> > This does beg the question as to whether we need two separate types of children
> > and related parsing code. Can we not simply have one overlay definition, and
> > make the decision as to whether we are dealing with a border or virtual button
> > based on whether 'linux,code' is present?
> > 
> A single overlay definition would be possible, but in case more objects
> are added in the future, looking for single properties and then deciding
> what object it is might get messy pretty fast. You could end up needing
> a decision tree and the definition in the DT would get more complex.
> 
> Now the decision tree is straightforward (linux,code -> button), but
> that might not always be the case. In the current implementation there
> are well-defined objects and adding a new one will never affect the
> parsing of the rest.
> Therefore I would like to keep it more readable and easily extendable.

As a potential customer of this feature, I'm ultimately looking to describe
the hardware as succinctly as possible. Currently we have two overlay types,
a border and button(s). The former will never have linux,code defined, while
the latter will. From my naive perspective, it seems redundant to define the
overlay types differently when their properties imply the difference already.

Ultimately it seems we are simply dealing with generic "segments" scattered
throughout a larger touch surface. These segments start to look something
like the following:

struct touch_segment {
	unsigned int x_origin;
	unsigned int y_origin;
	unsigned int x_size;
	unsigned int y_size;
	unsigned int code;
};

You then have one exported function akin to touchscreen_parse_properties() that
simply walks the parent device looking for children named "touch-segment-0",
"touch-segment-1", etc. and parses the five properties, with the fifth (keycode)
being optional.

And then, you have one last exported function akin to touchscreen_report_pos()
that processes the touch coordinates. If the coordinates are in a given segment
and segment->code == KEY_RESERVED (i.e. linux,code was never given), then this
function simply passes the shifted coordinates to touchscreen_report_pos().

If however segment->code != KEY_RESERVED, it calls input_report_key() based on
whether the coordinates are within the segment. If this simplified solution
shrinks the code enough, it may even make sense to keep it in touchscreen.c
which this new feature is so tightly coupled to anyway.

I'm sure the devil is in the details however, and I understand the value in
future-proofing. Can you help me understand a potential future case where this
simplified view would break, and the existing definitions would be better?

Kind regards,
Jeff LaBundy



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux