hid-remapper icon indicating copy to clipboard operation
hid-remapper copied to clipboard

Unexpected behaviour when mapping RIGHt_ALT+RIGHT_SHIFT+ SOME_KEY using layers

Open pkockaer opened this issue 2 years ago • 2 comments

Hi, I have used your remapper successfully thanks to the macro feature. This is a wonderful device to map the BÉPO keyboard (sort of French Dvorak) to the AZERTY one. Thank you for making this possible.

Although it works perfectly for key combinations with either SHIFT or RIGHT_ALT, I have issues when I want to map: RIGHT_SHIFT + RIGHT_ALT + R -> "OE". My final goal is to output "Œ", but I tested with "OE" for simplicity.

Maybe I am not using layers correctly. What I did is as follows (the json file for this mwe is copied here below): At the beginning of the mapping list, I put

  • LSHIFT or RSHIFT in layer 0 outputs LAYER1
  • RALT in layer 0 outputs LAYER2
  • RALT in layer 1 outputs LAYER3
  • LSHIFT or RSHIFT in layer 2 outputs LAYER3

There are therefore four ways to trigger layer 3 from layer 0: 1° LSHIFT followed by RALT (goes through layer1) 2° RSHIFT followed by RALT (goes through layer1) 3° RALT followed by LSHIFT (goes through layer2) 4° RALT followed by RSHIFT (goes through layer2) As will be explained here below, these four ways do not provide similar results.

After that, in the mapping list, I put:

  • R -> O [layer 0]
  • R -> O [layer 1] __ combined outputs provide capital O
  • R -> RSHIFT [layer 1] /
  • R -> Macro1 [layer 2]
  • R -> Macro2 [layer 3]

Macros are defined as follows: Macro 1: O,E Macro 2: RSHIFT+O, RSHIFT+E

The mappings for layers 0, 1 and 2 work as expected. I get:

  • R -> "o"
  • RSHIFT + R -> "O"
  • LSHIFT + R -> "O"
  • RALT + R -> "oe"

Now comes the problem. If I press RALT + LSHIFT + R, I get either "oeOE" or "OE". I've checked that if I press the keys (without releasing them) in the order RALT - LSHIFT - R I get "oeOE", as if both layers 2 and 3 where active at the same time, while if I press the keys in the order LSHIFT - RALT - R I get "OE" as expected. This time layer 3 seems to be active while layer 1 is not.

So my question is to know if there is a better way to make this mapping, and why the road through layer 2 seems to keep layer 2 active when activating layer 3, while the road through layer 1 seems to make layer 1 inactive when layer 3 is active.

Thank you for your help.


Here is the json file corresponding to the minimum working example described here above.


{ "version": 8, "unmapped_passthrough_layers": [ 0 ], "partial_scroll_timeout": 1000000, "tap_hold_threshold": 200000, "gpio_debounce_time_ms": 5, "interval_override": 0, "mappings": [ { "target_usage": "0xfff10001", "source_usage": "0x000700e1", "scaling": 1000, "layers": [ 0, 1 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff10001", "source_usage": "0x000700e5", "scaling": 1000, "layers": [ 0, 1 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff10002", "source_usage": "0x000700e6", "scaling": 1000, "layers": [ 0, 2 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff10003", "source_usage": "0x000700e6", "scaling": 1000, "layers": [ 1, 3 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff10003", "source_usage": "0x000700e1", "scaling": 1000, "layers": [ 2, 3 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff10003", "source_usage": "0x000700e5", "scaling": 1000, "layers": [ 2, 3 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0x00070012", "source_usage": "0x00070015", "scaling": 1000, "layers": [ 0 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0x00070012", "source_usage": "0x00070015", "scaling": 1000, "layers": [ 1 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0x000700e5", "source_usage": "0x00070015", "scaling": 1000, "layers": [ 1 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff20001", "source_usage": "0x00070015", "scaling": 1000, "layers": [ 2 ], "sticky": false, "tap": false, "hold": false }, { "target_usage": "0xfff20002", "source_usage": "0x00070015", "scaling": 1000, "layers": [ 3 ], "sticky": false, "tap": false, "hold": false } ], "macros": [ [ [ "0x00070012" ], [ "0x00070008" ] ], [ [ "0x000700e5", "0x00070012" ], [ "0x000700e5", "0x00070008" ] ], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [] ], "expressions": [ "", "", "", "", "", "", "", "" ] }

pkockaer avatar Sep 17 '23 21:09 pkockaer

Thanks for providing some real world examples, it does sometimes feel like I'm developing this in a vacuum and miss some obvious things.

Regarding the difference in behavior you're observing when pressing shift-right alt-R or right alt-shift-R, the difference doesn't come from different layer behavior. In both cases the "middle" layer (1 or 2) stays active. The difference is because you have different mappings on layers 1 and 2 and the way they interact with the mapping on layer 3 is different. When both mappings are to a macro, it works mostly as you'd expect, when one mapping is a "normal" one, it gets overlaid onto the macro one. So the keys that are sent to the computer are as follows:

shift+O shift+E+O shift+O

Which results in "OE" being typed (there is no "release" event between them).

You can debug layer behavior by using the keyboard LEDs. For example if you set the following configuration:

Screenshot from 2023-09-20 15-17-26 Screenshot from 2023-09-20 15-18-01

The LEDs will turn on then layers 1, 2 and 3 are active.

There is one thing that I need to look into because it doesn't work as I expected and it's that layer 3 in this configuration seems to work as if it was sticky when it's not.

Admittedly there should be some easy way of configuring behavior of multiple modifiers pressed simultaneously without having to go through intermediate layers (as that gets impractical soon).

Currently I would try something like this:

Screenshot from 2023-09-20 15-25-34 Screenshot from 2023-09-20 15-25-42

The expression returns 1 if any of the shifts and right alt are pressed. I know this isn't the most user friendly, but it lets you control it directly without going through intermediate layers.

jfedor2 avatar Sep 20 '23 13:09 jfedor2

Thank you for digging into the problem. I have used Expression 1 and it activates layer 3. However, I have observed that RALT + L_SHIFT+R still outputs oeOE. I cannot make more tests as I seem to have bricked my pico.

I also would like to tell you that your upgrade from 8 to 32 macros was a big improvement. It allows to emulate a BÉPO keyboard with a full hardware solution almost perfectly.

pkockaer avatar Sep 24 '23 20:09 pkockaer