ir触摸按键:
一.此部分为修改kernel内核宏开关
1>.longan\kernel\linux-4.9\arch\arm64\configs\sun50iw10p1smp_a133_android_defconfig
#ir
+CONFIG_IR_SUNXI=y
二.此部分为在设备树中添加board节点
2>.longan\kernel\linux-4.9\arch\arm64\boot\dts\sunxi\sun50iw10p1.dtsi
s_cir0: s_cir@07040000 {
compatible = "allwinner,s_cir";
reg = ;
interrupts = ;
pinctrl-names = "default";
pinctrl-0 = ;
clocks = ,;
status = "okay";
};
ir1: ir@0x05071000 {
compatible = "allwinner,ir_tx";
reg = ;
interrupts = ;
pinctrl-names = "default","sleep";
pinctrl-0 = ,;
clocks = ,;
+/- status = "disabled";
};
三.此部分为添加debug信息头
3>.longan\kernel\linux-4.9\drivers\media\rc\sunxi-ir-dev.c
#include "linux/power/aw_pm.h"
+ #define DEBUG
#define SUNXI_IR_DRIVER_NAME "sunxi-rc-recv"
四.设置默认宏开关管控
4>.longan\kernel\linux-4.9\drivers\media\rc\Kconfig
config IR_RC6_DECODER
tristate "Enable IR raw decoder for the RC6 protocol"
depends on RC_CORE
select BITREVERSE
+/- default n
---help---
Enable this option if you have an infrared remote control which
uses the RC6 protocol, and you need software decoding support.
config IR_JVC_DECODER
tristate "Enable IR raw decoder for the JVC protocol"
depends on RC_CORE
select BITREVERSE
+/ default n
---help---
Enable this option if you have an infrared remote control which
uses the JVC protocol, and you need software decoding support.
config IR_SONY_DECODER
tristate "Enable IR raw decoder for the Sony protocol"
depends on RC_CORE
select BITREVERSE
+/- default n
---help---
Enable this option if you have an infrared remote control which
uses the Sony protocol, and you need software decoding support.
config IR_SANYO_DECODER
tristate "Enable IR raw decoder for the Sanyo protocol"
depends on RC_CORE
+/- default n
---help---
Enable this option if you have an infrared remote control which
uses the Sanyo protocol (Sanyo, Aiwa, Chinon remotes),
and you need software decoding support.
config IR_SHARP_DECODER
tristate "Enable IR raw decoder for the Sharp protocol"
depends on RC_CORE
+/- default n
---help---
Enable this option if you have an infrared remote control which
uses the Sharp protocol (Sharp, Denon), and you need software
decoding support.
config IR_MCE_KBD_DECODER
tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol"
depends on RC_CORE
select BITREVERSE
+/- default n
---help---
Enable this option if you have a Microsoft Remote Keyboard for
Windows Media Center Edition, which you would like to use with
a raw IR receiver in your system.
config IR_XMP_DECODER
tristate "Enable IR raw decoder for the XMP protocol"
depends on RC_CORE
select BITREVERSE
+/- default n
---help---
Enable this option if you have IR with XMP protocol, and
if the IR is decoded in software
endif #RC_DECODERS
上面7个从y更改为n
//使用的是这种!
五.此部分为添加按键值
5>.longan\kernel\linux-4.9\drivers\media\rc\rc-sunxi-keymaps.c
static struct rc_map_table sunxi_nec_scan[] = {
- //{ KEY_ESC, KEY_ESC },
+ { 0xff0004, KEY_VOLUMEUP },
+ { 0xff0005, KEY_VOLUMEDOWN },
};
static struct rc_map_list sunxi_map = {
.map = {
.scan = sunxi_nec_scan,
.size = ARRAY_SIZE(sunxi_nec_scan),
- //#ifdef CONFIG_SUNXI_KEYMAPPING_SUPPORT
- // .mapping = (void *)sunxi_key_mapping,
- //#endif
.rc_type = RC_TYPE_NEC, /* Legacy IR type */
.name = RC_MAP_SUNXI,
}
};
六.在配置文件中将IR所需的映射文件导入到小机端
6>.android\device\softwinner\ceres-c3\ceres_c3.mk
+PRODUCT_COPY_FILES += \
+ device/softwinner/ceres-c3/configs/sunxi-ir.kl:system/usr/keylayout/sunxi-ir.kl
七.新增第六步所需的映射文件(内容为按键定义)
7>.android\device\softwinner\ceres-c3\configs\增加sunxi-ir.kl文件 //带弹黄的2key小板
key 114 VOLUME_DOWN
key 115 VOLUME_UP
八.此驱动主要为ir上报驱动(可根据需求自行设计修改)
8>.添加标志位限制按键发送次数:
longan/kernel/linux-4.9/drivers/media/rc/rc-main.c