全志H713红外IR遥控配置方法

简介: 这篇文章详细介绍了全志H713芯片平台配置红外遥控器的方法,包括获取遥控器规格、NEC协议的配置步骤、其他IR协议配置以及解决头码配置问题的方法。

篇头

  • 全志H713 Soc是一颗 A53四核心,支持MAX 2GB DDR, 支持1920x1080P LVDS接口, 支持梯形校正功能的芯片,非常适合用于开发投影仪,尤其是低成本的LCD投影。
  • 本文详细介绍此平台,配置一个新的红外遥控器的方法。

一、遥控器规格

  • 先拿到遥控器的规格书,获取用户码(头码)及其他按键的硬件码值
  • 确认IR的红外协议,此案例IR为NEC协议

image

二、NEC IR 配置方法

2.1 驱动开启NEC协议

  • 全志H713已默认开启NEC IR驱动
  • 可在menuconfig中查找下图【Remote controller support】配置的位置,进入后开启相关IR驱动

image

2.2 添加key-map文件

  • 根据IR规格书,用户码(头码)为0x807f为例,则新建如下文件,头码字节序要颠倒一下

  • vendor\aw\homlet\hardware\input\multi_ir\keylayout\customer_ir_7f80.kl

  • 如下,根据IR规格,填写键值映射关系

key 6   BACK
key 4   MENU
key 8   DPAD_CENTER
key 27   DPAD_DOWN
key 5   DPAD_UP
key 1   HOME
key 7   DPAD_LEFT
key 9   DPAD_RIGHT
key 12   VOLUME_UP
key 14   VOLUME_DOWN
key 18   POWER
key 61   TV_INPUT

2.3 将.kl文件追加到编译系统

  • 编辑 aw/homlet/hardware/input/multi_ir/multiir.mk
diff --git a/vendor/aw/homlet/hardware/input/multi_ir/multiir.mk b/vendor/aw/homlet/hardware/input/multi_ir/multiir.mk
index 9e700162ab..5aefa94f73 100644
--- a/vendor/aw/homlet/hardware/input/multi_ir/multiir.mk
+++ b/vendor/aw/homlet/hardware/input/multi_ir/multiir.mk
@@ -13,6 +13,7 @@ BASE_KL_COPY_LIST := virtual-remote.kl \
        customer_rc5_ir_04.kl \

 BASE_KL_COPY_LIST += customer_ir_9f00.kl \
+       customer_ir_7f80.kl \                ###<--- 添加自己的.kl到这里
        customer_ir_dd22.kl \
        customer_ir_fb04.kl \
        customer_ir_ff00.kl \

2.4 配置dts

  • 此处配置主要影响到待机后的电源键的响应,需分别配置borad.dts和uboot-board.dts
  • longan\device\config\chips\h713\configs\tuna_p3\linux-5.4\board.dts
  • longan\device\config\chips\h713\configs\tuna_p3\uboot-board.dts
  • 如下图,添加DC ON按键,其中ir_addr为IR用户码(头码)

image

1)board.dts
diff --git a/longan/device/config/chips/h713/configs/tuna_p3/linux-5.4/board.dts b/longan/device/config/chips/h713/configs/tuna_p3/linux-5.4/board.dts
index af9d8b7e2f..38baa35c8f 100755
--- a/longan/device/config/chips/h713/configs/tuna_p3/linux-5.4/board.dts
+++ b/longan/device/config/chips/h713/configs/tuna_p3/linux-5.4/board.dts
@@ -62,7 +62,7 @@
                gpio_group = "PL";
                gpio_pin = <9>;
                gpio_function = <3>;
-               count = <14>;
+               count = <15>;                    #### <-- 1. 增加1个按键的count数
                ir_power_key_code0 = <0x40>;
                ir_addr_code0 = <0xfe01>;
                ir_power_key_code1 = <0x1a>;
@@ -91,6 +91,8 @@
                ir_addr_code12 = <0xfb04>;
                ir_power_key_code13 = <0x42>;
                ir_addr_code13 = <0xbf00>;
+               ir_power_key_code14 = <0x12>;    #### <-- 2. 增加客制化的电源按键HW按键值
+               ir_addr_code14 = <0x7f80>;       #### <-- 3. 增加客制化IR的用户头码,注意字节序颠倒
        };2)uboot-board.dts (同理,修改此文件)
diff --git a/longan/device/config/chips/h713/configs/tuna_p3/uboot-board.dts b/longan/device/config/chips/h713/configs/tuna_p3/uboot-board.dts
index d166e3fa05..71adc28d51 100644
--- a/longan/device/config/chips/h713/configs/tuna_p3/uboot-board.dts
+++ b/longan/device/config/chips/h713/configs/tuna_p3/uboot-board.dts
@@ -62,7 +62,7 @@
                gpio_group = "PL";
                gpio_pin = <9>;
                gpio_function = <3>;
-               count = <14>;
+               count = <15>;                   
                ir_power_key_code0 = <0x40>;

@@ -73,7 +73,7 @@
                ir_power_key_code13 = <0x42>;
                ir_addr_code13 = <0xbf00>;
+               ir_power_key_code14 = <0x12>;
+               ir_addr_code14 = <0x7f80>;
        };
 };

三、其他IR协议

  • 以customer_rc5_ir_04.kl举例,将对应的协议名称追加在文件名中即可
  • 其余与NEC配置方法相同

四、附录

4.1 头码配置无效

  • 规格所写头码为0x807f,系统无法识别,将出现下面的现象
  • getevent 命令显示:按键无效,所有按键皆为0000
console:/ # getevent   

/dev/input/event1: 0004 0004 017f801b
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0004 0004 007f801b
/dev/input/event1: 0000 0000 00000000

4.2 头码配置有效

  • 将头码的字节序做一下颠倒,变为0x7f80
  • 按键生效的打印情况:
console:/ # getevent                                                           
add device 1: /dev/input/event4
  name:     "soc@2900000:gpio_keys"
add device 2: /dev/input/event3
  name:     "sunxi-ir-uinput"
add device 3: /dev/input/event0
  name:     "sunxi-gpadc0"
add device 4: /dev/input/event1
  name:     "sunxi-ir"
add device 5: /dev/input/event2
  name:     "audiocodec sunxi Audio Jack"


(1)上
/dev/input/event3: 0001 0013 00000001
/dev/input/event1: 0004 0004 017f8005    ###### 数据分解: 01-7f80-05  ,0x05为 UP key
/dev/input/event3: 0000 0000 00000000
/dev/input/event1: 0000 0000 00000000

/dev/input/event3: 0001 0013 00000000
/dev/input/event1: 0004 0004 007f8005
/dev/input/event3: 0000 0000 00000000
/dev/input/event1: 0000 0000 00000000


(2)下
/dev/input/event1: 0004 0004 017f801b     ###### 数据分解: 01-7f80-1b  ,0x1b为 DOWN key
/dev/input/event3: 0001 0014 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000
/dev/input/event3: 0001 0014 00000000
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000

(3)左
/dev/input/event1: 0004 0004 017f8007
/dev/input/event3: 0001 0015 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000

/dev/input/event1: 0004 0004 007f8007
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0001 0015 00000000
/dev/input/event3: 0000 0000 00000000

(4)右
/dev/input/event1: 0004 0004 017f8009
/dev/input/event3: 0001 0016 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000

/dev/input/event1: 0004 0004 007f8009
/dev/input/event3: 0001 0016 00000000
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000

(5)关机
/dev/input/event1: 0004 0004 017f8012
/dev/input/event3: 0001 0074 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000
/dev/input/event1: 0004 0004 007f8012
/dev/input/event3: 0001 0074 00000000
/dev/input/event1: 0000 0000 00000000
/dev/input/event3: 0000 0000 00000000

4.3 dumpsys input

130|console:/ # dumpsys input                                                  
INPUT MANAGER (dumpsys input)

Input Manager State:
  Interactive: true
  System UI Visibility: 0x8008
  Pointer Speed: 0
  Pointer Gestures Enabled: true
  Show Touches: false
  Pointer Capture Enabled: false

