一.kernel\arch\arm64\boot\dts\rockchip\rk3399-android.dtsi
rk_key: rockchip-key { compatible = "rockchip,key"; status = "okay"; //io-channels = <&saradc 0>; vol-up-key { linux,code = <115>; label = "volume up"; rockchip,adc_value = <1>; }; vol-down-key { linux,code = <114>; label = "volume down"; rockchip,adc_value = <170>; }; power-key { gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; linux,code = <116>; label = "power"; gpio-key,wakeup; }; gpio1-key { gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; linux,code = <131>; label = "gpio1 key"; gpio-key,wakeup; }; };
二.frameworks\native\include\android\keycodes.h
/** F1 key. */ AKEYCODE_F1 = 131, /** F2 key. */ AKEYCODE_F2 = 132, /** F3 key. */ AKEYCODE_F3 = 133,
三.rk29-keypad.kl 加按键值
系统 优先加载 system\usr\keylayout\rk29-keypad.kl
device\rockchip\common\rk29-keypad.kl
key 59 MENU key 102 HOME key 114 VOLUME_DOWN key 115 VOLUME_UP key 116 POWER key 143 NOTIFICATION key 158 BACK key 212 CAMERA key 217 SEARCH key 131 F1 key 132 F2 key 133 F3
四.frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java
public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags) {
else if(keyCode == 131){ if (!down) { //Log.d("gatsby", "gpio1_key xh_flag-> " + xh_flag +" gpio1_key num->"+gpio1_key); if(xh_flag){ if(gpio1_key %2 !=0){ RootCommand("settings put system screen_brightness 255"); toastTest("Highlight mode!"); }else { RootCommand("settings put system screen_brightness 110"); toastTest("Normal brightness!"); } } gpio1_key++; } return -1; }