linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: "Leutwein Tobias (BEG/ENC1)" <Tobias.Leutwein@de.bosch.com>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	Peter Hutterer <peter.hutterer@who-t.net>
Subject: Re: [RFC] linux-input alps - loosing precision
Date: Tue, 21 Jan 2020 13:34:41 -0800	[thread overview]
Message-ID: <20200121213441.GO47797@dtor-ws> (raw)
In-Reply-To: <20200117094206.xu47p6ybxmsf5ne2@pali>

Hi Pali,

On Fri, Jan 17, 2020 at 10:42:06AM +0100, Pali Rohár wrote:
> On Thursday 09 January 2020 14:26:16 Leutwein Tobias (BEG/ENC1) wrote:
> > Hello,
> > 
> > At the file
> > https://github.com/torvalds/linux/blob/master/drivers/input/mouse/alps.c
> > I've seen that values coming from the trackpoint/trackstick are divided at some devices, which results in a loss of precision.
> > 
> > As I was not lucky with the behavior of the trackpoint of my computer I've made a fork of libinput https://gitlab.freedesktop.org/leutwe/libinput/tree/master/
> > where I changed  src/filter-trackpoint.c . With this change, the values from lib evdev are multiplied by a factor (dpToFac_au16 []). The array element used from dpToFac_au16 [] is also the value received by evdev.
> > 
> > At higher forces I use a factor much higher than 1, so the undivided value from the device would be the best for me.
> > 
> > In order not to change the behavior for other users, it might be possible to change the divider at runtime via the sys- file system - like it is at trackpoint.c and take the currently used divider as default value.
> > 
> > Positions at source code were I see the division:
> > 
> > alps_process_trackstick_packet_v3()
> > /*
> > * The x and y values tend to be quite large, and when used
> > * alone the trackstick is difficult to use. Scale them down
> > * to compensate.
> > */
> > x /= 8;
> > y /= 8;
> > 
> > alps_process_packet_v6()
> > /* Divide 4 since trackpoint's speed is too fast */ input_report_rel(dev2, REL_X, (char)x / 4); input_report_rel(dev2, REL_Y, -((char)y / 4));
> 
> Hello Dmitry!
> 
> This problem is about fact that alps.c for some ALPS devices already
> truncate precision of trackpoint movement.
> 
> Tobias is unhappy with this fact and would like to get all bits of
> movement information, not just some high.
> 
> But existing userspace application expects that for these devices kernel
> already truncate precision and process truncated data from kernel.
> 
> Now question is: Are we able to send to userspace input data without
> doing truncation and without breaking existing applications?
> 
> It looks like that for such thing we need some userspace <--> kernel API
> which disable truncating of precision.
> 
> Have you been solving similar issue for other other drivers or in other
> area of input code?

Unfortunately I do not think we can automatically "recover" the lost
precision without help of libinput, which would need to tweak the
trackpoint [sysfs] property letting kernel know that it should send
original data.

I'm adding Peter to hear his take on this.

Thanks.

-- 
Dmitry

  reply	other threads:[~2020-01-21 21:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 14:26 [RFC] linux-input alps Leutwein Tobias (BEG/ENC1)
2020-01-17  9:42 ` [RFC] linux-input alps - loosing precision Pali Rohár
2020-01-21 21:34   ` dmitry.torokhov [this message]
2020-01-21 23:35     ` Peter Hutterer
2020-01-22  1:04       ` dmitry.torokhov
2020-01-23  4:05         ` Peter Hutterer
2020-01-23  9:25           ` Leutwein Tobias (BEG/ENC1)
2020-01-24  4:24             ` Peter Hutterer

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=20200121213441.GO47797@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=Tobias.Leutwein@de.bosch.com \
    --cc=linux-input@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=peter.hutterer@who-t.net \
    /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).