Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal state transition Released Pressed/Released #11

Open
yunmikun2 opened this issue Oct 10, 2021 · 4 comments
Open

Illegal state transition Released Pressed/Released #11

yunmikun2 opened this issue Oct 10, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@yunmikun2
Copy link
Contributor

yunmikun2 commented Oct 10, 2021

Sometimes I have an issue when I press a key and it looks like it doesn't get pressed at all, i.e. I press a button but the character doesn't appear in an input field. Usually it happens when I type some text in emacs and quickly start moving around (like with Ctrl+n), then the last pressed key becomes unavailable (n in that case).

Restarting kbct daemon helps but it's most unpleasant experience.

When I run journalctl -u kbct, I can see the following lines:

Oct 10 23:40:31 systemd[1]: Started Keyboard keycode mapping daemon supporting layered configuration.
Oct 10 23:40:31 kbct[24637]:  INFO  kbct > Starting kbct event loop, pid=24637
Oct 10 23:40:32 kbct[24637]:  INFO  kbct > Capturing device path=/dev/input/event3 name="AT Translated Set 2 keyboard" mapped_name="Kbct-AT Translated Set 2 keyboard"
Oct 10 23:40:32 kbct[24637]:  WARN  kbct > Illegal state transition Released Pressed
Oct 10 23:40:32 kbct[24637]:  WARN  kbct > Illegal state transition Released Pressed
Oct 10 23:40:32 kbct[24637]:  WARN  kbct > Illegal state transition Released Pressed
Oct 10 23:40:32 kbct[24637]:  WARN  kbct > Illegal state transition Released Pressed
Oct 10 23:40:32 kbct[24637]:  WARN  kbct > Illegal state transition Released Released
Oct 10 23:40:33 kbct[24637]:  WARN  kbct > Illegal state transition Released Released

So I can see that the warnings are raised at this place, but I have no idea what's going wrong.

Is there any way I can debug it further? I don't really have any stable way to reproduce this issue, but I've been experiencing this for some time (like from the time I've started using this program).

@seltzered
Copy link
Contributor

seltzered commented Oct 11, 2021

Just to chime in, I've been trying to test kbct as well and observe this on occasion too with the latest build.

Notably, I see it on a bluetooth keyboard when waking up the computer - I'll mash the first key I want to press a bunch of times looking to see if the keyboard connected yet typing in the login password, and the key gets rejected. So far the workaround for me has been to do a couple things:

  1. Disconnect and reconnect the keyboard (i.e. turn the bluetooth keyboard off and back on). This helps with the button not appearing issue.

  2. Probably a different issue, but if there happens to be a remapping of a stateful key (like remapping capslock key to escape) that could get stuck, have a binding to undo the stick (e.g. make shift+capslock be capslock toggle)

Curious as well if I can help debug further.

@yunmikun2 are you using the appimage release or a compiled build?

@yunmikun2
Copy link
Contributor Author

Oh, sorry, I haven't provided any information on my system. I use AUR package (for Arch Linux), that just pulls it from the upstream and builds it (now it's the latest version of kbct on master).

My config is:

- keyboards:
    - "Kingston HyperX Alloy Origins Core"
    - "AT Translated Set 2 keyboard"
  keymap:
    leftctrl: capslock
    capslock: leftctrl
    rightctrl: enter
    enter: rightctrl
  layers:
    - modifiers:
        - capslock
      keymap:
        m: enter
    - modifiers:
        - enter
      keymap:
        m: enter

So, yeah, I swap capslock with left ctrl and enter with right ctrl. Also, I bind a combination of any of these controls with "m" to "enter".

I don't use a bluetooth keyboard, but I have an USB one. But the problem occurs even when I'm using the default keyboard from my laptop.

@samvel1024
Copy link
Owner

Thanks for reporting this, I've been annoyed by this for a long time as well, to be honest 😃 Need to find some spare time to fix this.

@samvel1024 samvel1024 added the bug Something isn't working label Oct 12, 2021
@reidevries
Copy link

reidevries commented Dec 27, 2021

I am getting a similar issue but in a different situation. Sometimes when I close my laptop and it goes to sleep, I won't be able to press a certain key anymore. Sometimes, the same key will start being held down without interaction (so a string of, for example, 111111111111111111111111 will start to appear in the text entry field.) I get this in journalctl:
Dec 27 13:56:02 kbct[59396]: WARN kbct > Illegal state transition Released Released
Dec 27 13:56:02 kbct[59396]: WARN kbct > Illegal state transition Released Released
This is also using the AUR package. I haven't tried an external keyboard or anything, it's happening with the laptop built in keyboard. I'm not familiar with the code yet but I'll probably take a look if this doesn't get fixed soon, I'm assuming it's somehow getting into an illegal state when it goes to sleep or wakes from sleep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants