aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-3m-pct.c
diff options
context:
space:
mode:
authorStephane Chatty <chatty@lii-enac.fr>2010-04-11 08:51:24 -0400
committerJiri Kosina <jkosina@suse.cz>2010-04-11 14:34:50 -0400
commit6dec143a50c01ca0cc0afcbf5ea4bb8e87981edf (patch)
tree845d84a2ef533e6053299b7f3649e6a7248946c4 /drivers/hid/hid-3m-pct.c
parent3d61510f4ecacfe47c75c0eb51c0659dfa77fb1b (diff)
HID: add support for 3M multitouch 22" display
Now support the 22" display and its updated firmware, including touch width and height. The number of touches can now go up to 60, and our single touch emulation will fail when there are more than 6-7 touches; further work is needed on this. Signed-off-by: Stephane Chatty <chatty@enac.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-3m-pct.c')
-rw-r--r--drivers/hid/hid-3m-pct.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
index 2370aefc86b2..883fd1af3c4c 100644
--- a/drivers/hid/hid-3m-pct.c
+++ b/drivers/hid/hid-3m-pct.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * HID driver for 3M PCT multitouch panels 2 * HID driver for 3M PCT multitouch panels
3 * 3 *
4 * Copyright (c) 2009 Stephane Chatty <chatty@enac.fr> 4 * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
5 * 5 *
6 */ 6 */
7 7
@@ -24,7 +24,7 @@ MODULE_LICENSE("GPL");
24#include "hid-ids.h" 24#include "hid-ids.h"
25 25
26struct mmm_finger { 26struct mmm_finger {
27 __s32 x, y; 27 __s32 x, y, w, h;
28 __u8 rank; 28 __u8 rank;
29 bool touch, valid; 29 bool touch, valid;
30}; 30};
@@ -81,7 +81,18 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
81 /* touchscreen emulation */ 81 /* touchscreen emulation */
82 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); 82 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
83 return 1; 83 return 1;
84 case HID_DG_WIDTH:
85 hid_map_usage(hi, usage, bit, max,
86 EV_ABS, ABS_MT_TOUCH_MAJOR);
87 return 1;
88 case HID_DG_HEIGHT:
89 hid_map_usage(hi, usage, bit, max,
90 EV_ABS, ABS_MT_TOUCH_MINOR);
91 input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
92 1, 1, 0, 0);
93 return 1;
84 case HID_DG_CONTACTID: 94 case HID_DG_CONTACTID:
95 field->logical_maximum = 59;
85 hid_map_usage(hi, usage, bit, max, 96 hid_map_usage(hi, usage, bit, max,
86 EV_ABS, ABS_MT_TRACKING_ID); 97 EV_ABS, ABS_MT_TRACKING_ID);
87 return 1; 98 return 1;
@@ -127,9 +138,15 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
127 /* this finger is just placeholder data, ignore */ 138 /* this finger is just placeholder data, ignore */
128 } else if (f->touch) { 139 } else if (f->touch) {
129 /* this finger is on the screen */ 140 /* this finger is on the screen */
141 int wide = (f->w > f->h);
130 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i); 142 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i);
131 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); 143 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
132 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); 144 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
145 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
146 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR,
147 wide ? f->w : f->h);
148 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
149 wide ? f->h : f->w);
133 input_mt_sync(input); 150 input_mt_sync(input);
134 /* 151 /*
135 * touchscreen emulation: maintain the age rank 152 * touchscreen emulation: maintain the age rank
@@ -196,6 +213,14 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field,
196 case HID_DG_CONFIDENCE: 213 case HID_DG_CONFIDENCE:
197 md->valid = value; 214 md->valid = value;
198 break; 215 break;
216 case HID_DG_WIDTH:
217 if (md->valid)
218 md->f[md->curid].w = value;
219 break;
220 case HID_DG_HEIGHT:
221 if (md->valid)
222 md->f[md->curid].h = value;
223 break;
199 case HID_DG_CONTACTID: 224 case HID_DG_CONTACTID:
200 if (md->valid) { 225 if (md->valid) {
201 md->curid = value; 226 md->curid = value;
@@ -254,6 +279,7 @@ static void mmm_remove(struct hid_device *hdev)
254 279
255static const struct hid_device_id mmm_devices[] = { 280static const struct hid_device_id mmm_devices[] = {
256 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, 281 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
282 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) },
257 { } 283 { }
258}; 284};
259MODULE_DEVICE_TABLE(hid, mmm_devices); 285MODULE_DEVICE_TABLE(hid, mmm_devices);
@@ -286,5 +312,4 @@ static void __exit mmm_exit(void)
286 312
287module_init(mmm_init); 313module_init(mmm_init);
288module_exit(mmm_exit); 314module_exit(mmm_exit);
289MODULE_LICENSE("GPL");
290 315