From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Philippe Coval <rzr@gna.org>
Cc: bernhard.bender@bytecmed.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org,
Philippe Coval <philippe.coval@open.eurogiciel.org>
Subject: Re: [PATCH v3] usbtouchscreen: add option for inverting X or Y axis
Date: Mon, 27 Jul 2015 15:28:23 -0700 [thread overview]
Message-ID: <20150727222823.GF3613@dtor-ws> (raw)
In-Reply-To: <1438035361-9157-1-git-send-email-rzr@gna.org>
On Tue, Jul 28, 2015 at 12:16:01AM +0200, Philippe Coval wrote:
> Invert Y is needed (together with swap XY) for some touchscreens,
> at least for some of them :
>
> - CarTft 8in4 (type=eGalax, USB=0eef:0001)
> - LeadingTouch
>
> Since there is not guarantee that
> those above devices will all behave the same,
> it's safer to configure them userland using udev rules.
>
> This way is safer than hardcoding options per "recognized" model,
> and possible regressions will be avoided in a first place.
Does the following still work?
Thanks.
--
Dmitry
Input: usbtouchscreen - add option for inverting X or Y axis
From: Philippe Coval <rzr@gna.org>
Invert Y is needed (together with swap XY) for some touchscreens,
at least for some of them:
- CarTft 8in4 (type=eGalax, USB=0eef:0001)
- LeadingTouch
Since there is not guarantee that those above devices will all behave the
same, it's safer to configure them from userland using udev rules.
This way is safer than hard-coding options per "recognized" model,
and possible regressions will be avoided in a first place.
Credits-to: Ondrej Zary <linux@rainbow-software.org>
Link: https://lkml.org/lkml/2015/6/7/191
Bug-Link: https://bugs.tizen.org/jira/browse/TC-2522
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/usbtouchscreen.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 2c41107..d283077 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -64,6 +64,14 @@ static bool swap_xy;
module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
+static bool invert_x;
+module_param(invert_x, bool, 0644);
+MODULE_PARM_DESC(invert_x, "Invert X axis.");
+
+static bool invert_y;
+module_param(invert_y, bool, 0644);
+MODULE_PARM_DESC(invert_y, "Invert Y axis.");
+
static bool hwcalib_xy;
module_param(hwcalib_xy, bool, 0644);
MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
@@ -1312,13 +1320,16 @@ static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
- if (swap_xy) {
- input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
- input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
- } else {
- input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
- input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
- }
+ if (swap_xy)
+ swap(usbtouch->y, usbtouch->x);
+ if (invert_x)
+ usbtouch->x = type->max_xc - usbtouch->x + type->min_xc;
+ if (invert_y)
+ usbtouch->y = type->max_yc - usbtouch->y + type->min_yc;
+
+ input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
+ input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
+
if (type->max_press)
input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press);
input_sync(usbtouch->input);
next prev parent reply other threads:[~2015-07-27 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 23:38 [PATCH] usbtouchscreen: adds support for inverting X or Y axis (or both) Philippe Coval
2015-07-13 10:15 ` [PATCH v2] " Philippe Coval
2015-07-13 10:28 ` Bastien Nocera
2015-07-13 10:41 ` Philippe Coval
2015-07-27 22:16 ` [PATCH v3] usbtouchscreen: add option for inverting X or Y axis Philippe Coval
2015-07-27 22:28 ` Dmitry Torokhov [this message]
2015-10-09 22:21 ` Philippe Coval
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=20150727222823.GF3613@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=bernhard.bender@bytecmed.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philippe.coval@open.eurogiciel.org \
--cc=rzr@gna.org \
/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).