IR Remote mouse support for VIM4

Hi @goenjoy As we checked IR remote cursor for VIM4 is not working.
Can you please give us any suggestions for that.
Thanks.

@VikasP We’re going to have a three-day holiday. You mean the remote mouse doesn’t work?

Hi @goenjoy Thanks for your response

yes Remote mouse doesn’t work

@VikasP
common$ git log -p

commit f3e00e7831a60b2b21c80c7e57d13a8313f43faf (HEAD -> vim4)
Date:   Wed Sep 14 14:54:16 2022 +0800

    IR: add mouse button function for khadas ir
    
    Change-Id: I500295c40d8494cbee1c94e41922655b740556be

diff --git a/arch/arm64/boot/dts/amlogic/meson-ir-map.dtsi b/arch/arm64/boot/dts/amlogic/meson-ir-map.dtsi
index 94133d1b4593..28ce1fff7652 100644
--- a/arch/arm64/boot/dts/amlogic/meson-ir-map.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-ir-map.dtsi
@@ -200,27 +200,33 @@
                                REMOTE_KEY(0x49, KEY_YELLOW)
                                REMOTE_KEY(0x4C, KEY_BLUE)>;
                };
-               map_4: map_4{
-                       mapname = "amlogic-remote-khadas";
-                       customcode = <0xff00>;
-                       release_delay = <80>;
-                       vendor = <0x0003>;
-                       product = <0x0003>;
-                       version = <0x0300>;
-                       size  = <13>;
-                       keymap = <REMOTE_KEY(0x14,KEY_POWER)
-                               REMOTE_KEY(0x13,KEY_MENU)
-                               REMOTE_KEY(0x03,KEY_UP)
-                               REMOTE_KEY(0x02,KEY_DOWN)
-                               REMOTE_KEY(0x0e,KEY_LEFT)
-                               REMOTE_KEY(0x1a,KEY_RIGHT)
-                               REMOTE_KEY(0x07,KEY_ENTER)
-                               REMOTE_KEY(0x58,KEY_VOLUMEDOWN)
-                               REMOTE_KEY(0x5c,KEY_F5)
-                               REMOTE_KEY(0x5b,KEY_F5)
-                               REMOTE_KEY(0x0b,KEY_VOLUMEUP)
-                               REMOTE_KEY(0x01,KEY_BACK)
-                               REMOTE_KEY(0x48,KEY_HOME)>;
-               };
+                map_4: map_4{
+                        mapname = "amlogic-remote-khadas";
+                        customcode = <0xff00>;
+                        release_delay = <80>;
+                        vendor = <0x0003>;
+                        product = <0x0003>;
+                        version = <0x0300>;
+                        size  = <13>;
+                        fn_key_scancode = <0x5b>;
+                        cursor_left_scancode = <0x0e>;
+                        cursor_right_scancode = <0x1a>;
+                        cursor_up_scancode = <0x03>;
+                        cursor_down_scancode = <0x02>;
+                        cursor_ok_scancode = <0x07>;
+                        keymap = <REMOTE_KEY(0x14,KEY_POWER)
+                                REMOTE_KEY(0x13,KEY_MENU)
+                                REMOTE_KEY(0x03,KEY_UP)
+                                REMOTE_KEY(0x02,KEY_DOWN)
+                                REMOTE_KEY(0x0e,KEY_LEFT)
+                                REMOTE_KEY(0x1a,KEY_RIGHT)
+                                REMOTE_KEY(0x07,KEY_ENTER)
+                                REMOTE_KEY(0x58,KEY_VOLUMEDOWN)
+                                REMOTE_KEY(0x5c,KEY_F5)
+                                REMOTE_KEY(0x5b,KEY_F5)
+                                REMOTE_KEY(0x0b,KEY_VOLUMEUP)
+                                REMOTE_KEY(0x01,KEY_BACK)
+                                REMOTE_KEY(0x48,KEY_HOME)>;
+                };
        };
 };
diff --git a/drivers/amlogic/input/ir/meson_ir_main.c b/drivers/amlogic/input/ir/meson_ir_main.c
index f9d2fb373114..22458bb9e326 100644
--- a/drivers/amlogic/input/ir/meson_ir_main.c
+++ b/drivers/amlogic/input/ir/meson_ir_main.c
@@ -235,7 +235,7 @@ static u32 meson_ir_getkeycode(struct meson_ir_dev *dev, u32 scancode)
            scancode == ct->tab.cursor_code.cursor_ok_scancode) {
                meson_ir_dbg(chip->r_dev, "mouse left button scancode: 0x%x",
                             BTN_LEFT);
-               return BTN_LEFT;
+               return BTN_MOUSE;
        }
 
        index = meson_ir_lookup_by_scancode(&ct->tab, scancode);
@@ -538,6 +538,51 @@ static int meson_ir_get_custom_tables(struct device_node *node,
 
                memset(&ptable->tab.cursor_code, 0xff,
                       sizeof(struct cursor_codemap));
+
+        if (strcmp(ptable->tab.custom_name, "amlogic-remote-khadas") == 0) {
+                ret = of_property_read_u32(map, "fn_key_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config fn_key_scancode item\n");
+                        goto err;
+                }
+                ptable->tab.cursor_code.fn_key_scancode = value;
+
+                ret = of_property_read_u32(map, "cursor_left_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config cursor_left_scancode item\n");
+                        goto err;
+                }
+                ptable->tab.cursor_code.cursor_left_scancode = value;
+
+                ret = of_property_read_u32(map, "cursor_right_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config cursor_right_scancode item\n")    ;
+                        goto err;
+                }
+                ptable->tab.cursor_code.cursor_right_scancode = value;
+
+                ret = of_property_read_u32(map, "cursor_up_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config cursor_up_scancode item\n");
+                        goto err;
+                }
+                ptable->tab.cursor_code.cursor_up_scancode = value;
+
+                ret = of_property_read_u32(map, "cursor_down_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config cursor_down_scancode item\n");
+                        goto err;
+                }
+                ptable->tab.cursor_code.cursor_down_scancode = value;
+
+                ret = of_property_read_u32(map, "cursor_ok_scancode", &value);
+                if (ret) {
+                        dev_err(chip->dev, "please config cursor_ok_scancode item\n");
+                        goto err;
+                }
+                ptable->tab.cursor_code.cursor_ok_scancode= value;
+        }
+
                meson_ir_scancode_sort(&ptable->tab);
                /*insert list*/
                spin_lock_irqsave(&chip->slock, flags);

Hi @goenjoy IR Moues is working :slight_smile: Thanks for the solution!!

if i will download the latest code… is this code is already updated there for IR remote Mouse in latest build?

We won’t update the code frequently. Let’s wait a while.

Hello @goenjoy is this IR Remote Mouse patch is updated on your latest code.

Hello @goenjoy

IR remote mouse cursor is moving very slowly so any changes so we can increase the moving speed of IR remote mouse cursor

@VikasP Settings->System->Languages & input->Advanced->Pointer speed