Event Hub State:
  BuiltInKeyboardId: -2
  Devices:
    -1: Virtual
      Classes: 0x40000023
      Path: <virtual>
      Enabled: true
      Descriptor: a718a782d34bc767f4689c232d64d527998ea7fd
      Location: 
      ControllerNumber: 0
      UniqueId: <virtual>
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Virtual.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
      VideoDevice: <none>
    1: sunxi-ir-uinput
      Classes: 0x0000002b
      Path: /dev/input/event3
      Enabled: true
      Descriptor: 0a253e777d1b2169367be63d7c9054e7991953a6
      Location: 
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x0000, product=0x0000, version=0x0004
      KeyLayoutFile: /vendor/usr/keylayout/sunxi-ir-uinput.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
      VideoDevice: <none>
    2: sunxi-ir
      Classes: 0x00000001
      Path: /dev/input/event1
      Enabled: true
      Descriptor: 485d69228e24f5e46da1598745890b214130dbc4
      Location: sunxi-ir/input0
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100
      KeyLayoutFile: /vendor/usr/keylayout/sunxi-ir.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
      VideoDevice: <none>
    4: audiocodec sunxi Audio Jack
      Classes: 0x00000081
      Path: /dev/input/event2
      Enabled: true
      Descriptor: d6a59aa863179ab43a39346203ca02f7639be982
      Location: ALSA
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
      VideoDevice: <none>
    5: soc@2900000:gpio_keys
      Classes: 0x00000001
      Path: /dev/input/event4
      Enabled: true
      Descriptor: d2c52ff0f656fac4cd7b7a118d575e0109a9fe1c
      Location: gpio-keys/input0
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
      VideoDevice: <none>
  Unattached video devices:
    <none>
相关文章
|
4月前
|
传感器 物联网 芯片
毕业设计 基于STM32单片机无线ZIGBEE智能大棚土壤湿度光照检测
毕业设计 基于STM32单片机无线ZIGBEE智能大棚土壤湿度光照检测
109 0
|
2月前
|
数据采集 传感器 存储
LabVIEW航空用电缆检测
LabVIEW航空用电缆检测
18 0
|
4月前
|
传感器 监控 芯片
LabVIEW利用以太网开发智能液位检测仪
LabVIEW利用以太网开发智能液位检测仪
32 1
【Matlab代码实现】电动过滤器:LPF和HPF、模拟调制:调幅和调频、WiFi、蓝牙和蜂窝网络的容量分析.....
【Matlab代码实现】电动过滤器:LPF和HPF、模拟调制:调幅和调频、WiFi、蓝牙和蜂窝网络的容量分析.....
120 0
|
传感器 前端开发 机器人
LabVIEW Arduino无线蓝牙遥控智能车(项目篇—2)
智能小车是以轮子作为移动机构,并且能够实现自主行驶的机器人,又被称为轮式机器人。由于具有智能化的特点,可以应用于不适合人类工作的环境中,例如灾难救援、户外探险等。智能小车有别于遥控小车,因为后者需要操作人员来控制其转向、启停和前进后退,以及控制其速度,常见的模型小车,都属于这类遥控车。智能小车,则可以通过计算机编程来实现其对行驶方向、启停以及速度的控制,无须人工干预,也可以通过修改智能小车的程序来改变它的行驶方式。 ———————————————— 版权声明:本文为CSDN博主「不脱发的程序猿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:htt
|
传感器 前端开发 机器人
基于单片机的智能循迹避障小车STC89C52红外对管L298N驱动PWM波控制速度
利用红外对管检测黑线与障碍物,并以STC89C52单片机为控制芯片控制电动小汽车的速度及转向,从而实现自动循迹避障的功能。其中小车驱动由L298N驱动电路完成,速度由单片机输出的PWM波控制。
293 0
|
存储 传感器 数据采集
GPS/GPRS车载定位系统智能终端设计μC/OS-Ⅱ调度液晶显示汽车行驶记录仪电路
GPS/GPRS车载定位系统智能终端设计μC/OS-Ⅱ调度液晶显示汽车行驶记录仪电路
102 0
|
传感器 API
MLX90640 红外热成像仪测温模块介绍说明
A 型和 B 型的区别 区别主要有以下几点 视场角不同: A 型为 110*75° , B 型为 55*35° ,通俗一点讲就是 A 型是广角,所以镜头矮一些,视野更宽,但对远处物体的捕捉能力更低, B 型更适于拍摄稍远的物体。精度不同: A 型的噪声比 B 型大,所以 B 型的绝对温度和灵敏度都好一些。
MLX90640 红外热成像仪测温模块介绍说明