Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:vim3:applications:ir

VIM3/3L IR remote

This documentation is only used for Android.

This document guides you to add IR input keys on Android.

Hardware Configuration

IR_IN (Infrared input signal) ↔ GPIOAO_5 (Infrared input port)

Android 9 software configuration

1. For VIM3, add the mapping from remote control code value to key value, enable remote control driver configuration in common/arch/arm/boot/dts/amlogic/mesong12b.dtsi

remote:rc@0xff808040 {
        compatible = "amlogic, aml_remote";
        dev_name = "meson-remote";
        reg = <0xff808040 0x44>, /*Multi-format IR controller*/
                <0xff808000 0x20>; /*Legacy IR controller*/
        status = "okay";
        protocol = <REMOTE_TYPE_NEC>;
        interrupts = <0 196 1>;
        pinctrl-names = "default";
        pinctrl-0 = <&remote_pins>;
        map = <&custom_maps>;
        max_frame_time = <200>; /*set software decoder max frame time*/
};
 
custom_maps:custom_maps {
        mapnum = <1>;
        map0 = <&map_0>;
        map_0: map_0{
                mapname = "khadas-ir";
                customcode = <0xff00>;
                release_delay = <80>;
                fn_key_scancode = <0x5b>;
                cursor_left_scancode = <0x0e>;
                cursor_right_scancode = <0x1a>;
                cursor_up_scancode = <0x03>;
                cursor_down_scancode = <0x02>;
                cursor_ok_scancode = <0x07>;
                size  = <13>;   /*keymap size*/
                keymap = <REMOTE_KEY(0x14, 116)
                        REMOTE_KEY(0x13,139)
                        REMOTE_KEY(0x03,103)
                        REMOTE_KEY(0x02,108)
                        REMOTE_KEY(0x0e,105)
                        REMOTE_KEY(0x1a,106)
                        REMOTE_KEY(0x07,232)
                        REMOTE_KEY(0x58,114)
                        REMOTE_KEY(0x5c,63)
                        REMOTE_KEY(0x5b,63)
                        REMOTE_KEY(0x0b,115)
                        REMOTE_KEY(0x01,158)
                        REMOTE_KEY(0x48,102)>;
        };
};

At present, the VIM3/VIM3L Android 9 platform is only equipped with the infrared remote control of khadas IR. if you need to add the remote control of NEC protocol, you can add the mapping of key values in the same location, such as map1, map2, the customer code of the remote control and so on. finally, mapnum is incremented by 1.

2. Add the Keylayout File device/khadas/kvim3/files/Vendor_0001_Product_0001.kl, and compile to /vendor/usr/keylayout directory

$vi device/khadas/kvim3/files/Vendor_0001_Product_0001.kl
key 139    MENU
key 125    MENU
key 60    NOTIFICATION
key 127   SEARCH
key 217   SEARCH
key 228   POUND
key 227   STAR
key 231   CALL
key 61    CALL
key 97    DPAD_CENTER
key 232   DPAD_CENTER
key 108   DPAD_DOWN
key 103   DPAD_UP
key 102   HOME
key 105   DPAD_LEFT
key 106   DPAD_RIGHT
key 115   VOLUME_UP
key 114   VOLUME_DOWN
key 104   VOLUME_UP
key 109   VOLUME_DOWN
key 212   CAMERA

Remote key value query

If the driver and *.kl file are added correctly, Enter the command getevent -l and press the remote control to view the key value.

# getevent -l 
 
/dev/input/event0: 0004 000400000068                       <--- IR Code 0x68=104
 
/dev/input/event0: 0001 0042 00000001                       
 
/dev/input/event0:EV_MSC      MSC_SCAN             00000068      
 
/dev/input/event0:EV_KEY      KEY_VOLUME_UP              DOWN    <--- linux key name KEY_VOLUME_UP
Last modified: 2024/08/06 08:48 by nick