First, describe the function. After the reserved mouse button is configured on the remote control, the function is realized by pressing the mouse button. The icon of the left mouse button appears on the TV screen. The direction navigation controls the movement direction up, down, left, and right. Click the mouse button again To restore the default functions of the remote control.
Below, I randomly found a remote control and changed the button to mouse button
Kernel corresponding remote control adaptation dts under the adaptation remote control
dts code added
map_1: map_1{
mapname = "amlogic-remote-2";
customcode = <0xf708>;
release_delay = <80>;
fn_key_scancode = <0x66>;//给鼠标按键设置一个键值
//方向键的适配
cursor_left_scancode = <0x03>;
cursor_right_scancode = <0x02>;
cursor_up_scancode = <0x00>;
cursor_down_scancode = <0x01>;
cursor_ok_scancode = <0x1f>;
//方向键的适配
size = <17>;
keymap = <REMOTE_KEY(0x00,103) // DPAD_UP
REMOTE_KEY(0x01,108) // DPAD_DOWN
REMOTE_KEY(0x03,105) // DPAD_LEFT
REMOTE_KEY(0x02,106) // DPAD_RIGHT
REMOTE_KEY(0x1f,97) // DPAD_CENTER
REMOTE_KEY(0x66,580) // ALL_APPS
REMOTE_KEY(0x74,582) // VOICE_ASSIST
REMOTE_KEY(0x0c,102) // HOME
REMOTE_KEY(0x0a,116) // POWER
REMOTE_KEY(0x1c,15) // BACK
REMOTE_KEY(0xd6,125) // MENU
REMOTE_KEY(0x58,104) // VOLUME_UP
REMOTE_KEY(0x5d,109) // VOLUME_DOWN
REMOTE_KEY(0x0d,113) // VOLUME_MUTE
REMOTE_KEY(0x4d,600) // YOUTUBE
REMOTE_KEY(0x4e,601) // NETFLIX
REMOTE_KEY(0x4f,602)>; // GOOGLEPLAY
};
Adaptation patch provided by amlogic platform
Patch 2:
diff --git a/drivers/amlogic/input/remote/remote_meson.c b/drivers/amlogic/input/remote/remote_meson.c
index 43a360d..95061d6 100644
--- a/drivers/amlogic/input/remote/remote_meson.c
+++ b/drivers/amlogic/input/remote/remote_meson.c
@@ -125,6 +125,7 @@ static int ir_lookup_by_scancode(struct ir_map_tab *ir_map,
while (start <= end) {
mid = (start + end) >> 1;
+ pr_info("ir_lookup_by_scancode mid %d ccode 0x%x scancode 0x%x \n", mid , ir_map->codemap[mid].map.scancode , scancode );
if (ir_map->codemap[mid].map.scancode < scancode)
start = mid + 1;
else if (ir_map->codemap[mid].map.scancode > scancode)
@@ -209,6 +210,7 @@ static u32 getkeycode(struct remote_dev *dev, u32 scancode)
}
index = ir_lookup_by_scancode(&ct->tab, scancode);
+ dev_err(chip->dev, " getkeycode index %d scancode 0x%x \n", index , scancode);
if (index < 0) {
dev_err(chip->dev, "scancode %d undefined\n", scancode);
return KEY_RESERVED;
@@ -450,6 +452,42 @@ static int get_custom_tables(struct device_node *node,
memset(&ptable->tab.cursor_code, 0xff,sizeof(struct cursor_codemap));
+//merge amlogic patch for mouse button
+if(index == 1){
//配置的遥控器对应的index
+ ret = of_property_read_u32(map, "fn_key_scancode" ,&value);
+ ptable->tab.cursor_code.fn_key_scancode = (__u16)value;
+
+ ret = of_property_read_u32(map, "cursor_left_scancode", &value);
+ ptable->tab.cursor_code.cursor_left_scancode = (__u16)value;
+
+ ret = of_property_read_u32(map, "cursor_right_scancode", &value);
+ ptable->tab.cursor_code.cursor_right_scancode = (__u16)value;
+ ret = of_property_read_u32(map, "cursor_up_scancode", &value);
+ ptable->tab.cursor_code.cursor_up_scancode = (__u16)value;
+
+ ret = of_property_read_u32(map, "cursor_down_scancode", &value);
+ ptable->tab.cursor_code.cursor_down_scancode = (__u16)value;
+ dev_err(chip->dev, " dhflog 666 get_custom_tables cursor_down_scancode 0x%x\n " ,value);
+
+ ret = of_property_read_u32(map, "cursor_ok_scancode", &value);
+ ptable->tab.cursor_code.cursor_ok_scancode = (__u16)value;
+
+}
+//merge amlogic patch for mouse button
+
ir_scancode_sort(&ptable->tab);
/*insert list*/
spin_lock_irqsave(&chip->slock, flags);
(END)