Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1182695 > unrolled thread
| Started by | Philippe Coval <rzr@gna.org> |
|---|---|
| First post | 2015-07-13 12:20 +0200 |
| Last post | 2015-07-13 12:50 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) Philippe Coval <rzr@gna.org> - 2015-07-13 12:20 +0200
Re: [PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) Bastien Nocera <hadess@hadess.net> - 2015-07-13 12:30 +0200
Re: [PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) Philippe Coval <philippe.coval@open.eurogiciel.org> - 2015-07-13 12:50 +0200
| From | Philippe Coval <rzr@gna.org> |
|---|---|
| Date | 2015-07-13 12:20 +0200 |
| Subject | [PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) |
| Message-ID | <pLJ06-3Nq-11@gated-at.bofh.it> |
Invert Y is needed (together with swap XY) for some touchscreens :
- LeadingTouch screens (at least for some of them)
- CarTft 8in4 (USB ID=0eef:0001)
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Bug-Link: https://bugs.tizen.org/jira/browse/TC-2522
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
---
ChangeLog:
* v1: Initial version from me :
Rebased on v4.1.0-rc6
https://lkml.org/lkml/2015/6/7/191
Note it is based on Ondrej Zary's patch (2007):
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg136266.html
Test demo on tizen cartft 8inch4 :
https://www.youtube.com/watch?v=4L9Bjfy8oDM
* v2: Use bool not int for options variables
Rebased on v4.2-rc2
Latest unmerged version can be picked from :
https://github.com/rzr/linux/tree/for-upstream
drivers/input/touchscreen/usbtouchscreen.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index f2c6c35..af7e6f3 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -63,6 +63,12 @@
static bool swap_xy;
module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
+static int invert_x;
+module_param(invert_x, bool, 0644);
+MODULE_PARM_DESC(invert_x, "Invert X axis.");
+static int 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);
@@ -1303,6 +1309,7 @@ static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
unsigned char *pkt, int len)
{
struct usbtouch_device_info *type = usbtouch->type;
+ int x, y;
if (!type->read_data(usbtouch, pkt))
return;
@@ -1310,12 +1317,20 @@ 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);
+ x = usbtouch->y;
+ y = usbtouch->x;
} else {
- input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
- input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
+ x = usbtouch->x;
+ y = usbtouch->y;
}
+ if (invert_x)
+ x = type->max_xc - x + type->min_xc;
+ if (invert_y)
+ y = type->max_yc - y + type->min_yc;
+
+ input_report_abs(usbtouch->input, ABS_X, x);
+ input_report_abs(usbtouch->input, ABS_Y, y);
+
if (type->max_press)
input_report_abs(usbtouch->input, ABS_PRESSURE, usbtouch->press);
input_sync(usbtouch->input);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Bastien Nocera <hadess@hadess.net> |
|---|---|
| Date | 2015-07-13 12:30 +0200 |
| Subject | Re: [PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) |
| Message-ID | <pLJ9M-3QH-27@gated-at.bofh.it> |
| In reply to | #1182695 |
On Mon, 2015-07-13 at 12:15 +0200, Philippe Coval wrote: > Invert Y is needed (together with swap XY) for some touchscreens : > - LeadingTouch screens (at least for some of them) > - CarTft 8in4 (USB ID=0eef:0001) Wouldn't it be useful to force those settings for touchscreen devices which you can detect? That would make it work out-of-the-box on those devices. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Philippe Coval <philippe.coval@open.eurogiciel.org> |
|---|---|
| Date | 2015-07-13 12:50 +0200 |
| Subject | Re: [PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both) |
| Message-ID | <pLJt8-3Xa-3@gated-at.bofh.it> |
| In reply to | #1182704 |
[Multipart message — attachments visible in raw view] — view raw
On 07/13/2015 12:28 PM, Bastien Nocera wrote:
> On Mon, 2015-07-13 at 12:15 +0200, Philippe Coval wrote:
>> Invert Y is needed (together with swap XY) for some touchscreens :
>> - LeadingTouch screens (at least for some of them)
>> - CarTft 8in4 (USB ID=0eef:0001)
>
> Wouldn't it be useful to force those settings for touchscreen devices
> which you can detect? That would make it work out-of-the-box on those
> devices.
>
Hi,
That's what I am doing, but userland (using udev rules),
since I am really unsure we can rely on USB id...
For now, I don't think it's a good idea to force any behaviour,
that can cause regressions on other ones.
In a longer term, it would be good to keep a list of all those screens
and see what should be the prefered behaviour per identification.
Note, I don't have any screen anymore.
Thanks for feedback
--
mailto:philippe.coval@eurogiciel.fr -- gpg:0x467094BC
xmpp:philippe.coval.pro@gmail.com
https://dockr.eurogiciel.fr/blogs/embedded/author/pcl/
.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web