TA的每日心情 | 奋斗 2019-10-1 12:54 |
---|
签到天数: 313 天 连续签到: 1 天 [LV.8]以坛为家I
|
Khadas VIM2 Basic刷好安卓固件后可以安装各种影音播放软件,使用鼠标操作体验没有使用红外遥控器好,下面介绍具体实现方法
下载安卓源码后
repo init -u <a href="https://github.com/khadas/android_manifest.git">https://github.com/khadas/android_manifest.git</a> -b Nougat修改下面文件PROJECT/common/drivers/amlogic/input/remote/remote_meson.c下面位置加入debug代码@@ -147,6 +147,7 @@ static u32 getkeycode(struct remote_dev *dev, u32 scancode) pr_err("cur_custom is nulll\n"); return KEY_RESERVED; }+ printk("%s,scancode=0xx\n",__func__, scancode); index = ir_lookup_by_scancode(&ct->tab, scancode); if (index < 0) { remote_printk(2, "scancode %d undefined\n", scancode);@@ -163,6 +164,7 @@ static bool is_valid_custom(struct remote_dev *dev) return true; custom_code = chip->ir_contr[chip->ir_work].get_custom_code(chip); chip->cur_tab = seek_map_tab(chip, custom_code);+ printk("%s,custom_code=0xx\n",__func__, custom_code); if (chip->cur_tab) { dev->keyup_delay = chip->cur_tab->tab.release_delay; return true;然后使用下面命令编译内核source device/khadas/kvim/mkern.sh然后参考官方文档里面的tftp法替换内核https://docs.khadas.com/develop/SetupTFTPServer/
然后启动安卓系统后使用无线ADB或者串口登陆,输入下面命令
dmesg -c然后使用红外遥控器(建议NEC协议的红外遥控器)对准开发板一一按键,终端里面会显示红外遥控器的factory code、红外按键的scancode信息,出厂默认固件包含的factory code为<1> 0xfb04 <2> 0xfe01 <3> 0xbd02 <4> 0xff00,如果你的遥控器为0xfc02,debug信息只会出现一条
is_valid_custom,custom_code=0xfc02如果你的红外遥控器factory code不在出厂的四种里面还需要修改下面内核源码PROJECT/common/arch/arm64/boot/dts/amlogic/mesongxm.dtsi加入下面位置,例如amlogic-remote-5 custom_maps:custom_maps {- mapnum = <4>;+ mapnum = <5>; map0 = <&map_0>; map1 = <&map_1>; map2 = <&map_2>; map3 = <&map_3>;+ map4 = <&map_4>; map_0: map_0{ mapname = "amlogic-remote-1"; customcode = <0xfb04>;@@ -852,6 +853,13 @@ REMOTE_KEY(0x01,158) REMOTE_KEY(0x48,102)>; };+ map_4: map_4{+ mapname = "amlogic-remote-5";+ customcode = <0xfc02>;+ release_delay = <80>;+ size = <0>;+ keymap = <>;+ } };修改后按上面编译内核然后使用tftp法替换内核,再使用串口或者无线adb登陆后运行dmesg -c,再次使用红外遥控器对准开发板按键会出现两条诊断信息is_valid_custom,custom_code=0xfc02getkeycode,scancode=0x0009如果你的红外遥控器在出厂的四种工厂代码里面,就可以免去上面修改dtsi文件的那一步,直接记下factory code和各个按键的scancode,然后参照下面的安装按键码一一对应key 399 GRAVEkey 1 BACKkey 2 1key 3 2key 4 3key 5 4key 6 5key 7 6key 8 7key 9 8key 10 9key 11 0key 15 BACKkey 158 BACKkey 58 SOFT_RIGHTkey 107 ENDCALLkey 62 ENDCALLkey 139 MENUkey 125 MENUkey 60 NOTIFICATIONkey 127 SEARCHkey 217 SEARCHkey 228 POUNDkey 227 STARkey 231 CALLkey 61 CALLkey 97 DPAD_CENTERkey 232 DPAD_CENTERkey 108 DPAD_DOWNkey 103 DPAD_UPkey 102 HOMEkey 105 DPAD_LEFTkey 106 DPAD_RIGHTkey 115 VOLUME_UPkey 114 VOLUME_DOWNkey 104 VOLUME_UPkey 109 VOLUME_DOWNkey 212 CAMERAkey 16 Qkey 17 Wkey 18 Ekey 19 Rkey 20 Tkey 21 Ykey 22 Ukey 23 Ikey 24 Okey 25 Pkey 26 LEFT_BRACKETkey 27 RIGHT_BRACKETkey 43 BACKSLASHkey 30 Akey 31 Skey 32 Dkey 33 Fkey 34 Gkey 35 Hkey 36 Jkey 37 Kkey 38 Lkey 39 SEMICOLONkey 40 APOSTROPHEkey 14 DELkey 44 Zkey 45 Xkey 46 Ckey 47 Vkey 48 Bkey 49 Nkey 50 Mkey 51 COMMAkey 52 PERIODkey 53 SLASHkey 28 ENTERkey 75 F3key 76 F4key 77 F5key 64 F6key 65 F7key 66 F8key 67 F9key 68 F10key 69 F11key 56 ALT_LEFTkey 100 ALT_RIGHTkey 42 SHIFT_LEFTkey 54 SHIFT_RIGHT#key 15 TABkey 57 SPACEkey 70 EXPLORERkey 155 ENVELOPEkey 12 MINUSkey 13 EQUALSkey 215 ATkey 119 MEDIA_PLAY_PAUSEkey 122 MEDIA_PREVIOUSkey 123 MEDIA_NEXTkey 120 MEDIA_FAST_FORWARDkey 121 MEDIA_REWINDkey 116 POWER#key 116 POWER WAKEkey 113 VOLUME_MUTEkey 128 MEDIA_STOPkey 130 ZOOM_INkey 131 ZOOM_OUT#key 133 NETFLIXkey 140 F10#key 132 TV_REPEAT#key 134 TV_SHORTCUTKEY_DISPAYMODE#key 135 TV_SUBTITLE#key 136 TV_SHORTCUTKEY_VOICEMODE#key 137 TV_SWITCH例如上面的音量+键的scancode是09,对应的安卓功能键应该是115,修改内核源码的PROJECT/common/arch/arm64/boot/dts/amlogic/mesongxm.dtsi加入音量+键的scancode和安卓功能键码@@ -857,8 +857,8 @@ mapname = "amlogic-remote-5"; customcode = <0xfc02>; release_delay = <80>;- size = <0>;- keymap = <>;+ size = <1>;+ keymap = <REMOTE_KEY(0x09,115)>; } };然后编译后替换内核即可使用音量+键控制开发板音量增加了,其他按键同理可以在keymap下面添加,完成后编译内核替换即可使用笔者的红外遥控器使用效果如下 |
|