Skip to content

Commit 1d902b5

Browse files
authored
Merge pull request #3 from StollD/bugfix/touch-rotation
Fix touch input rotation / Disable single-touch mode
2 parents 5b57c79 + 86f95d2 commit 1d902b5

5 files changed

Lines changed: 5 additions & 146 deletions

File tree

drivers/hid/hid-multitouch.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ struct mt_device {
169169
static void mt_post_parse_default_settings(struct mt_device *td,
170170
struct mt_application *app);
171171
static void mt_post_parse(struct mt_device *td, struct mt_application *app);
172-
static int cc_seen = 0;
173172

174173
/* classes of device behavior */
175174
#define MT_CLS_DEFAULT 0x0001
@@ -796,11 +795,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
796795
app->scantime_logical_max = field->logical_maximum;
797796
return 1;
798797
case HID_DG_CONTACTCOUNT:
799-
if(cc_seen != 1) {
800-
app->have_contact_count = true;
801-
app->raw_cc = &field->value[usage->usage_index];
802-
cc_seen++;
803-
}
798+
app->have_contact_count = true;
799+
app->raw_cc = &field->value[usage->usage_index];
804800
return 1;
805801
case HID_DG_AZIMUTH:
806802
/*
@@ -1290,11 +1286,9 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
12901286
field->application != HID_DG_TOUCHSCREEN &&
12911287
field->application != HID_DG_PEN &&
12921288
field->application != HID_DG_TOUCHPAD &&
1293-
field->application != HID_GD_MOUSE &&
12941289
field->application != HID_GD_KEYBOARD &&
12951290
field->application != HID_GD_SYSTEM_CONTROL &&
12961291
field->application != HID_CP_CONSUMER_CONTROL &&
1297-
field->logical != HID_DG_TOUCHSCREEN &&
12981292
field->application != HID_GD_WIRELESS_RADIO_CTLS &&
12991293
field->application != HID_GD_SYSTEM_MULTIAXIS &&
13001294
!(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
@@ -1346,14 +1340,6 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
13461340
struct mt_device *td = hid_get_drvdata(hdev);
13471341
struct mt_report_data *rdata;
13481342

1349-
if (field->application == HID_DG_TOUCHSCREEN ||
1350-
field->application == HID_DG_TOUCHPAD) {
1351-
if (usage->type == EV_KEY || usage->type == EV_ABS)
1352-
set_bit(usage->type, hi->input->evbit);
1353-
1354-
return -1;
1355-
}
1356-
13571343
rdata = mt_find_report_data(td, field->report);
13581344
if (rdata && rdata->is_mt_collection) {
13591345
/* We own these mappings, tell hid-input to ignore them */
@@ -1565,13 +1551,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
15651551
/* already handled by hid core */
15661552
break;
15671553
case HID_DG_TOUCHSCREEN:
1568-
suffix = "Touchscreen";
1554+
/* we do not set suffix = "Touchscreen" */
15691555
hi->input->name = hdev->name;
15701556
break;
15711557
case HID_DG_STYLUS:
15721558
/* force BTN_STYLUS to allow tablet matching in udev */
15731559
__set_bit(BTN_STYLUS, hi->input->keybit);
1574-
__set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
15751560
break;
15761561
case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
15771562
suffix = "Custom Media Keys";
@@ -1687,7 +1672,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
16871672
td->hdev = hdev;
16881673
td->mtclass = *mtclass;
16891674
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
1690-
cc_seen = 0;
16911675
hid_set_drvdata(hdev, td);
16921676

16931677
INIT_LIST_HEAD(&td->applications);

drivers/misc/ipts/ipts-dbgfs.c

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -22,76 +22,11 @@
2222
#include "ipts-state.h"
2323
#include "../mei/mei_dev.h"
2424

25-
const char sensor_mode_fmt[] = "sensor mode : %01d\n";
26-
const char ipts_status_fmt[] = "sensor mode : %01d\nipts state : %01d\n";
25+
const char ipts_status_fmt[] = "ipts state : %01d\n";
2726
const char ipts_debug_fmt[] = ">> tdt : fw status : %s\n"
2827
">> == DB s:%x, c:%x ==\n"
2928
">> == WQ h:%u, t:%u ==\n";
3029

31-
static ssize_t ipts_dbgfs_mode_read(struct file *fp, char __user *ubuf,
32-
size_t cnt, loff_t *ppos)
33-
{
34-
ipts_info_t *ipts = fp->private_data;
35-
char mode[80];
36-
int len = 0;
37-
38-
if (cnt < sizeof(sensor_mode_fmt) - 3)
39-
return -EINVAL;
40-
41-
len = scnprintf(mode, 80, sensor_mode_fmt, ipts->sensor_mode);
42-
if (len < 0)
43-
return -EIO;
44-
45-
return simple_read_from_buffer(ubuf, cnt, ppos, mode, len);
46-
}
47-
48-
static ssize_t ipts_dbgfs_mode_write(struct file *fp, const char __user *ubuf,
49-
size_t cnt, loff_t *ppos)
50-
{
51-
ipts_info_t *ipts = fp->private_data;
52-
ipts_state_t state;
53-
int sensor_mode, len;
54-
char mode[3];
55-
56-
if (cnt == 0 || cnt > 3)
57-
return -EINVAL;
58-
59-
state = ipts_get_state(ipts);
60-
if (state != IPTS_STA_RAW_DATA_STARTED && state != IPTS_STA_HID_STARTED) {
61-
return -EIO;
62-
}
63-
64-
len = cnt;
65-
if (copy_from_user(mode, ubuf, len))
66-
return -EFAULT;
67-
68-
while(len > 0 && (isspace(mode[len-1]) || mode[len-1] == '\n'))
69-
len--;
70-
mode[len] = '\0';
71-
72-
if (sscanf(mode, "%d", &sensor_mode) != 1)
73-
return -EINVAL;
74-
75-
if (sensor_mode != TOUCH_SENSOR_MODE_RAW_DATA &&
76-
sensor_mode != TOUCH_SENSOR_MODE_HID) {
77-
return -EINVAL;
78-
}
79-
80-
if (sensor_mode == ipts->sensor_mode)
81-
return 0;
82-
83-
ipts_switch_sensor_mode(ipts, sensor_mode);
84-
85-
return cnt;
86-
}
87-
88-
static const struct file_operations ipts_mode_dbgfs_fops = {
89-
.open = simple_open,
90-
.read = ipts_dbgfs_mode_read,
91-
.write = ipts_dbgfs_mode_write,
92-
.llseek = generic_file_llseek,
93-
};
94-
9530
static ssize_t ipts_dbgfs_status_read(struct file *fp, char __user *ubuf,
9631
size_t cnt, loff_t *ppos)
9732
{
@@ -102,8 +37,7 @@ static ssize_t ipts_dbgfs_status_read(struct file *fp, char __user *ubuf,
10237
if (cnt < sizeof(ipts_status_fmt) - 3)
10338
return -EINVAL;
10439

105-
len = scnprintf(status, 256, ipts_status_fmt, ipts->sensor_mode,
106-
ipts->state);
40+
len = scnprintf(status, 256, ipts_status_fmt, ipts->state);
10741
if (len < 0)
10842
return -EIO;
10943

@@ -299,13 +233,6 @@ int ipts_dbgfs_register(ipts_info_t* ipts, const char *name)
299233
if (!dir)
300234
return -ENOMEM;
301235

302-
f = debugfs_create_file("mode", S_IRUSR | S_IWUSR, dir,
303-
ipts, &ipts_mode_dbgfs_fops);
304-
if (!f) {
305-
ipts_err(ipts, "debugfs mode creation failed\n");
306-
goto err;
307-
}
308-
309236
f = debugfs_create_file("status", S_IRUSR, dir,
310237
ipts, &ipts_status_dbgfs_fops);
311238
if (!f) {

drivers/misc/ipts/ipts-mei.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,6 @@ static struct mei_cl_device_id ipts_mei_cl_tbl[] = {
3939
{}
4040
};
4141

42-
static ssize_t sensor_mode_show(struct device *dev,
43-
struct device_attribute *attr, char *buf)
44-
{
45-
ipts_info_t *ipts;
46-
ipts = dev_get_drvdata(dev);
47-
48-
return sprintf(buf, "%d\n", ipts->sensor_mode);
49-
}
50-
51-
//TODO: Verify the function implementation
52-
static ssize_t sensor_mode_store(struct device *dev,
53-
struct device_attribute *attr, const char *buf,
54-
size_t count)
55-
{
56-
int ret;
57-
long val;
58-
ipts_info_t *ipts;
59-
60-
ipts = dev_get_drvdata(dev);
61-
ret = kstrtol(buf, 10, &val);
62-
if (ret)
63-
return ret;
64-
65-
ipts_dbg(ipts, "try sensor mode = %ld\n", val);
66-
67-
switch (val) {
68-
case TOUCH_SENSOR_MODE_HID:
69-
break;
70-
case TOUCH_SENSOR_MODE_RAW_DATA:
71-
break;
72-
default:
73-
ipts_err(ipts, "sensor mode %ld is not supported\n", val);
74-
}
75-
76-
return count;
77-
}
78-
7942
static ssize_t device_info_show(struct device *dev,
8043
struct device_attribute *attr, char *buf)
8144
{
@@ -89,12 +52,9 @@ static ssize_t device_info_show(struct device *dev,
8952
ipts->device_info.vendor_id, ipts->device_info.device_id,
9053
ipts->device_info.hw_rev, ipts->device_info.fw_rev);
9154
}
92-
93-
static DEVICE_ATTR_RW(sensor_mode);
9455
static DEVICE_ATTR_RO(device_info);
9556

9657
static struct attribute *ipts_attrs[] = {
97-
&dev_attr_sensor_mode.attr,
9858
&dev_attr_device_info.attr,
9959
NULL
10060
};

drivers/misc/ipts/ipts-msg-handler.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,6 @@ int ipts_restart(ipts_info_t *ipts)
189189
return ret;
190190
}
191191

192-
int ipts_switch_sensor_mode(ipts_info_t *ipts, int new_sensor_mode)
193-
{
194-
int ret = 0;
195-
196-
ipts->new_sensor_mode = new_sensor_mode;
197-
ipts->switch_sensor_mode = true;
198-
ret = ipts_send_sensor_quiesce_io_cmd(ipts);
199-
200-
return ret;
201-
}
202-
203192
#define rsp_failed(ipts, cmd, status) ipts_err(ipts, \
204193
"0x%08x failed status = %d\n", cmd, status);
205194

drivers/misc/ipts/ipts-msg-handler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
int ipts_handle_cmd(ipts_info_t *ipts, u32 cmd, void *data, int data_size);
2121
int ipts_start(ipts_info_t *ipts);
2222
void ipts_stop(ipts_info_t *ipts);
23-
int ipts_switch_sensor_mode(ipts_info_t *ipts, int new_sensor_mode);
2423
int ipts_handle_resp(ipts_info_t *ipts, touch_sensor_msg_m2h_t *m2h_msg,
2524
u32 msg_len);
2625
int ipts_handle_processed_data(ipts_info_t *ipts);

0 commit comments

Comments
 (0)