From: Dan Streetman <ddstreet-EkmVulN54Sk@public.gmane.org>
To: Vojtech Pavlik <vojtech-AlSwsSmVLrQ@public.gmane.org>,
Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
daniel.ritz-OI3hZJvNYWs@public.gmane.org
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] add module parameter to provide hardware-calibrated coordinate data for MicroTouch/3M touchscreens
Date: Mon, 24 Nov 2008 09:57:46 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.1.10.0811240944520.4090@floyd.root.cx> (raw)
Ping, in case my last email didn't go through.
Vojtech and Greg, is this patch ok?
------
This patch adds a module parameter to report either the raw coordinate data or
the hardware-calibrated coordinate data. The default is set to the raw
coordinates for backwards compatibilty.
Signed-off-by: Dan Streetman <ddstreet-EkmVulN54Sk@public.gmane.org>
--- a/drivers/input/touchscreen/usbtouchscreen.c 2008-11-17 10:51:30.000000000 -0500
+++ b/drivers/input/touchscreen/usbtouchscreen.c 2008-11-17 10:51:45.000000000 -0500
@@ -60,6 +60,10 @@ static int swap_xy;
module_param(swap_xy, bool, 0644);
MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
+static int hwcalib_xy = 0;
+module_param(hwcalib_xy, bool, 0644);
+MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
+
/* device specifc data/functions */
struct usbtouch_usb;
struct usbtouch_device_info {
@@ -260,8 +264,13 @@ static int panjit_read_data(struct usbto
static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
- dev->x = (pkt[8] << 8) | pkt[7];
- dev->y = (pkt[10] << 8) | pkt[9];
+ if (hwcalib_xy) {
+ dev->x = (pkt[4] << 8) | pkt[3];
+ dev->y = 0xffff - ((pkt[6] << 8) | pkt[5]); // Invert Y
+ } else {
+ dev->x = (pkt[8] << 8) | pkt[7];
+ dev->y = (pkt[10] << 8) | pkt[9];
+ }
dev->touch = (pkt[2] & 0x40) ? 1 : 0;
return 1;
@@ -294,6 +303,12 @@ static int mtouch_init(struct usbtouch_u
return ret;
}
+ // Default min/max xy are the raw values, override if using hw-calib
+ if (hwcalib_xy) {
+ input_set_abs_params(usbtouch->input, ABS_X, 0, 0xffff, 0, 0);
+ input_set_abs_params(usbtouch->input, ABS_Y, 0, 0xffff, 0, 0);
+ }
+
return 0;
}
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2008-11-24 14:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 14:57 Dan Streetman [this message]
[not found] ` <alpine.LNX.1.10.0811240944520.4090-ah6mVDs4vN4u9rY2yWxFjw@public.gmane.org>
2008-11-25 15:27 ` [patch] add module parameter to provide hardware-calibrated coordinate data for MicroTouch/3M touchscreens Jiri Kosina
-- strict thread matches above, loose matches on Subject: below --
2008-11-25 16:29 Dan Streetman
2008-12-02 19:35 ` Dan Streetman
[not found] ` <3fad22b40812021135v78410015ya0ea1bd149beeb0a@mail.gmail.com>
2008-12-12 17:40 ` Dan Streetman
[not found] ` <alpine.LNX.1.10.0811251035260.30650-ah6mVDs4vN4u9rY2yWxFjw@public.gmane.org>
2009-01-08 0:52 ` Jiri Kosina
[not found] ` <alpine.LRH.1.10.0901080149280.24105-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>
2009-01-11 7:58 ` Dmitry Torokhov
2008-11-17 16:26 Dan Streetman
2008-11-14 16:17 Dan Streetman
2008-11-13 23:25 Dan Streetman
2008-11-13 23:36 ` Alexey Klimov
2008-11-14 0:03 ` Greg KH
2008-11-13 20:22 Dan Streetman
[not found] ` <3fad22b40811131222k3a168a06tfe01b09ca106e0a2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-13 20:31 ` Greg KH
2008-11-14 21:31 ` Vojtech Pavlik
2008-11-14 21:46 ` Dan Streetman
2008-11-15 21:08 ` Vojtech Pavlik
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=alpine.LNX.1.10.0811240944520.4090@floyd.root.cx \
--to=ddstreet-ekmvuln54sk@public.gmane.org \
--cc=daniel.ritz-OI3hZJvNYWs@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vojtech-AlSwsSmVLrQ@public.gmane.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).