From ebf851235ad4640b758ce1f090f58584891a1b2f Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Tue, 5 Nov 2024 20:32:16 -0500 Subject: [PATCH 1/3] fwk: add fn key combinations for row B end keys Maps fn+Z to the ISO 102nd key, and fn+/ to the extra key left of right shift on Brazilian and Japanese layouts. This allows full use of ISO and Brazilian layouts on ANSI, ISO, or JIS keyboard hardware. (Alternately, users can remap these keys in the OS to whatever function they prefer.) Signed-off-by: Jules Bertholet --- board/hx20/keyboard_customization.c | 8 ++++++++ board/hx20/keyboard_customization.h | 2 ++ board/hx30/keyboard_customization.c | 8 ++++++++ board/hx30/keyboard_customization.h | 2 ++ 4 files changed, 20 insertions(+) diff --git a/board/hx20/keyboard_customization.c b/board/hx20/keyboard_customization.c index 2b91f2e0c1..2cd76aeee8 100644 --- a/board/hx20/keyboard_customization.c +++ b/board/hx20/keyboard_customization.c @@ -384,6 +384,14 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) /*if (!fn_table_set(pressed, KB_FN_S))*/ break; + case 0x001A: /* Z -> 102ND */ + if (fn_table_set(pressed, KB_FN_Z)) + *key_code = 0x0061; + break; + case 0x004A: /* ? -> RO KANA */ + if (fn_table_set(pressed, KB_FN_QUESTIONMARK)) + *key_code = 0x0051; + break; case SCANCODE_LEFT: /* HOME */ if (fn_table_set(pressed, KB_FN_LEFT)) *key_code = 0xe06c; diff --git a/board/hx20/keyboard_customization.h b/board/hx20/keyboard_customization.h index bda89c4d8c..351ddd9b9c 100644 --- a/board/hx20/keyboard_customization.h +++ b/board/hx20/keyboard_customization.h @@ -96,6 +96,8 @@ enum kb_fn_table { KB_FN_B = BIT(20), KB_FN_P = BIT(21), KB_FN_SPACE = BIT(22), + KB_FN_Z = BIT(25), + KB_FN_QUESTIONMARK = BIT(26), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT diff --git a/board/hx30/keyboard_customization.c b/board/hx30/keyboard_customization.c index 2b91f2e0c1..2cd76aeee8 100644 --- a/board/hx30/keyboard_customization.c +++ b/board/hx30/keyboard_customization.c @@ -384,6 +384,14 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) /*if (!fn_table_set(pressed, KB_FN_S))*/ break; + case 0x001A: /* Z -> 102ND */ + if (fn_table_set(pressed, KB_FN_Z)) + *key_code = 0x0061; + break; + case 0x004A: /* ? -> RO KANA */ + if (fn_table_set(pressed, KB_FN_QUESTIONMARK)) + *key_code = 0x0051; + break; case SCANCODE_LEFT: /* HOME */ if (fn_table_set(pressed, KB_FN_LEFT)) *key_code = 0xe06c; diff --git a/board/hx30/keyboard_customization.h b/board/hx30/keyboard_customization.h index 8b8bdcc145..2c82fb215c 100644 --- a/board/hx30/keyboard_customization.h +++ b/board/hx30/keyboard_customization.h @@ -96,6 +96,8 @@ enum kb_fn_table { KB_FN_B = BIT(20), KB_FN_P = BIT(21), KB_FN_SPACE = BIT(22), + KB_FN_Z = BIT(25), + KB_FN_QUESTIONMARK = BIT(26), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT From 2497ac1dac29af6bf9e2cdc22745163a830d0df3 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sat, 9 Nov 2024 10:10:37 -0500 Subject: [PATCH 2/3] fwk: map fn+= to Yen key Maps fn+= to the JIS Yen key to the left of Backspace (also the Won key on certain Korean layouts). This allows fuller use of these layouts on non-JIS hardware; alternately, users can remap this keys in the OS to whatever function they prefer. Signed-off-by: Jules Bertholet --- board/hx20/keyboard_customization.c | 4 ++++ board/hx20/keyboard_customization.h | 1 + board/hx30/keyboard_customization.c | 4 ++++ board/hx30/keyboard_customization.h | 1 + 4 files changed, 10 insertions(+) diff --git a/board/hx20/keyboard_customization.c b/board/hx20/keyboard_customization.c index 2cd76aeee8..825469cfcb 100644 --- a/board/hx20/keyboard_customization.c +++ b/board/hx20/keyboard_customization.c @@ -376,6 +376,10 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) if (fn_table_set(pressed, KB_FN_DELETE)) *key_code = 0xe070; break; + case 0x0055: /* = -> YEN */ + if (fn_table_set(pressed, KB_FN_EQUALS)) + *key_code = 0x006A; + break; case SCANCODE_K: /* TODO: SCROLL_LOCK */ if (fn_table_set(pressed, KB_FN_K)) *key_code = SCANCODE_SCROLL_LOCK; diff --git a/board/hx20/keyboard_customization.h b/board/hx20/keyboard_customization.h index 351ddd9b9c..a5ccb4bc57 100644 --- a/board/hx20/keyboard_customization.h +++ b/board/hx20/keyboard_customization.h @@ -98,6 +98,7 @@ enum kb_fn_table { KB_FN_SPACE = BIT(22), KB_FN_Z = BIT(25), KB_FN_QUESTIONMARK = BIT(26), + KB_FN_EQUALS = BIT(27), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT diff --git a/board/hx30/keyboard_customization.c b/board/hx30/keyboard_customization.c index 2cd76aeee8..825469cfcb 100644 --- a/board/hx30/keyboard_customization.c +++ b/board/hx30/keyboard_customization.c @@ -376,6 +376,10 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) if (fn_table_set(pressed, KB_FN_DELETE)) *key_code = 0xe070; break; + case 0x0055: /* = -> YEN */ + if (fn_table_set(pressed, KB_FN_EQUALS)) + *key_code = 0x006A; + break; case SCANCODE_K: /* TODO: SCROLL_LOCK */ if (fn_table_set(pressed, KB_FN_K)) *key_code = SCANCODE_SCROLL_LOCK; diff --git a/board/hx30/keyboard_customization.h b/board/hx30/keyboard_customization.h index 2c82fb215c..3dc06edc83 100644 --- a/board/hx30/keyboard_customization.h +++ b/board/hx30/keyboard_customization.h @@ -98,6 +98,7 @@ enum kb_fn_table { KB_FN_SPACE = BIT(22), KB_FN_Z = BIT(25), KB_FN_QUESTIONMARK = BIT(26), + KB_FN_EQUALS = BIT(27), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT From 53922c843af639df9ee6be4c173a6ea6bd5873b0 Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Sat, 16 Nov 2024 17:43:41 -0500 Subject: [PATCH 3/3] fwk: add fn key mappings for JIS IME keys fn+C is mapped to Muhenkan, fn+M is mapped to Henkan, and fn+, is mapped to Katakana/Hiragana. Signed-off-by: Jules Bertholet --- board/hx20/keyboard_customization.c | 12 ++++++++++++ board/hx20/keyboard_customization.h | 3 +++ board/hx30/keyboard_customization.c | 12 ++++++++++++ board/hx30/keyboard_customization.h | 3 +++ 4 files changed, 30 insertions(+) diff --git a/board/hx20/keyboard_customization.c b/board/hx20/keyboard_customization.c index 825469cfcb..c59d780d8b 100644 --- a/board/hx20/keyboard_customization.c +++ b/board/hx20/keyboard_customization.c @@ -392,6 +392,18 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) if (fn_table_set(pressed, KB_FN_Z)) *key_code = 0x0061; break; + case 0x0021: /* C -> MUHENKAN */ + if (fn_table_set(pressed, KB_FN_C)) + *key_code = 0x0067; + break; + case 0x003A: /* M -> HENKAN */ + if (fn_table_set(pressed, KB_FN_M)) + *key_code = 0x0064; + break; + case 0x0041: /* , -> KATAKANA HIRAGANA */ + if (fn_table_set(pressed, KB_FN_COMMA)) + *key_code = 0x0013; + break; case 0x004A: /* ? -> RO KANA */ if (fn_table_set(pressed, KB_FN_QUESTIONMARK)) *key_code = 0x0051; diff --git a/board/hx20/keyboard_customization.h b/board/hx20/keyboard_customization.h index a5ccb4bc57..af2f1436d0 100644 --- a/board/hx20/keyboard_customization.h +++ b/board/hx20/keyboard_customization.h @@ -99,6 +99,9 @@ enum kb_fn_table { KB_FN_Z = BIT(25), KB_FN_QUESTIONMARK = BIT(26), KB_FN_EQUALS = BIT(27), + KB_FN_C = BIT(28), + KB_FN_M = BIT(29), + KB_FN_COMMA = BIT(30), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT diff --git a/board/hx30/keyboard_customization.c b/board/hx30/keyboard_customization.c index 825469cfcb..c59d780d8b 100644 --- a/board/hx30/keyboard_customization.c +++ b/board/hx30/keyboard_customization.c @@ -392,6 +392,18 @@ int hotkey_special_key(uint16_t *key_code, int8_t pressed) if (fn_table_set(pressed, KB_FN_Z)) *key_code = 0x0061; break; + case 0x0021: /* C -> MUHENKAN */ + if (fn_table_set(pressed, KB_FN_C)) + *key_code = 0x0067; + break; + case 0x003A: /* M -> HENKAN */ + if (fn_table_set(pressed, KB_FN_M)) + *key_code = 0x0064; + break; + case 0x0041: /* , -> KATAKANA HIRAGANA */ + if (fn_table_set(pressed, KB_FN_COMMA)) + *key_code = 0x0013; + break; case 0x004A: /* ? -> RO KANA */ if (fn_table_set(pressed, KB_FN_QUESTIONMARK)) *key_code = 0x0051; diff --git a/board/hx30/keyboard_customization.h b/board/hx30/keyboard_customization.h index 3dc06edc83..70a94cba89 100644 --- a/board/hx30/keyboard_customization.h +++ b/board/hx30/keyboard_customization.h @@ -99,6 +99,9 @@ enum kb_fn_table { KB_FN_Z = BIT(25), KB_FN_QUESTIONMARK = BIT(26), KB_FN_EQUALS = BIT(27), + KB_FN_C = BIT(28), + KB_FN_M = BIT(29), + KB_FN_COMMA = BIT(30), }; #ifdef CONFIG_KEYBOARD_BACKLIGHT