ivoanjo 33 Posted April 3, 2021 Share Posted April 3, 2021 I recently migrated to LineageOS from stock, where I was a happy FinQWERTY user. After seeing it was broken and finding out in the forums that FinQWERTY is expected not to work, I've been crawling all threads related to keyboard layouts and adjustments and nothing I did worked. (In my case -- I'd like to type Portuguese, so I want combining ` ' ~ ^ and ç; none of the built-in options really seem to be comfortable for typing. There's a few alt combinations that are really hard to reach for a couple of them, but not all...) I tried tweaking a KCM as described in but the changes don't seem to be applied. I also found out about /data/system/keyboard/keymap (see https://github.com/LineageOS/android_device_fxtec_pro1/blob/2bfa41a3f649e1c97b588dc08ee7ff09d7bd1447/devicesettings/src/org/lineageos/settings/device/Constants.java#L27 ) but I don't really understand the format, since it's different from the kcms. Has anyone managed to customize the keyboard on LineageOS? It'd be a big shame if I needed to go back to stock just so I could type comfortably 😕 4 Quote Link to post Share on other sites
sorgo 13 Posted April 13, 2021 Share Posted April 13, 2021 This is a detailed explanation of the key character map files: https://source.android.com/devices/input/key-character-map-files I am trying to achieve something similar, will post if find a way. Currently only change i saw was that the "custom keymaps" switch is enabled in the settings, but could not get to work anything. 1 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted April 13, 2021 Share Posted April 13, 2021 Something odd seems to be wrong with the keyboard handling on 18.1 (I added an error report on it here) 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted April 13, 2021 Share Posted April 13, 2021 5 hours ago, EskeRahn said: Something odd seems to be wrong with the keyboard handling on 18.1 (I added an error report on it here) The short story: the keyboard layouts seem to need a factory reset after upgrade to 18.1 For the long story, see the error report linked above... 2 Quote Link to post Share on other sites
Sean McCreary 328 Posted April 14, 2021 Share Posted April 14, 2021 On 4/3/2021 at 10:05 AM, ivoanjo said: Has anyone managed to customize the keyboard on LineageOS? It'd be a big shame if I needed to go back to stock just so I could type comfortably 😕 tdm added a feature to his keyboard driver that allows the user to specify a custom keyboard map. Unfortunately there is no documentation (other than the source code), but you should be able to remap any non-modifier key (e.g. not shift or ctrl) to generate any keycode you want. By default, the QWERTY and QWERTZ maps are set to match each key to the glyph printed on top, but of course the FinQWERTY maps make different choices than F(x)tec did when they designed the two keyboard layouts. The relevant source code is here: https://github.com/LineageOS/android_device_fxtec_pro1/tree/lineage-18.1/devicesettings/src/org/lineageos/settings/device and here: https://github.com/LineageOS/android_kernel_fxtec_msm8998/blob/lineage-18.1/drivers/input/keyboard/qx1000.c plus the Linux input event codes listed here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h#L75 Your custom keymap file should be placed in "/data/system/keyboard/keymap", and uses a custom format that I will describe below. Each line in the custom keymap file specifies a triplet of numbers, each on a single line and separated with colons. The first parameter is a decimal 'key number' specific to tdm's kernel driver, which are listed here in the qx1000.c source file. Referring to: https://github.com/LineageOS/android_kernel_fxtec_msm8998/blob/lineage-18.1/drivers/input/keyboard/qx1000.c#L330 Quote /* 48..55 */ KEY_SPACE, KEY_G, KEY_V, KEY_M, KEY_I, KEY_8, KEY_T, KEY_5, Key #48 is mapped to KEY_SPACE by default, and is the spacebar key on the physical keyboard. In similar fashion, key #49 is 'G', and key #53 is '8'. Now, Referring back to the first custom keymap example from the Java code: https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/devicesettings/src/org/lineageos/settings/device/Constants.java#L29 Quote public static final String[] KEYBOARD_KEYMAP_SPACEPOWER_TEXT = { "48:0039:0074" }; Recall that the first number in the the triplet is the driver key number, in decimal. The second and third numbers in the triplet are Linux input event codes the key should generate in hexadecimal. These are codes from input-event-codes.h, for example: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h#L132 Quote #define KEY_LEFTALT 56 #define KEY_SPACE 57 #define KEY_CAPSLOCK 58 The second number listed in the modified keymap is 0x39 (or 57 in decimal), and corresponds to KEY_SPACE. The third number in the the triplet is the Linux input event code the key should generate when chorded with the 'fn' or diagonal yellow arrow keys, and in this case is 0x74 (116 in decimal) or KEY_POWER. So this remapping changes Fn-Spacebar from the default value of KEY_WWW to KEY_POWER. Now, there is a second sample remapping in: https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/devicesettings/src/org/lineageos/settings/device/Constants.java#L33 KEYBOARD_KEYMAP_FNKEYS_TEXT defines a more complex keymap alteration which makes the number keys in the top row generate their function key equivalent when chorded with the 'fn' keys on the keyboard. Hopefully I've provided enough information to allow you to decode these modifications on your own. With a bit of work it should be possible to encode the FinQWERTY keymaps using this alternate remapping feature. However, simple changes (like adding a specific missing key) should be fairly simple and straightforward. 1 8 Quote Link to post Share on other sites
Rob. S. 1,649 Posted April 14, 2021 Share Posted April 14, 2021 13 hours ago, EskeRahn said: The short story: the keyboard layouts seem to need a factory reset after upgrade to 18.1 For the long story, see the error report linked above... Bummer... 1 Quote Link to post Share on other sites
pebert 98 Posted May 21, 2021 Share Posted May 21, 2021 has anyone got this working? did not really catch McCreary´s explanation above. 2 Quote Link to post Share on other sites
EskeRahn 5,433 Posted May 22, 2021 Share Posted May 22, 2021 On 4/14/2021 at 1:44 PM, Rob. S. said: Bummer... It seems to not always be a requirement, but it do seem to fix it if you got the issue. But an upgrade can survive! The precise condition for when it survives and when it fails is unfortunately currently unknown. PERHAPS it is related to installed keyboard drivers and/or FinQWERTY, but could well be even more complex. Mine was upgraded from 16 to 17 last year and now to 18. I do not recall if I even made a factory reset going from test-16 to release-16 in the autumn... So might be old rudiments that triggers the issue now. If so it could be very hard to reproduce consistently, and thus not very likely to be remedied. 1 Quote Link to post Share on other sites
TeZtdevice 285 Posted June 11, 2021 Share Posted June 11, 2021 I have a fresh installed version of 18.1, but just only the Z and Y are correct on my QWERTZ layout. Any chance to get the full keyboard working? Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 11, 2021 Share Posted June 11, 2021 2 hours ago, TeZtdevice said: I have a fresh installed version of 18.1, but just only the Z and Y are correct on my QWERTZ layout. Any chance to get the full keyboard working? I'm not sure I quite understand your question. You can select the physical layout Inside Lineage settings ("languages and input", "physical keyboard", "Advanced settings", "physical layout"). If it is selecting the layout you wish, that does not seem to work, then see a few pages back, where I had odd problems with the layouts going to 18.1, that was fixed by a factory reset. We never really found out why the upgrade failed. For some the upgrade goes just fine, so some combo with other stuff... Quote Link to post Share on other sites
TeZtdevice 285 Posted June 12, 2021 Share Posted June 12, 2021 Thx EskeRahn 🙂 I read the info about the factory reset. I didn`t do a upgrade from 16 or 17 to 18.1., Just a clean install over Android. That`s why I won`t think a factory reset would help?! 🙂 After the installation I select the german layout for my hardware kb, but only the Z and Y are correct. Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 12, 2021 Share Posted June 12, 2021 2 minutes ago, TeZtdevice said: Thx EskeRahn 🙂 I read the info about the factory reset. I didn`t do a upgrade from 16 or 17 to 18.1., Just a clean install over Android. That`s why I won`t think a factory reset would help?! 🙂 After the installation I select the german layout for my hardware kb, but only the Z and Y are correct. You need to BOTH tell it whether it is the qwertZ or qwertY version (see above) and ALSO select the language you want to type on it. e.g. German on qwertZ. 1 Quote Link to post Share on other sites
TeZtdevice 285 Posted June 13, 2021 Share Posted June 13, 2021 17 minutes ago, EskeRahn said: You need to BOTH tell it whether it is the qwertZ or qwertY version (see above) and ALSO select the language you want to type on it. e.g. German on qwertZ. Yes. I selected both. German as language and as physical layout QWERTZ. Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 13, 2021 Share Posted June 13, 2021 8 hours ago, TeZtdevice said: Yes. I selected both. German as language and as physical layout QWERTZ. Oh you are right, sorry did not test, just asummed it still worked.... But yes It is destroyed on mine again(!) Ctrl+Space for changing languages is again ignored. Is it on yours two? (you have to have selected more than one first obviously) I will try to do a factory reset (yes tedious!!!) to see if this fixes it this time too.... (tried the two softer resets of network and then apps, and as expected that did NOT make any difference) Quote Link to post Share on other sites
TeZtdevice 285 Posted June 13, 2021 Share Posted June 13, 2021 15 minutes ago, EskeRahn said: Oh you are right, sorry did not test, just asummed it still worked.... But yes It is destroyed on mine again(!) Ctrl+Space for changing languages is again ignored. Is it on yours two? (you have to have selected more than one first obviously) I will try to do a factory reset (yes tedious!!!) to see if this fixes it this time too.... (tried the two softer resets of network and then apps, and as expected that did NOT make any difference) Oh no, I hope this was not your daily driver!!CTRL+Space is not switching my languages, correct. Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 13, 2021 Share Posted June 13, 2021 43 minutes ago, TeZtdevice said: Oh no, I hope this was not your daily driver!!CTRL+Space is not switching my languages, correct. Nope, it is a test-device (the old pre-production unit without a few radios...) A factory reset does NOT fix it... Will try to flash a few weeks back and do a reset...Edit I. It still worked flashing 20210510 (and doing a factory reset)Edit II. It still worked flashing 20210517 (no reset)Edit III. It still worked flashing 20210524 (no reset)Edit IV. It still worked flashing 20210531 (no reset) SO the conclusion is that keyboard selection was broken with the 20210607, beyond what a factory reset can fix! (will not re-flash now, but optimistically try going from 0531 to 0614 tomorrow). 2 Quote Link to post Share on other sites
TeZtdevice 285 Posted June 13, 2021 Share Posted June 13, 2021 10 minutes ago, EskeRahn said: Nope, it is a test-device (the old pre-production unit without a few radios...) A factory reset does NOT fix it... Will try to flash a few weeks back and do a reset...Edit I. It still worked flashing 20210510 (and doing a factory reset)Edit II. It still worked flashing 20210517 (no reset)Edit III. It still worked flashing 20210524 (no reset)Edit IV. It still worked flashing 20210531 (no reset) SO the conclusion is that keyboard selection was broken with the 20210607, beyond what a factory reset can fix! (will not re-flash now, but optimistically try going from 0531 to 0614 tomorrow). Thank you so much for your testing!!! Ok, I will wait for tomorrow and if nothing change, I have to reset my phone again and install an old ROM. Please report me, if the version 0614 broke your settings again. 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 13, 2021 Share Posted June 13, 2021 Just now, TeZtdevice said: Please report me, if the version 0614 broke your settings again. Will do 🙂 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 13, 2021 Share Posted June 13, 2021 2 minutes ago, TeZtdevice said: I have to reset my phone again and install an old ROM. PS I will suggest the opposite order. Install the functioning rom, and do a reset from that (you can do it from the recovery menu, so it is a clean boot on the newly flashed rom) (I have updated the original bug report with this new variant, so if we are very lucky and a developer is bored today, we might see a fix included in tomorrows update...) 2 1 Quote Link to post Share on other sites
ivoanjo 33 Posted June 13, 2021 Author Share Posted June 13, 2021 Thanks EskeRahn for the testing. I've been dragging my feet on resetting as well to fix these damn keyboard issues, as my Pro1 is my daily driver, so this info will be very valuable. Of all the things to be broken on this phone, it had to be the keyboard. Damn 😞 2 Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 13, 2021 Share Posted June 13, 2021 4 hours ago, ivoanjo said: I've been dragging my feet on resetting as well to fix these damn keyboard issues You could try to flash the 20210531, with a little luck it will work stepping back 'one step' even without resetting. 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted June 14, 2021 Share Posted June 14, 2021 Seems to be fixed with the 20210614 update 🙂 1 Quote Link to post Share on other sites
TeZtdevice 285 Posted June 14, 2021 Share Posted June 14, 2021 3 hours ago, EskeRahn said: Seems to be fixed with the 20210614 update 🙂 Ehm... no, not on my device 😞 Quote Link to post Share on other sites
Sean McCreary 328 Posted June 14, 2021 Share Posted June 14, 2021 53 minutes ago, TeZtdevice said: Ehm... no, not on my device 😞 Are you using the FinQwerty app or another user-customized key map? So far I have had no luck duplicating these problems on a vanilla LineageOS installation (with or without gapps). 1 Quote Link to post Share on other sites
TeZtdevice 285 Posted June 14, 2021 Share Posted June 14, 2021 (edited) 14 minutes ago, Sean McCreary said: Are you using the FinQwerty app or another user-customized key map? So far I have had no luck duplicating these problems on a vanilla LineageOS installation (with or without gapps). No 😕 I just tried out the FinQwerty, but just to test if it solve the problem. But, perhaps you could send the me a clean version of the keyboard map files? Edit: I have a app that customized my keyboard. Let me check... Edit 2: No, that wasn´t the problem. Issue still there Edited June 14, 2021 by TeZtdevice Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.