1.在对应的文件里添加设备树 如:
kernel/msm-3.18/arch/arm/boot/dts/qcom/msm8953-nopmi-qrd.dtsi
&soc {
gpio_keys {
compatible = "gpio-keys";
input-name = "gpio-keys";
pinctrl-names = "tlmm_gpio_key_active","tlmm_gpio_key_suspend";
pinctrl-0 = <&gpio_key_active>;
pinctrl-1 = <&gpio_key_suspend>;
vol_up {
label = "volume_up";
gpios = <&tlmm 85 0x1>;
linux,input-type = <1>;
linux,code = <115>;
debounce-interval = <15>;
};
/*laiyu modified start*/
vol_down {
label = "volume_down";
gpios = <&tlmm 90 0x1>;
linux,input-type = <1>;
linux,code = <114>;
gpio-key,wakeup;
debounce-interval = <15>;
};
home_key {
label = "home_key";
gpios = <&tlmm 91 0x1>;
linux,input-type = <1>;
linux,code = <102>;
gpio-key,wakeup;
debounce-interval = <15>;
};
back_button {
label = "back_button";
gpios = <&tlmm 63 0x1>;
linux,code = <158>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <6>;
};
menu_button {
label = "list_button";
gpios = <&tlmm 25 0x1>;
linux,code = <139>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <7>;
};
camera_key {
label = "camera_key";
gpios = <&tlmm 86 0x1>;
linux,code = <212>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <6>;
};
action_key { //
label = "action_key";
gpios = <&tlmm 87 0x1>;
linux,code = <59>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <6>;
};
scan_key1 {
label = "scan_key1"; ///
gpios = <&tlmm 137 0x1>;
linux,code = <60>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <6>;
};
scan_key {
label = "scan_key";
gpios = <&tlmm 35 0x1>;
linux,code = <61>;
linux,input-type = <1>;
gpio-key,wakeup;
debounce-interval = <15>;
//id = <6>;
};
/*laiyu modified end*/
};
.........................
2.在对应的pinctrl里修改重复gpio
3.如果在\device\google\atv\Generic.kl里没有按键定义 就在device/qcom/msm8953_64/gpio-keys.kl里先映射
补充:在\device\google\atv\Generic.kl里有按键定义 也要在device/qcom/msm8953_64/gpio-keys.kl 从新写一下
不然按键不起作用 getevent -l 里可以其作用 但是用的时候不起作用
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 102 HOME
key 528 FOCUS
key 766 CAMERA
key 59 F1
key 60 F2
key 61 F3
key 139 MENU // /加了就起作用了
key 158 BACK //加了就起作用了