Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1335913
  • 博文数量: 198
  • 博客积分: 1629
  • 博客等级: 上尉
  • 技术积分: 2743
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 15:41
文章分类
文章存档

2023年(6)

2022年(20)

2021年(8)

2020年(3)

2018年(17)

2017年(3)

2016年(3)

2015年(9)

2014年(13)

2013年(17)

2012年(77)

2011年(22)

分类: LINUX

2018-11-13 10:34:30

1. 注册
hi->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
hi->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);

switch (usage->hid) {
 case HID_GD_X:
  #ifdef SINGLE_TOUCH
  hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_X);
  input_set_abs_params(hi->input, ABS_X, 0, MAX_X, 0, 0);
  #else
  hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_X);
  input_set_abs_params(hi->input, ABS_X, field->logical_minimum, field->logical_maximum, 0, 0);
  #endif

  return 1;


 case HID_GD_Y:
  #ifdef SINGLE_TOUCH
  hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_Y);
  input_set_abs_params(hi->input, ABS_Y, 0, MAX_Y, 0, 0);
  #else
  hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_Y);
  input_set_abs_params(hi->input, ABS_Y,field->logical_minimum, field->logical_maximum, 0, 0);
  #endif
  return 1;


  case HID_DG_TIPPRESSURE:
  printk(".............ABS_PRESSURE..........\n");
  hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_PRESSURE); //++by sbs
  input_set_abs_params(hi->input, ABS_PRESSURE, 0, 255, 0, 0);
  return 1;

 }


2. 上报点
if(nd->pt[i].pressure)
{
 #ifdef SINGLE_TOUCH

 input_report_abs(input, ABS_X, nd->pt[i].x);
 input_report_abs(input, ABS_Y, nd->pt[i].y);
 input_report_abs(input, ABS_PRESSURE, nd->pt[i].pressure);
 input_sync(input);
 all_touch_up = false;
   
 #else

 input_report_abs(input, ABS_MT_PRESSURE, nd->pt[i].pressure);
 input_report_abs(input, ABS_MT_POSITION_X, nd->pt[i].x);
 input_report_abs(input, ABS_MT_POSITION_Y, nd->pt[i].y);
 input_report_abs(input, ABS_MT_TRACKING_ID, nd->pt[i].id);
 input_mt_sync(input);
 all_touch_up = false;
 #endif
}
  
 if(i == (nd->total - 1) && all_touch_up == true)
 {
 #ifdef SINGLE_TOUCH
  input_report_abs(input, ABS_PRESSURE, 0);
  input_sync(input);
 #else
  input_mt_sync(input);
 #endif

阅读(1534) | 评论(0) | 转发(0) |
0

上一篇:QT隐藏鼠标指针

下一篇:Linux 旋转显示

给主人留下些什么吧!~~