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

来源:互联网 发布:mac dare you黄皮 编辑:程序博客网 时间:2024/04/27 17:23

更改思路:

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

[cpp] view plaincopyprint?
  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; 


原创粉丝点击