小学生
最后登录1970-1-1
在线时间 小时
注册时间2021-2-12
|
发表于 2021-2-12 11:48:07
|
显示全部楼层
像是汇顶固件配置最大触摸点个数(max_touch_num)为1,但多指触摸的时候上报的触摸点个数按照实际个数来,看gtp_get_points函数。
u8 gtp_get_points(struct goodix_ts_data *ts, struct goodix_point_t *points,
u8 *key_value)
{
int ret;
int i;
u8 *coor_data = NULL;
u8 finger_state = 0;
u8 touch_num = 0;
u8 end_cmd[3] = { GTP_READ_COOR_ADDR >> 8,
GTP_READ_COOR_ADDR & 0xFF, 0 };
u8 point_data[2 + 1 + 8 * GTP_MAX_TOUCH_ID + 1] = {
GTP_READ_COOR_ADDR >> 8, GTP_READ_COOR_ADDR & 0xFF };
ret = gtp_i2c_read(ts->client, point_data, 12);
if (ret < 0) {
dev_err(&ts->client->dev,
"I2C transfer error. errno:%d\n ", ret);
return 0;
}
finger_state = point_data[GTP_ADDR_LENGTH];
if (finger_state == 0x00)
return 0;
touch_num = finger_state & 0x0f;
if ((finger_state & MASK_BIT_8) == 0 ||
touch_num > ts->pdata->max_touch_id) {
dev_err(&ts->client->dev,
"Invalid touch state: 0x%x", finger_state);
finger_state = 0;
goto exit_get_point;
}
。。。
}
static void goodix_read_config(struct goodix_ts_data *ts)
{
u8 config[GOODIX_CONFIG_MAX_LENGTH];
int error;
error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
config,
GOODIX_CONFIG_MAX_LENGTH);
if (error) {
dev_warn(&ts->client->dev,
"Error reading config (%d), using defaults\n",
error);
ts->abs_x_max = GOODIX_MAX_WIDTH;
ts->abs_y_max = GOODIX_MAX_HEIGHT;
ts->int_trigger_type = GOODIX_INT_TRIGGER;
ts->max_touch_num = GOODIX_MAX_CONTACTS;
return;
}
ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]);
ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]);
ts->int_trigger_type = config[TRIGGER_LOC] & 0x03;
ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f;
if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) {
dev_err(&ts->client->dev,
"Invalid config, using defaults\n");
ts->abs_x_max = GOODIX_MAX_WIDTH;
ts->abs_y_max = GOODIX_MAX_HEIGHT;
ts->max_touch_num = GOODIX_MAX_CONTACTS;
}
}
|
|