From: "Henrik Rydberg" <rydberg@euromail.se>
To: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jiri Kosina <jkosina@suse.cz>,
Stephane Chatty <chatty@lii-enac.fr>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] hid-multitouch: migrate 3M PCT touch screens to hid-multitouch
Date: Thu, 10 Mar 2011 16:52:25 +0100 [thread overview]
Message-ID: <20110310155225.GA23034@polaris.bitmath.org> (raw)
In-Reply-To: <1299686450-5475-5-git-send-email-benjamin.tissoires@enac.fr>
Hi Benjamin,
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 02a77f9..0b92dfc 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -5,6 +5,11 @@
> * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
> * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
> *
> + * based on hid-3m-pct.c copyrighted as follows:
> + * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
> + * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
> + * Copyright (c) 2010 Canonical, Ltd.
> + *
> */
>
> /*
> @@ -62,6 +67,8 @@ struct mt_class {
> __s32 name; /* MT_CLS */
> __s32 quirks;
> __s32 sn_move; /* Signal/noise ratio for move events */
> + __s32 sn_width; /* Signal/noise ratio for width events */
> + __s32 sn_height; /* Signal/noise ratio for height events */
> __s32 sn_pressure; /* Signal/noise ratio for pressure events */
> __u8 maxcontacts;
> };
> @@ -72,6 +79,7 @@ struct mt_class {
> #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
> #define MT_CLS_CYPRESS 4
> #define MT_CLS_STANTUM 5
> +#define MT_CLS_3M 6
>
> /*
> * these device-dependent functions determine what slot corresponds
> @@ -123,6 +131,12 @@ struct mt_class mt_classes[] = {
> .maxcontacts = 10 },
> { .name = MT_CLS_STANTUM,
> .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
I realize several of the entries are missing maxcontacts now, so all
patches needs to be checked...
> + { .name = MT_CLS_3M,
> + .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
> + MT_QUIRK_SLOT_IS_CONTACTID,
> + .sn_move = 2048,
> + .sn_width = 128,
> + .sn_height = 128 },
And this one does too
>
> { }
> };
> @@ -206,11 +220,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> case HID_DG_WIDTH:
> hid_map_usage(hi, usage, bit, max,
> EV_ABS, ABS_MT_TOUCH_MAJOR);
> + set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
> + cls->sn_width);
> td->last_slot_field = usage->hid;
> return 1;
> case HID_DG_HEIGHT:
> hid_map_usage(hi, usage, bit, max,
> EV_ABS, ABS_MT_TOUCH_MINOR);
> + set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
> + cls->sn_height);
> field->logical_maximum = 1;
> field->logical_minimum = 0;
These limits are not right - I doubt they are for any device.
> set_abs(hi->input, ABS_MT_ORIENTATION, field, 0);
> @@ -307,11 +325,18 @@ static void mt_emit_event(struct mt_device *td, struct input_dev *input)
> input_mt_report_slot_state(input, MT_TOOL_FINGER,
> s->touch_state);
> if (s->touch_state) {
> + /* this finger is on the screen */
> + int wide = (s->w > s->h);
> + /* divided by two to match visual scale of touch */
> + int major = max(s->w, s->h) >> 1;
> + int minor = min(s->w, s->h) >> 1;
> +
> input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
> input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
> + input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
> input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
> - input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->w);
> - input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, s->h);
> + input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
> + input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
> }
> s->seen_in_this_frame = false;
>
> @@ -481,6 +506,14 @@ static void mt_remove(struct hid_device *hdev)
>
> static const struct hid_device_id mt_devices[] = {
>
> + /* 3M panels */
> + { .driver_data = MT_CLS_3M,
> + HID_USB_DEVICE(USB_VENDOR_ID_3M,
> + USB_DEVICE_ID_3M1968) },
> + { .driver_data = MT_CLS_3M,
> + HID_USB_DEVICE(USB_VENDOR_ID_3M,
> + USB_DEVICE_ID_3M2256) },
> +
> /* Cando panels */
> { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
> HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
> --
> 1.7.4
>
Also, this line needs to be added in case no feature reports are sent:
@@ -481,6 +481,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
return -ENOMEM;
}
td->mtclass = mtclass;
+ td->maxcontacts = mtclass->maxcontacts;
td->inputmode = -1;
hid_set_drvdata(hdev, td);
Thanks,
Henrik
next prev parent reply other threads:[~2011-03-10 15:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-09 16:00 [PATCH 0/4] Migrations to hid-multitouch, round 2 Benjamin Tissoires
2011-03-09 16:00 ` [PATCH v2 1/4] hid-multitouch: Auto detection of maxcontacts Benjamin Tissoires
2011-03-10 12:45 ` Henrik Rydberg
2011-03-11 7:07 ` Benjamin Tissoires
2011-03-09 16:00 ` [PATCH v2 2/4] hid-multitouch: migrate support for Stantum panels to the unified driver Benjamin Tissoires
2011-03-09 16:00 ` [PATCH v2 3/4] hid-multitouch: migrate Cando dual touch panels to hid-multitouch Benjamin Tissoires
2011-03-09 16:00 ` [PATCH v2 4/4] hid-multitouch: migrate 3M PCT touch screens " Benjamin Tissoires
2011-03-10 15:52 ` Henrik Rydberg [this message]
2011-03-11 7:26 ` Benjamin Tissoires
2011-03-11 11:07 ` Henrik Rydberg
2011-03-14 12:08 ` [PATCH 0/4] Migrations to hid-multitouch, round 2 Jiri Kosina
2011-03-14 13:10 ` Benjamin Tissoires
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=20110310155225.GA23034@polaris.bitmath.org \
--to=rydberg@euromail.se \
--cc=benjamin.tissoires@enac.fr \
--cc=chatty@lii-enac.fr \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome