claude0001 1,329 Posted September 15, 2021 Share Posted September 15, 2021 16 hours ago, Sean McCreary said: I have verified that each key generates the glyph matching the printed keycap for QWERTZ variant Pro1 devices, as long as in 'Settings -> System -> Languages & Input -> Physical keyboard' *both* 'Advanced settings -> Physical layout' is set to QWERTZ *and* 'Builtin Keyboard -> Choose keyboard layout' is set to German. I will try to find a way to make it easier for users to set the correct configuration to make this less confusing. Because this seems to be a configuration issue rather than a bug in the default keymap in the keyboard driver, I have abandoned CR#315195. Exactly. Out of interest, I had applied the proposed patch to my LOS 16 on my QWERTZ Pro1: The respective key immediately stopped working correctly. With @tdm's default keymap, things have always worked - given the correct configuration you describe. That one has to configure things in two places is of course a little cumbersome, and many of us QWERTZies stumbled on that in the beginning. Streamlining the UI here would be nice, but also not strictly necessary, as for most users configuring this is a one-time action. 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted September 15, 2021 Share Posted September 15, 2021 On 9/14/2021 at 11:57 PM, Sean McCreary said: I have verified that each key generates the glyph matching the printed keycap for QWERTZ variant Pro1 devices, as long as in 'Settings -> System -> Languages & Input -> Physical keyboard' *both* 'Advanced settings -> Physical layout' is set to QWERTZ *and* 'Builtin Keyboard -> Choose keyboard layout' is set to German. I will try to find a way to make it easier for users to set the correct configuration to make this less confusing. Because this seems to be a configuration issue rather than a bug in the default keymap in the keyboard driver, I have abandoned CR#315195. Thanks. But if it ONLY works with German, this seams to break the whole original idea of letting the qwertz/qwerty switch select all the necessary remapping to get a standard layout so ANY available android standard layout could be selected, fitting the users language. ADD: Obviously if I select a qwerty based language on the qwertz keyboard with the qwertz switch, I EXPECT the letter between T and U to send a Y, and similar others will not match the print. (and obviously similar issues the other way round) No better or worse than if I selected to write with another language on a physical German PC-qwertz keyboard. 1 Quote Link to post Share on other sites
VaZso 1,998 Posted September 15, 2021 Share Posted September 15, 2021 (edited) 2 hours ago, EskeRahn said: Thanks. But if it ONLY works with German, this seams to break the whole original idea of letting the qwertz/qwerty switch select all the necessary remapping to get a standard layout so ANY available android standard layout could be selected, fitting the users language. Yes, this is a 2-in-1 problem. The first one is the different keymap of shifted (QWERTY) and normal (QWERTZ) variants of keyboards we have. It is a bit strange that F(x)tec itself has generated this issue as otherwise these layouts would work exactly the same way deep inside. So the problem is the shifting itself which made default layout of Pro1 to be unusual while QWERTZ variant is a perfectly usual layout. So @tdm's keyboard driver solved this issue by allowing to map appropriate keycodes to shifted keys respective to its written functions while also maps appropriate keycodes for normal layout. The second problem is a bit different as there are also yellow texts on the keyboard which are at non-standard positions, so they should be handled in relation to its theoretical layout, so US and German. As low-level keycodes are identical even of international keyboards, a specific key should generate exactly the same code, even if there is ";", "Ö" or "É" is written on it which is the same key in US/German/Hungarian layout. Basically a keyboard driver should generate a scancode of 39 for the key above at its own level. ...then OS should determine if scancode of 39 arrives, then it should handle it as ; Ö or É, so that is a function of a higher level interface. So, @tdmwanted the yellow-labeled keys to produce the very same symbols what they have written on it and as these are not at a standard position, he had to apply a trick on it. So that way the low-level driver accommodates to high-level code, in this case, for QWERTZ variant, it is German. So it will work perfectly if German layout is selected but it worth nothing for other layouts. That is why I thought we may need an option to disable this behaviour and exposing modifiers for custom layouts applied at high level of the system. For me, the QWERTY / QWERTZ keycode correction is a very good solution which should has been solved by IdeaLTE also in stock OS before launch, this is the absolute correct way of handling it. However, the actual form of default keymap is very restricting, thus, an annoying function for me. Anyway, @tdmhas also made an interface where default keyboard map can be changed, so, theoretically all international layouts may have a respective value somewhere in system UI, so the very same function of producing the written text of these keys are possible and even a standard layout with AltGr applied on second interface is possible. Other than that, different modifiers like keycode of FN or Meta is currently not supported which would mean one has to overdefine standard AltGr function of a key instead of having another layer as a potential custom layout and keeping language-specific AltGr function as well. So, at last... the problem of yellow keys can not be solved perfectly at low level as it is basically not a low-level task but a high-level one and I would not put it there as a default option in driver level as it is basically not the right behaviour per standard. 2 hours ago, EskeRahn said: Obviously if I select a qwerty based language on the qwertz keyboard with the qwertz switch, I EXPECT the letter between T and U to send a Y, and similar others will not match the print. (and obviously similar issues the other way round) It works this way as Z/Y keys are fortunately not touched by any special modifications. Basically "Z" has a scancode of 44 on US keyboard and 21 on German keyboard while "Y" has 21 on US keyboard but 44 on German. So, the key between "T" and "U" or the key on the left of "X" always has the same scancode and an upper layer will decide if they should generate "Z" or "Y" or anything else. That is where the solution of remapping non-standard yellow symbols mixed up the normal behaviour of any keyboards and that is why I don't like it to be there as default. Edited September 16, 2021 by VaZso 3 2 Quote Link to post Share on other sites
Sean McCreary 328 Posted September 16, 2021 Share Posted September 16, 2021 23 hours ago, EskeRahn said: But if it ONLY works with German Yes, there is still a problem to be solved, it just can't be solved by changing qwertz_fn_keys[] in the keyboard driver. @VaZso's summary is quite correct, that we will most likely need additional language-specific custom keymaps to make this work properly. We probably also need the ability to remap the six 'modifier' keys with dedicated GPIO lines (shift, ctrl, fn_l, F logo, alt, and fn_r), and this is not possible with the current custom keymap feature. However, we are making good progress towards adding support for that. 3 Quote Link to post Share on other sites
VaZso 1,998 Posted September 16, 2021 Share Posted September 16, 2021 (edited) 15 minutes ago, Sean McCreary said: we will most likely need additional language-specific custom keymaps to make this work properly. Right - anyway, for the keyboard itself, the most convenient way of working would be for me: Two slant arrows could be used freely for my custom layout (defined in .kcm file) Original AltGr function of the selected international layout could be reachable for example by "Alt" button Additional yellow characters would be accessible by another modifier like the "Sym" button. Maybe another modifier would be usable to quick-launch applications like the "F(x)" button For the functions above, an additional modifier like FN or Meta would be needed. Quick launch may be possible by a 3rd-party solution like Button Mapper. For the rest, that can be done by the ability of remappable modifiers together with an appropriate .kcm file. Anyway, wasting two modifiers to reach yellow signs of the keyboard preventing them to be used for anything else is not a good idea. However, reaching these signs is a good idea, but for a single modifier as it is much less important for me - but that is me... Edited September 16, 2021 by VaZso 1 Quote Link to post Share on other sites
Sean McCreary 328 Posted September 16, 2021 Share Posted September 16, 2021 29 minutes ago, VaZso said: Quick launch may be possible by a 3rd-party solution like Button Mapper. Android uses 'meta' for the built-in keyboard shortcuts, such as meta+B for the web browser, meta+E for the email app, meta+enter to switch back to the launcher (i.e. 'HOME'), and meta+backspace for 'BACK'. This list of shortcuts is extensible, but I don't think the interface is currently exposed in any system app. By default, the 'F logo' key generates KEY_META in LineageOS, enabling these shortcuts. You can display a list of the currently defined shortcuts with meta+/, although this is unfortunately a three-key chord on the Pro1 which makes it rather difficult to type. 😕 However, pressing both the diagonal yellow arrow 'fn_l' and the adjacent F logo key 'home' with one thumb and the 'P' or 'L' key with the other will work without too much finger gymnastics. In the list, Android uses the magnifying glass icon to denote KEY_META. 1 2 Quote Link to post Share on other sites
Sean McCreary 328 Posted September 16, 2021 Share Posted September 16, 2021 1 minute ago, Sean McCreary said: Android uses 'meta' for the built-in keyboard shortcuts, such as meta+B for the web browser, meta+E for the email app, meta+enter to switch back to the launcher (i.e. 'HOME'), and meta+backspace for 'BACK'. This list of shortcuts is extensible, but I don't think the interface is currently exposed in any system app. By default, the 'F logo' key generates KEY_META in LineageOS, enabling these shortcuts. You can display a list of the currently defined shortcuts with meta+/, although this is unfortunately a three-key chord on the Pro1 which makes it rather difficult to type. 😕 However, pressing both the diagonal yellow arrow 'fn_l' and the adjacent F logo key 'home' with one thumb and the 'P' or 'L' key with the other will work without too much finger gymnastics. In the list, Android uses the magnifying glass icon to denote KEY_META. Also, https://play.google.com/store/apps/details?id=flar2.homebutton says: Quote This app uses Accessibility services That may trigger the keymap bug that Google introduced in Android 11 1 Quote Link to post Share on other sites
VaZso 1,998 Posted September 16, 2021 Share Posted September 16, 2021 2 minutes ago, Sean McCreary said: Also, https://play.google.com/store/apps/details?id=flar2.homebutton says: That may trigger the keymap bug that Google introduced in Android 11 Anyway, I had a problem with Button Mapper on stock Android of Pro1 as it caused lag on my hardware keyboard and a feeling it is not fluent which was solved by removing it... 1 1 Quote Link to post Share on other sites
Hook 2,962 Posted September 17, 2021 Share Posted September 17, 2021 On 9/8/2021 at 4:21 PM, Sean McCreary said: Now that custom keymaps are working, you can remap the 'up arrow' key to '/', with Android handling shift+'/' -> '?' with the following: 04:0035:0067 I chose to remap Fn+'/' to 'up arrow' so you can still use that, but it overwrites the default keycode of 'page up'. That's the '0067' part in the string above, where 'page up' would be '0068' Okay, virtually everything in this thread is over my head. Can someone direct me to good sources to figure out how to create or modify a keymap and what to do with it. I'd really like to understand how to make this modification on my Pro1 and I'm willing to do my own homework, but would appreciate being pointed in the right direction. 🙂 TIA. 1 1 Quote Link to post Share on other sites
Sean McCreary 328 Posted September 18, 2021 Share Posted September 18, 2021 (edited) On 9/17/2021 at 8:55 AM, Hook said: Can someone direct me to good sources to figure out how to create or modify a keymap and what to do with it Right now you will need to use 'adb' to install the custom keymap, and there isn't any app to help you create the map 😕 @Slion made this nifty QWERTY keyboard image with each key labelled with the 'key number' in yellow: The manual process is to choose which key you want to remap, and to look up the keycode you want it to generate in this list: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h You will need to convert the keycodes from decimal to hexadecimal if they don't begin with '0x'. The custom keymap is a file with lines containing three numbers separated by colons. Each line remaps one key. For example, to make the capslock key send ctrl: 40:001d:001d The capslock is key #40 in the image above, and KEY_LEFTCTRL is 29 == 0x1d in hexadecimal. I chose to map the 'Fn shifted' version of the key to ctrl as well, so both hexadecimal numbers are the same. If you wanted to map the key to capslock when pressed at the same time as one of the 'Fn' keys, then the line should be: 40:001d:003a since KEY_CAPSLOCK is 58 == 0x3a in hexadecimal. Save the list of modifications, and install it with: adb root; adb push my_keymap /data/system/keyboard/keymap Then you need to enable it in Settings -> System -> Languages & input -> Physical keyboard -> Advanced settings -> Custom keymap. If the toggle is greyed out or it won't stay on, then there was a problem installing the custom keymap file. Check your custom map for mistakes, and then push it to the Pro1 again. You may need to reboot before the Settings app will recognize there is an updated custom keymap file. Edited September 22, 2021 by Sean McCreary Updated image w/ key label for space bar 4 Quote Link to post Share on other sites
Slion 1,201 Posted September 18, 2021 Share Posted September 18, 2021 (edited) On 9/17/2021 at 12:41 AM, Sean McCreary said: This list of shortcuts is extensible, but I don't think the interface is currently exposed in any system app. By default, the 'F logo' key generates KEY_META in LineageOS, enabling these shortcuts. The other day I was trying to figure out how those Android built-in shortcuts work. I'm pretty sure global shortcuts are not extensible or configurable unless maybe through resource file override somehow. I collected those links also available from there: On 8/30/2021 at 11:59 PM, Slion said: Display system keyboard shortcuts dialog:https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r1/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java For your application to register shortcuts see how it is done in Lineage Trebuchet launcher:https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/c8d5010b1071873957ff9f4b56ed5de1ca9471b4/src/com/android/launcher3/Launcher.java#L2621 To handle them:https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/c8d5010b1071873957ff9f4b56ed5de1ca9471b4/src/com/android/launcher3/Launcher.java#L2652 Meta shortcuts are defined there it seems: https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/bookmarks.xml There is also a disconnect it seems between publishing shortcut in that Fn+Meta+? dialog and the actual handling of the shortcut. Meaning you could publish a shortcut but no implement it properly. App can publish shortcut which will then be displayed in that dialog but those are not global they only show when the application is running. Though maybe a service could somehow make them global? Moreover I spoted the place where they starve applications from that Meta key apparently this was done because of disfunctional keyboards, so wrong reasons it seems, it ought to be fixed. Here is what that shortcut dialog looks like in Lineage OS Trebuchet default home screen for instance: Edited September 18, 2021 by Slion Quote Link to post Share on other sites
Slion 1,201 Posted September 18, 2021 Share Posted September 18, 2021 (edited) 3 minutes ago, Slion said: Meta shortcuts are defined there it seems: https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/bookmarks.xml Though Meta+A does not launch the Calculator for some reason, not on my Pro1, not on my Galaxy Tab S6. Edited September 18, 2021 by Slion Quote Link to post Share on other sites
Sean McCreary 328 Posted September 18, 2021 Share Posted September 18, 2021 7 hours ago, Slion said: Here is what that shortcut dialog looks like in Lineage OS Trebuchet default home screen for instance: This list of shortcuts is scrollable, even though the UI doesn't indicate it. The full list has 14 entries by default. 7 hours ago, Slion said: Though Meta+A does not launch the Calculator for some reason, not on my Pro1, not on my Galaxy Tab S6. The app must register properly for the shortcut to work. For example, K9 never used to work with the meta+E shortcut, but after the recent UI redesign it now does. Quote Link to post Share on other sites
Slion 1,201 Posted September 18, 2021 Share Posted September 18, 2021 (edited) 8 minutes ago, Sean McCreary said: This list of shortcuts is scrollable, even though the UI doesn't indicate it. The full list has 14 entries by default. Thanks for the tip 🤣 just want to illustrate what it looks like when an app publishes its own shortcuts. Edited September 18, 2021 by Slion Quote Link to post Share on other sites
Slion 1,201 Posted September 18, 2021 Share Posted September 18, 2021 5 minutes ago, Sean McCreary said: The app must register properly for the shortcut to work. For example, K9 never used to work with the meta+E shortcut, but after the recent UI redesign it now does. I think you mean register the intent in app manifest. That's the first thing I checked, and the calculator does register the proper intent. Maybe I missed something though. Quote Link to post Share on other sites
Sean McCreary 328 Posted September 18, 2021 Share Posted September 18, 2021 Just now, Slion said: I think you mean register the intent in app manifest. That's the first thing I checked, and the calculator does register the proper intent. Maybe I missed something though. Yes, that is what I meant. FWIW, meta+A doesn't appear in the list shown by Trebuchet, so perhaps there is missing code somewhere in the framework. 1 Quote Link to post Share on other sites
VaZso 1,998 Posted September 18, 2021 Share Posted September 18, 2021 31 minutes ago, Sean McCreary said: Yes, that is what I meant. FWIW, meta+A doesn't appear in the list shown by Trebuchet, so perhaps there is missing code somewhere in the framework. Right, that is what I wanted to write here. Anyway, it could open calculator for me although it is not in that list. Quote Link to post Share on other sites
Slion 1,201 Posted September 18, 2021 Share Posted September 18, 2021 21 minutes ago, VaZso said: Anyway, it could open calculator for me although it is not in that list. You could? With Meta+A? Quote Link to post Share on other sites
VaZso 1,998 Posted September 18, 2021 Share Posted September 18, 2021 4 hours ago, Slion said: You could? With Meta+A? Yes, with F(x) + A but it is not the latest LineageOS (but an official one). 1 Quote Link to post Share on other sites
EskeRahn 5,433 Posted September 19, 2021 Share Posted September 19, 2021 On 9/18/2021 at 5:27 AM, Sean McCreary said: there isn't any app to help you create the map 😕 Thanks for your guidance. 2½ years ago I started on a project doing exactly that, but lacked the information, I will try to find time to finish it. If anyone wants to finish it, or fork it PLEASE feel free, it is in simple C# and feel free anyone, all I request is if someone uses it to make something useful, is that I get a copy. 😁 (Just reopend it, and it is currently not much-more than an UI template) I had an idea that it should have some 'layers' that could be shared/imported by dfferent languages. say you had a math-layer that you mapped to Ctrl+Yellow, Or whatever, someone else might like that as a Ctrl+Shift layer.... The point being the easy share, so anyone interested could mix templates from others, as they find suitable. FxtecKeyboardSetup.zip 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.