修改檔案:
1、在hid-ids.h中加入vid pid
2、在hid-multitouch..c->mt_devices[] 中加入
{
.driver_data=MT_CLS_DEFAULT,
HID_USB_DEVICE(VID,PID)
}
3、在hid-core.c->hid_have_special_driver[]中加入HID_USB_DEVICE(VID,PID) ------------------------------------------------------------------------------------------------------------------------------------------------------4:添加核心配置選項: 5: 7: ----------------------------------------------------------------------------------------------------------------------------------------------------------8:http://source.android.com/tech/input/input-device-configuration-files.html 根據這個網站添加上層IDC檔案: 9:
# Copyright (C) 2012 Beijing IRTOUCH SYSTEMS Co.,Ltd### Input Device Configuration File for the IRTOUCH touch screen.## Basic Parameterstouch.deviceType = touchscreentouch.orientationAware = 1# 0 外部裝置,1 內部裝置device.internal = 1# Touch Size#touch.touchSize.calibration = pressure#touch.toolSize.calibration = linear#touch.toolSize.linearScale = 10#touch.toolSize.linearBias = 160#touch.toolSize.isSummed = 1# Size#touch.size.calibration = diameter#touch.size.scale = 10#touch.size.bias = 0#touch.size.isSummed = 0#scale 規模,面,比例;#bias 偏壓,偏差#summed 總結# Pressure壓力-/amplitude振幅#touch.pressure.calibration = amplitude#touch.pressure.scale = 0.005# Orientation方向-/校準touch.orientetion.calibration = none
---------------------------------------------------------------------------------------------------------------------------------------------------
上面那個idc檔案不能用,用下面這個idc檔案,Android 觸控螢幕idc檔案一般都是通用的,我的用這個下面這個idc檔案就可以了,知識觸控螢幕沒有滑鼠箭頭,但是滑鼠點哪裡就是去哪裡:
# Copyright (C) 2010 The Android Open Source Project## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.## Emulator keyboard configuration file #1.## Basic Parameterstouch.deviceType = touchScreentouch.orientationAware = 1touch.size.calibration=diametertouch.size.scale=10touch.size.bias=0touch.size.isSummed=0touch.size.pressure.calibration=amplitudetouch.pressure.scale=0.005touch.orientation.calibration=none
---------------------------------------------------------------------------------------------------------------------------------------------------10: adb shell su mount mount -w -o remount /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system chmod 777 /system/usr/idc =>修改idc檔案可寫入權限; adb push /home/tonsincs/Vendor_0416_Product_5030_Version_0110.idc /system/usr/idc/ -----------------------------------------------------------------------------------------------------------------------------------------------------------11:還有一種把 IDC 檔案放到/system/usr/idc/ 目錄下的方法: 1)把你的 IDC 檔案拷貝到android源碼:frameworks/base/data/keyboards/ 目錄下; 2)修改common.mk檔案: 3)croot 到android源碼根目錄: make -j8 完成後,find 命令在out目錄尋找下……結果如下則OK; -----------------------------------------------------------------------------------------------------------------------------------------------------------總結: 最近一直移植Android(4.1)下面的觸控螢幕驅動,也接觸到了幾種觸控螢幕,總的來說,要麼把觸控螢幕當標準的HID裝置來用,這個移植就簡單,把觸控螢幕的VID/PID加到hid-ids.h hid-core.c hid-multitouch.c 檔案裡面,而且還要上層/system/usr/idc/Vendor_xxx_Product_xxx.idc檔案配合,觸控螢幕才能使用,否則你的觸控螢幕用著跟筆記本的觸摸板似得! 個人理解,修改drivers/input/touchscreen/usttouchscreen.c檔案中添加你的觸控螢幕驅動可以,不過這個比較麻煩,你要知道怎麼寫驅動,一些函數怎麼實現,演算法怎麼實現;比較麻煩; 也接觸到了i2c匯流排的觸控螢幕驅動,這個又比較麻煩一點,要根據你的arch/arm/mach-xxxx/board-xxx.c檔案中註冊你的觸控螢幕驅動i2c匯流排資訊;再添加你的驅動源碼; 總得來說,寫驅動的話比較麻煩,你必須有電路原理圖、晶片資料手冊,而且要看的明明白白,怎麼去是實現那些演算法,而且要對linux 驅動很瞭解,你的驅動掛載哪裡,i2c匯流排、usb匯流排,又要很多協議;很多知識;usb2.0協議,英文287頁;很麻煩!慢慢學習了!以上為個人理解!也是個人工作筆記!以備自己忘記了查閱!也供剛入門的朋友們參考!-------------------------------------------------------------------------------------------------------------------------------------------------------------