Feature: Add flag to emulate QWERTY in OTG mode#6748
Draft
levirak wants to merge 1 commit into
Draft
Conversation
Add the flag `--otg-emulate-qwerty` to allow for behaving as though the controlled QWERTY-expecting device had the local keymap.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This may be a "me and only me" problem, but I got a solution working and figured I'd offer a preliminary pull request to see if there's any interest in it.
I have an old KaiOS dumb-phone (based on very old Android) that I'd appreciate being able to type on with a keyboard, because it's own input is atrocious. Unfortunately, I type Dvorak, and the device doesn't officially support external keyboards, so it only supports QWERTY input. In theory, this may also be a useful feature for AZERTY users, though I'm not one of them, so I'm not really in a position to know. Nor am I in a position to test if this implementation behaves appropriately under AZERTY.
Here's a solution to my problem that sends the QWERTY scancode that corresponds with the keycode SDL2 reports. I do this with a simple, hard-coded lookup table. While SDL2 does have a
SDL_GetScancodeFromKeythat turns keycodes into scancodes, it is for the current keymap, and I'm not seeing a way to ask for that mapping in a different (e.g. QWERTY) layout. I added a--otg-emulate-qwertyCLI flag to activate the feature. It's meant to only be used alongside--otg, but that could change.If there's any interest in this, I could polish this PR up some more, especially with style and implementation advice from more knowledgeable contributors.
Reasons why you might not want this PR: As I said, this is likely a "me and only me" problem. If so, adopting this feature may incur a support cost that's just not worth the extra feature.