|
我在更改触摸屏驱动后,发现TOUCHDOWN事件未发出,为什么?
请看相关代码:
data->input_dev = input_dev;
input_dev->name = "ts-mxt-T9";
input_dev->phys = "input/ts";
input_dev->id.bustype = BUS_I2C;
input_dev->id.vendor = 0xDEAD;
input_dev->id.product = 0xBEEF;
input_dev->id.version = 10427;
set_bit(EV_SYN, input_dev->evbit);
set_bit(EV_KEY, input_dev->evbit);
set_bit(EV_ABS, input_dev->evbit);
set_bit(ABS_X, input_dev->absbit);
set_bit(ABS_Y, input_dev->absbit);
set_bit(BTN_TOUCH, input_dev->keybit);
set_bit(BTN_2, input_dev->keybit);
set_bit(K_BACK, input_dev->keybit);
set_bit(K_MENU, input_dev->keybit);
set_bit(K_HOME, input_dev->keybit);
set_bit(K_SEARCH, input_dev->keybit);
num_mt_slots = data->num_touchids + data->num_stylusids;
#ifdef MXT_T9INIT_INP_DEV_TRACEOUT
printk(KERN_INFO "T9INIT NOSLOT[%d/%d] max_xy(%d, %d)\n",
num_mt_slots, MXT_MSG_FINGERSIZE, data->max_x, data->max_y);
#endif
input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, data->max_x, 0, 0);
input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, data->max_y, 0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, num_mt_slots, 0, 0);
发送触摸消息:
for (i = 0; i < data->num_touchids; i++) {
struct mxt_finger *p_finger = &(data->fingers[i]);
p_finger->is_updated = MXT_MSG_FALSE;
if (!(p_finger->status & MXT_MSG_EV_VALID)) continue;
if (p_finger->status & MXT_MSG_EV_TOUCH) {
/* Touch active */
input_report_abs(input_dev, ABS_X, p_finger->x);
input_report_abs(input_dev, ABS_Y, p_finger->y);
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, 255);
input_report_abs(input_dev, ABS_MT_POSITION_X, p_finger->x);
input_report_abs(input_dev, ABS_MT_POSITION_Y, p_finger->y);
input_report_abs(input_dev, ABS_PRESSURE, 255);
input_report_key(input_dev, BTN_TOUCH, 1);
input_report_abs(input_dev, ABS_MT_TRACKING_ID, p_finger->id);
input_mt_sync(input_dev);
#ifdef MXT_RPTMSG_TRACEMSG
printk(KERN_INFO "[%d]down: x=%d, y=%d\n",
p_finger->id, p_finger->x, p_finger->y);
#endif
} else {
p_finger->status = ~MXT_MSG_RELEASE;
input_report_abs(input_dev, ABS_PRESSURE, 0);
input_report_key(input_dev, BTN_TOUCH, 0);
input_report_abs(input_dev, ABS_MT_TRACKING_ID, p_finger->id);
input_mt_sync(input_dev);
#ifdef MXT_RPTMSG_TRACEMSG
printk(KERN_INFO "[%d]up: x=%d, y=%d\n",
p_finger->id, p_finger->x, p_finger->y);
#endif
}
}
input_sync(input_dev);
|
|