aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-3m-pct.c
diff options
context:
space:
mode:
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 c31e0be8ccea..2a0d56b7a02b 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
@@ -25,7 +25,7 @@ MODULE_LICENSE("GPL");
25#include "hid-ids.h" 25#include "hid-ids.h"
26 26
27struct mmm_finger { 27struct mmm_finger {
28 __s32 x, y; 28 __s32 x, y, w, h;
29 __u8 rank; 29 __u8 rank;
30 bool touch, valid; 30 bool touch, valid;
31}; 31};
@@ -82,7 +82,18 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
82 /* touchscreen emulation */ 82 /* touchscreen emulation */
83 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); 83 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
84 return 1; 84 return 1;
85 case HID_DG_WIDTH:
86 hid_map_usage(hi, usage, bit, max,
87 EV_ABS, ABS_MT_TOUCH_MAJOR);
88 return 1;
89 case HID_DG_HEIGHT:
90 hid_map_usage(hi, usage, bit, max,
91 EV_ABS, ABS_MT_TOUCH_MINOR);
92 input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
93 1, 1, 0, 0);
94 return 1;
85 case HID_DG_CONTACTID: 95 case HID_DG_CONTACTID:
96 field->logical_maximum = 59;
86 hid_map_usage(hi, usage, bit, max, 97 hid_map_usage(hi, usage, bit, max,
87 EV_ABS, ABS_MT_TRACKING_ID); 98 EV_ABS, ABS_MT_TRACKING_ID);
88 return 1; 99 return 1;
@@ -128,9 +139,15 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
128 /* this finger is just placeholder data, ignore */ 139 /* this finger is just placeholder data, ignore */
129 } else if (f->touch) { 140 } else if (f->touch) {
130 /* this finger is on the screen */ 141 /* this finger is on the screen */
142 int wide = (f->w > f->h);
131 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i); 143 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i);
132 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); 144 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
133 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); 145 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
146 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
147 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR,
148 wide ? f->w : f->h);
149 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
150 wide ? f->h : f->w);
134 input_mt_sync(input); 151 input_mt_sync(input);
135 /* 152 /*
136 * touchscreen emulation: maintain the age rank 153 * touchscreen emulation: maintain the age rank
@@ -197,6 +214,14 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field,
197 case HID_DG_CONFIDENCE: 214 case HID_DG_CONFIDENCE:
198 md->valid = value; 215 md->valid = value;
199 break; 216 break;
217 case HID_DG_WIDTH:
218 if (md->valid)
219 md->f[md->curid].w = value;
220 break;
221 case HID_DG_HEIGHT:
222 if (md->valid)
223 md->f[md->curid].h = value;
224 break;
200 case HID_DG_CONTACTID: 225 case HID_DG_CONTACTID:
201 if (md->valid) { 226 if (md->valid) {
202 md->curid = value; 227 md->curid = value;
@@ -255,6 +280,7 @@ static void mmm_remove(struct hid_device *hdev)
255 280
256static const struct hid_device_id mmm_devices[] = { 281static const struct hid_device_id mmm_devices[] = {
257 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, 282 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
283 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) },
258 { } 284 { }
259}; 285};
260MODULE_DEVICE_TABLE(hid, mmm_devices); 286MODULE_DEVICE_TABLE(hid, mmm_devices);
@@ -287,5 +313,4 @@ static void __exit mmm_exit(void)
287 313
288module_init(mmm_init); 314module_init(mmm_init);
289module_exit(mmm_exit); 315module_exit(mmm_exit);
290MODULE_LICENSE("GPL");
291 316