linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: Siarhei Vishniakou <svv@google.com>
Cc: dmitry.torokhov@gmail.com, rydberg@bitmath.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH] Document the units for resolution of size axes
Date: Fri, 20 May 2022 11:00:29 -0500	[thread overview]
Message-ID: <20220520160029.GA49889@nixie71> (raw)
In-Reply-To: <20220520084514.3451193-1-svv@google.com>

Hi Siarhei,

On Fri, May 20, 2022 at 01:45:14AM -0700, Siarhei Vishniakou wrote:
> Today, the resolution of size axes is not documented. As a result, it's
> not clear what the canonical interpretation of this value should be. On
> Android, there is a need to calculate the size of the touch ellipse in
> physical units (millimeters).
> 
> After reviewing linux source, it turned out that most of the existing
> usages are already interpreting this value as "units/mm". This
> documentation will make it explicit. This will help device
> implementations with correctly following the linux specs, and will
> ensure that the devices will work on Android without needing further
> customized parameters for scaling of major/minor values.
> 
> Signed-off-by: Siarhei Vishniakou <svv@google.com>
> Change-Id: I4a2de9e6d02e5fd707e5d312f5c3325734266a6e
> ---
>  include/uapi/linux/input.h | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index ee3127461ee0..328cf545c029 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -78,10 +78,13 @@ struct input_id {
>   * Note that input core does not clamp reported values to the
>   * [minimum, maximum] limits, such task is left to userspace.
>   *
> - * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z)
> - * is reported in units per millimeter (units/mm), resolution
> - * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported
> - * in units per radian.
> + * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z,
> + * ABS_MT_POSITION_X, ABS_MT_POSITION_Y) is reported in units
> + * per millimeter (units/mm), resolution for rotational axes
> + * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
> + * The resolution for the size axes (ABS_MT_TOUCH_MAJOR,
> + * ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MAJOR, ABS_MT_WIDTH_MINOR)
> + * is reported in units per millimeter (units/mm).
>   * When INPUT_PROP_ACCELEROMETER is set the resolution changes.
>   * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in
>   * units per g (units/g) and in units per degree per second
> -- 
> 2.36.1.124.g0e6072fb45-goog
> 

Thanks for raising this point; it's a valid one. However, I'm not
convinced this is the right approach.

On all the controllers I've worked on, ABS_X and ABS_Y are mapped
to arbitrary resolution values that don't necessarily map to real-
world units. I don't think we can make any assumption at the input
layer as to the physical size of the touch surface.

It is the same problem for ABS_MT_PRESSURE; the values are typically
controller-specific and we can't reasonably try to map this axis to
any standard unit (e.g. Pascals).

If user space needs to understand the mapping between axis range and
physical size, maybe it is better to adopt the approach from the IIO
subsystem wherein the input_dev offers a property that maps each axis
(i.e. "raw" value) to some SI unit?

In that case, dts could define the scaling factor between raw values
and physical dimensions. At any rate, that is just my $.02.

Kind regards,
Jeff LaBundy

  reply	other threads:[~2022-05-20 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20  8:45 [PATCH] Document the units for resolution of size axes Siarhei Vishniakou
2022-05-20 16:00 ` Jeff LaBundy [this message]
2022-05-24 16:53   ` Siarhei Vishniakou
2022-05-27 22:36     ` Jeff LaBundy
2022-07-08 19:08       ` Siarhei Vishniakou
2022-07-09  5:02 ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220520160029.GA49889@nixie71 \
    --to=jeff@labundy.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=svv@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).