遙控器按鍵索引值映射,遙控器按鍵映射
在linux環境下輸入getevent命令
遙控器按一個鍵,出現的第二行,第二個數,就是這個鍵對應的16進位,
轉成10進位之後放入system\usr\keylayout\Vendor_2389_Product_00a8_Version_0200.kl檔案中,
然後讓這個鍵對應1,2,DPAD_UP,CHANNEL_UP等或自訂為F9(電視,需捕獲之後自己跳轉),F2(電影需捕獲之後自己跳轉)
如果是全域都可以用的按鈕,則還需要在在system\etc\hotkey.xml中進行跳轉
不同的遙控器要配合不同的.kl檔案
在linux環境下輸入getevent -v 命令
130|root@n302:/ # getevent -v
add device 4: /dev/input/event2 //kl檔案的命名規則Vendor_0c45_Product_1109_Version_0100.kl
bus: 0003
vendor 0c45
product 1109
version 0100
name: "coocaa Device coocaa Wireless Device"
location: "usb-lm2-1/input0"
id: ""
version: 1.0.1
add device 5: /dev/input/event0
bus: 0010
vendor 0001
product 0001
version 0100
name: "aml_keypad"
location: "keypad/input0"
id: ""
version: 1.0.1
add device 6: /dev/input/event1
bus: 0010
vendor 1b8e
product 0cec
version 0001
name: "cec_input"
location: ""
id: ""
version: 1.0.1
kl檔案
例子:system\usr\keylayout\Vendor_0c45_Product_1109_Version_0100.kl
key 11 0
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
#key 139 MENU WAKE_DROPPED
key 158 BACK
key 108 DPAD_DOWN
key 103 DPAD_UP
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 28 DPAD_CENTER
key 104 CHANNEL_UP WAKE_DROPPED
key 109 CHANNEL_DOWN WAKE_DROPPED
key 172 HOME WAKE_DROPPED
key 14 DEL
key 59 F1
key 63 F2
key 64 F3
key 65 F4
key 67 F5
key 68 F6
key 87 F7
key 88 F8
key 183 F9
key 184 F10
例子:system\etc\hotkey.xml
<?xml version="1.0" encoding="utf-8"?>
<hotkey>
<event
code="00b7"
cmd="am start -n com.xxxxx.tvplay/com.xxxxx.tvplay.MainActivity"/>
</hotkey>