mtk android tp 触感震动无效的更改

2024-01-02 18:08

本文主要是介绍mtk android tp 触感震动无效的更改,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

更改思路:

请修改TP 驱动以坐标方式上报··back ,menu key,如果直接在TP driver中去上报key, android framework`不会走震动

[cpp] view plain copy print ?
  1. static int tpd_touchinfo(struct TouchInfoT *cinfo, struct TouchInfoT *pinfo) 
  2.     u32 retval; 
  3.     u8 key; 
  4.     u8 touchData = 0; 
  5.      
  6.     //pinfo->count = cinfo->count; 
  7.     memcpy(pinfo, cinfo, sizeof(struct TouchInfoT)); 
  8.      
  9.     //add for sure addr correct 
  10.     //i2c_client->addr = 0x4c; 
  11.     retval = i2c_master_recv_ext(i2c_client, (u8 *)&TpdTouchData, sizeof(TpdTouchData)); 
  12.  
  13.     if(TpdTouchData.packet_id != 0x52 ) 
  14.        { 
  15.         return 0; 
  16.        } 
  17.     /*touch*/ 
  18.     if(TpdTouchData.packet_id == 0x52) 
  19.     { 
  20.  
  21. /*TPD_LOGV("----libin TpdTouchData.packet_id=%d,TpdTouchData.x_h_y_h=%d,TpdTouchData.x_l=%d,TpdTouchData.y_l=%d\n",
  22.     TpdTouchData.packet_id,TpdTouchData.x_h_y_h,TpdTouchData.x_l,TpdTouchData.y_l);
  23. TPD_LOGV("----libin TpdTouchData.disx_h_disy_h=%d,TpdTouchData.disx_l=%d,TpdTouchData.disy_l=%d,TpdTouchData.checksum=%d\n",
  24.     TpdTouchData.disx_h_disy_h,TpdTouchData.disx_l,TpdTouchData.disy_l,TpdTouchData.checksum);  */ 
  25.  
  26. TPD_LOGV("----libin TpdTouchData.x_h_y_h=%d,TpdTouchData.x_l=%d,TpdTouchData.y_l=%d,TpdTouchData.disx_h_disy_h=%d,TpdTouchData.disx_h_disy_h=%d\n"
  27.     TpdTouchData.x_h_y_h,TpdTouchData.x_l,TpdTouchData.y_l,TpdTouchData.disx_h_disy_h);  
  28.  
  29.         if(TpdTouchData.x_h_y_h == 0xFF  
  30.             && TpdTouchData.x_l == 0xFF  
  31.             && TpdTouchData.y_l == 0xFF  
  32.             && TpdTouchData.disx_h_disy_h == 0xFF  
  33.           ) 
  34.         { 
  35.         TPD_LOGV("----libin  1\n"); 
  36. #if 1// def TPD_HAVE_BUTTON 
  37.          { 
  38.             U8 *p = &TpdTouchData; 
  39.             cinfo->key_value = 0; 
  40.             cinfo->key_value = *(p+5);            
  41.             TPD_LOGV("+++++++zym+++++++TPD_HAVE_BUTTON:(%d)\n",cinfo->key_value); 
  42.             { 
  43.                 //tpd_button_msg213x(cinfo->key_value); 
  44.                 //tpd_button(0,0,cinfo->key_value); 
  45.                 if(cinfo->key_value == 1) 
  46.                 { 
  47. #ifdef HQ_A25_NANBO_CTP_MSG2133_KEY 
  48.                              touchData = KEY_BACK;   
  49. #else   
  50.                              touchData = KEY_MENU; 
  51. #endif 
  52.                 } 
  53.                 else if(cinfo->key_value == 2) 
  54.                 { 
  55. #ifdef HQ_CTP_MSG21XX_REVERT 
  56.                     touchData = KEY_BACK; 
  57. #elif defined(HQ_A25_NANBO_CTP_MSG2133_KEY) 
  58.                                         touchData = KEY_MENU; 
  59. #elif defined(HQ_A25P_MUDONG_CTP_MSG2133_KEY) 
  60.                                          touchData = KEY_BACK; 
  61. #else 
  62.                     touchData = KEY_HOME; 
  63. #endif 
  64.                 } 
  65.                 else if(cinfo->key_value == 4) 
  66.                 { 
  67.                     touchData = KEY_BACK; 
  68.                 } 
  69.                 else if(cinfo->key_value == 8) 
  70.                 { 
  71.                     touchData = KEY_SEARCH; 
  72.                 } 
  73.                 else 
  74.                 { 
  75.                     touchData = 0; 
  76.                 } 
  77.                 TPD_LOGV("[MSG2133]+++++++zym+++++++:(%d)\n",touchData); 
  78.  
  79.                   
  80.             //libin add start 20121111 
  81.             if( KEY_MENU == touchData) 
  82.                 { 
  83.             cinfo->x1 = 50; 
  84.             cinfo->y1 = 510; 
  85.  
  86.             cinfo->x2 = 60; 
  87.             cinfo->y2 = 520; 
  88.  
  89.  
  90.             TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y); 
  91.             TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y); 
  92.              
  93.                   cinfo->pressure = 1; 
  94.                   cinfo->count =  1; 
  95.                   return 1; 
  96.                 } 
  97.             else if( KEY_BACK == touchData) 
  98.                 { 
  99.             cinfo->x1 = 210; 
  100.             cinfo->y1 = 510; 
  101.  
  102.             cinfo->x2 = 220; 
  103.             cinfo->y2 = 520; 
  104.  
  105.  
  106.             TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y); 
  107.             TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y); 
  108.              
  109.                   cinfo->pressure = 1; 
  110.                   cinfo->count =  1; 
  111.                   return 1; 
  112.                 } 
  113.             //libin add end 
  114.                 /*libin del 20121011
  115.                 if(touchData)
  116.                     input_report_key(tpd->dev,touchData,1);
  117.                 else
  118.                 {
  119.                     input_report_key(tpd->dev,KEY_MENU,0);
  120.                     input_report_key(tpd->dev,KEY_HOME,0);
  121.                     input_report_key(tpd->dev,KEY_BACK,0);
  122.                     input_report_key(tpd->dev,KEY_SEARCH,0);
  123.                 }*/ 
  124.             } 
  125.          } 
  126. #endif 
  127.             cinfo->count =  0;  
  128.               
  129.         } 
  130.         else if(TpdTouchData.disx_h_disy_h == 0 
  131.             && TpdTouchData.disx_l == 0  
  132.             && TpdTouchData.disy_l == 0) 
  133.             { 
  134.              TPD_LOGV("----libin  2\n"); 
  135.             cinfo->count = 1; 
  136.             } 
  137.         else 
  138.             { 
  139.              TPD_LOGV("----libin  3\n"); 
  140.             cinfo->count = 2; 
  141.             } 
  142.          
  143.         TPD_LOGV("[MSG2133]cinfo: count=%d\n",cinfo->count); 
  144.         if(cinfo->count > 0)    
  145.         { 
  146.             int tmp_x,tmp_y; 
  147.             /*point1*/ 
  148.              TPD_LOGV("----libin  4--------\n"); 
  149.              
  150.             cinfo->x1 = (((TpdTouchData.x_h_y_h&0xF0)<<4) | (TpdTouchData.x_l)); 
  151.             cinfo->y1 = (((TpdTouchData.x_h_y_h&0x0F)<<8) | (TpdTouchData.y_l)); 
  152.             TPD_LOGV("[MSG2133]+++zym+++(%3d,%3d)\n",cinfo->x1,cinfo->y1); 
  153.  
  154.             if(cinfo->count >1) 
  155.             {    
  156.                 /*point2*/ 
  157.                 short disx,disy; 
  158.      
  159.                 disx = (((TpdTouchData.disx_h_disy_h&0xF0)<<4) | (TpdTouchData.disx_l)); 
  160.                 disy = (((TpdTouchData.disx_h_disy_h&0x0F)<<8) | (TpdTouchData.disy_l)); 
  161.                 disy = (disy<<4); 
  162.                 disy = disy/16; 
  163.                 if(disx >= 2048) 
  164.                     disx -= 4096; 
  165.                 if(disy >= 2048) 
  166.                     disy -= 4096; 
  167.                 cinfo->x2 = cinfo->x1 + disx; 
  168.                 cinfo->y2 = cinfo->y1 + disy;              
  169.  
  170.                 tmp_x = cinfo->x2; 
  171.                 tmp_y = cinfo->y2; 
  172.                 cinfo->y2 = tmp_x * (TPD_RES_Y - 1)/ 2047; 
  173.                 cinfo->x2 = tmp_y * (TPD_RES_X - 1) / 2047;       
  174.             } 
  175.             tmp_x = cinfo->x1; 
  176.             tmp_y = cinfo->y1; 
  177.             cinfo->y1 = tmp_x * (TPD_RES_Y - 1) / 2047; 
  178.             cinfo->x1 = tmp_y * (TPD_RES_X - 1) / 2047; 
  179.              
  180.             //add by zym 2012-04-16 
  181.             #ifdef HQ_CTP_MSG21XX_REVERT 
  182.             #else 
  183.             cinfo->x1 = TPD_RES_X -1 - cinfo->x1; 
  184.             cinfo->x2 = TPD_RES_X - 1 -cinfo->x2; 
  185.             #endif 
  186.             TPD_LOGV("[MSG2133]++++++++zym+++++++++bp1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y); 
  187.             TPD_LOGV("[MSG2133]++++++++zym+++++++++bp1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y); 
  188.  
  189.             cinfo->pressure = 1; 
  190.             TPD_LOGV("[MSG2133]pressure: %d\n",cinfo->pressure); 
  191.         } 
  192.     } 
  193.     else 
  194.     { 
  195.         cinfo->count = 0; 
  196.     } 
  197.  
  198.     /*ergate-012 start*/ 
  199.     /*ergate-012 end*/ 
  200.  
  201.     return 1; 
static int tpd_touchinfo(struct TouchInfoT *cinfo, struct TouchInfoT *pinfo)
{u32 retval;u8 key;u8 touchData = 0;//pinfo->count = cinfo->count;memcpy(pinfo, cinfo, sizeof(struct TouchInfoT));//add for sure addr correct//i2c_client->addr = 0x4c;retval = i2c_master_recv_ext(i2c_client, (u8 *)&TpdTouchData, sizeof(TpdTouchData));if(TpdTouchData.packet_id != 0x52 ){return 0;}/*touch*/if(TpdTouchData.packet_id == 0x52){/*TPD_LOGV("----libin TpdTouchData.packet_id=%d,TpdTouchData.x_h_y_h=%d,TpdTouchData.x_l=%d,TpdTouchData.y_l=%d\n",TpdTouchData.packet_id,TpdTouchData.x_h_y_h,TpdTouchData.x_l,TpdTouchData.y_l);	TPD_LOGV("----libin TpdTouchData.disx_h_disy_h=%d,TpdTouchData.disx_l=%d,TpdTouchData.disy_l=%d,TpdTouchData.checksum=%d\n",TpdTouchData.disx_h_disy_h,TpdTouchData.disx_l,TpdTouchData.disy_l,TpdTouchData.checksum);	*/TPD_LOGV("----libin TpdTouchData.x_h_y_h=%d,TpdTouchData.x_l=%d,TpdTouchData.y_l=%d,TpdTouchData.disx_h_disy_h=%d,TpdTouchData.disx_h_disy_h=%d\n",TpdTouchData.x_h_y_h,TpdTouchData.x_l,TpdTouchData.y_l,TpdTouchData.disx_h_disy_h);	if(TpdTouchData.x_h_y_h == 0xFF && TpdTouchData.x_l == 0xFF && TpdTouchData.y_l == 0xFF && TpdTouchData.disx_h_disy_h == 0xFF ){TPD_LOGV("----libin  1\n");
#if 1// def TPD_HAVE_BUTTON{U8 *p = &TpdTouchData;cinfo->key_value = 0;cinfo->key_value = *(p+5);			TPD_LOGV("+++++++zym+++++++TPD_HAVE_BUTTON:(%d)\n",cinfo->key_value);{//tpd_button_msg213x(cinfo->key_value);//tpd_button(0,0,cinfo->key_value);if(cinfo->key_value == 1){
#ifdef HQ_A25_NANBO_CTP_MSG2133_KEYtouchData = KEY_BACK;  
#else  touchData = KEY_MENU;
#endif}else if(cinfo->key_value == 2){
#ifdef HQ_CTP_MSG21XX_REVERTtouchData = KEY_BACK;
#elif defined(HQ_A25_NANBO_CTP_MSG2133_KEY)touchData = KEY_MENU;
#elif defined(HQ_A25P_MUDONG_CTP_MSG2133_KEY)touchData = KEY_BACK;
#elsetouchData = KEY_HOME;
#endif}else if(cinfo->key_value == 4){touchData = KEY_BACK;}else if(cinfo->key_value == 8){touchData = KEY_SEARCH;}else{touchData = 0;}TPD_LOGV("[MSG2133]+++++++zym+++++++:(%d)\n",touchData);//libin add start 20121111if( KEY_MENU == touchData){cinfo->x1 = 50;cinfo->y1 = 510;cinfo->x2 = 60;cinfo->y2 = 520;TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y);TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y);cinfo->pressure = 1;cinfo->count =  1;return 1;}else if( KEY_BACK == touchData){cinfo->x1 = 210;cinfo->y1 = 510;cinfo->x2 = 220;cinfo->y2 = 520;TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y);TPD_LOGV("[MSG2133]++++++++zym+++++++++ap1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y);cinfo->pressure = 1;cinfo->count =  1;return 1;}//libin add end/*libin del 20121011if(touchData)input_report_key(tpd->dev,touchData,1);else{input_report_key(tpd->dev,KEY_MENU,0);input_report_key(tpd->dev,KEY_HOME,0);input_report_key(tpd->dev,KEY_BACK,0);input_report_key(tpd->dev,KEY_SEARCH,0);}*/}}
#endifcinfo->count =  0; }else if(TpdTouchData.disx_h_disy_h == 0&& TpdTouchData.disx_l == 0 && TpdTouchData.disy_l == 0){TPD_LOGV("----libin  2\n");cinfo->count = 1;}else{TPD_LOGV("----libin  3\n");cinfo->count = 2;}TPD_LOGV("[MSG2133]cinfo: count=%d\n",cinfo->count);if(cinfo->count > 0)   {int tmp_x,tmp_y;/*point1*/TPD_LOGV("----libin  4--------\n");cinfo->x1 = (((TpdTouchData.x_h_y_h&0xF0)<<4) | (TpdTouchData.x_l));cinfo->y1 = (((TpdTouchData.x_h_y_h&0x0F)<<8) | (TpdTouchData.y_l));TPD_LOGV("[MSG2133]+++zym+++(%3d,%3d)\n",cinfo->x1,cinfo->y1);if(cinfo->count >1){	/*point2*/short disx,disy;disx = (((TpdTouchData.disx_h_disy_h&0xF0)<<4) | (TpdTouchData.disx_l));disy = (((TpdTouchData.disx_h_disy_h&0x0F)<<8) | (TpdTouchData.disy_l));disy = (disy<<4);disy = disy/16;if(disx >= 2048)disx -= 4096;if(disy >= 2048)disy -= 4096;cinfo->x2 = cinfo->x1 + disx;cinfo->y2 = cinfo->y1 + disy;				tmp_x = cinfo->x2;tmp_y = cinfo->y2;cinfo->y2 = tmp_x * (TPD_RES_Y - 1)/ 2047;cinfo->x2 = tmp_y * (TPD_RES_X - 1) / 2047;		}tmp_x = cinfo->x1;tmp_y = cinfo->y1;cinfo->y1 = tmp_x * (TPD_RES_Y - 1) / 2047;cinfo->x1 = tmp_y * (TPD_RES_X - 1) / 2047;//add by zym 2012-04-16#ifdef HQ_CTP_MSG21XX_REVERT#elsecinfo->x1 = TPD_RES_X -1 - cinfo->x1;cinfo->x2 = TPD_RES_X - 1 -cinfo->x2;#endifTPD_LOGV("[MSG2133]++++++++zym+++++++++bp1:x1 y1: (%3d,%3d)(%3d,%3d)\n",cinfo->x1,cinfo->y1,TPD_RES_X,TPD_RES_Y);TPD_LOGV("[MSG2133]++++++++zym+++++++++bp1:x2 y2: (%3d,%3d)(%3d,%3d)\n",cinfo->x2,cinfo->y2,TPD_RES_X,TPD_RES_Y);cinfo->pressure = 1;TPD_LOGV("[MSG2133]pressure: %d\n",cinfo->pressure);}}else{cinfo->count = 0;}/*ergate-012 start*//*ergate-012 end*/return 1;
}


这篇关于mtk android tp 触感震动无效的更改的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/563252

相关文章

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

Android平台播放RTSP流的几种方案探究(VLC VS ExoPlayer VS SmartPlayer)

技术背景 好多开发者需要遴选Android平台RTSP直播播放器的时候,不知道如何选的好,本文针对常用的方案,做个大概的说明: 1. 使用VLC for Android VLC Media Player(VLC多媒体播放器),最初命名为VideoLAN客户端,是VideoLAN品牌产品,是VideoLAN计划的多媒体播放器。它支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影

android-opencv-jni

//------------------start opencv--------------------@Override public void onResume(){ super.onResume(); //通过OpenCV引擎服务加载并初始化OpenCV类库,所谓OpenCV引擎服务即是 //OpenCV_2.4.3.2_Manager_2.4_*.apk程序包,存

从状态管理到性能优化:全面解析 Android Compose

文章目录 引言一、Android Compose基本概念1.1 什么是Android Compose?1.2 Compose的优势1.3 如何在项目中使用Compose 二、Compose中的状态管理2.1 状态管理的重要性2.2 Compose中的状态和数据流2.3 使用State和MutableState处理状态2.4 通过ViewModel进行状态管理 三、Compose中的列表和滚动

Android 10.0 mtk平板camera2横屏预览旋转90度横屏拍照图片旋转90度功能实现

1.前言 在10.0的系统rom定制化开发中,在进行一些平板等默认横屏的设备开发的过程中,需要在进入camera2的 时候,默认预览图像也是需要横屏显示的,在上一篇已经实现了横屏预览功能,然后发现横屏预览后,拍照保存的图片 依然是竖屏的,所以说同样需要将图片也保存为横屏图标了,所以就需要看下mtk的camera2的相关横屏保存图片功能, 如何实现实现横屏保存图片功能 如图所示: 2.mtk

android应用中res目录说明

Android应用的res目录是一个特殊的项目,该项目里存放了Android应用所用的全部资源,包括图片、字符串、颜色、尺寸、样式等,类似于web开发中的public目录,js、css、image、style。。。。 Android按照约定,将不同的资源放在不同的文件夹中,这样可以方便的让AAPT(即Android Asset Packaging Tool , 在SDK的build-tools目

Android fill_parent、match_parent、wrap_content三者的作用及区别

这三个属性都是用来适应视图的水平或者垂直大小,以视图的内容或尺寸为基础的布局,比精确的指定视图的范围更加方便。 1、fill_parent 设置一个视图的布局为fill_parent将强制性的使视图扩展至它父元素的大小 2、match_parent 和fill_parent一样,从字面上的意思match_parent更贴切一些,于是从2.2开始,两个属性都可以使用,但2.3版本以后的建议使

Android Environment 获取的路径问题

1. 以获取 /System 路径为例 /*** Return root of the "system" partition holding the core Android OS.* Always present and mounted read-only.*/public static @NonNull File getRootDirectory() {return DIR_ANDR

Android逆向(反调,脱壳,过ssl证书脚本)

文章目录 总结 基础Android基础工具 定位关键代码页面activity定位数据包参数定位堆栈追踪 编写反调脱壳好用的脚本过ssl证书校验抓包反调的脚本打印堆栈bilibili反调的脚本 总结 暑假做了两个月的Android逆向,记录一下自己学到的东西。对于app渗透有了一些思路。 这两个月主要做的是代码分析,对于分析完后的持久化等没有学习。主要是如何反编译源码,如何找到

android系统源码12 修改默认桌面壁纸--SRO方式

1、aosp12修改默认桌面壁纸 代码路径 :frameworks\base\core\res\res\drawable-nodpi 替换成自己的图片即可,不过需要覆盖所有目录下的图片。 由于是静态修改,则需要make一下,重新编译。 2、方法二Overlay方式 由于上述方法有很大缺点,修改多了之后容易遗忘自己修改哪些文件,为此我们采用另外一种方法,使用Overlay方式。