0

TLDR; Keyboard input locks while playing Minecraft and other times but is most noticeable when using WASD movement keys in game. Changed from Ubuntu to Fedora, removed USB hub from connection chain, changed keybaords. Issue still persists. XEV output provided. I don't know where else to look to pinpoint the cause of the issue.

The more detailed version:

I've noticed an issue with keyboard input while playing Minecraft Java edition in Linux. I'm looking to be pointed in a direction to find the root cause. I don't know where else to look besides changing my from X11 to Wayland. I'll try that when I get a chance and update this post. While playing the game the key I'm pressing will get "stuck" down and will not release. This is software only as the keyboard keys are not physically stuck down. The mouse continues to work correctly. The only keyboard input that I've managed to get to work is CTRL+ALT+F(n) to switch to another console. If I switch back nothing responds to key presses until the issue passes. I've tried other keyboards and plugged the keyboard directly into the PC front USB ports to eliminate the USB hub and switchers. I even moved the USB switcher to a different rear USB port. I thought that helped but the issue still occurs. It is randomly occurring but seems to occur more often and for longer periods of time if the Minecraft window is full screen.

This issue occurs with Ubuntu 22.04 (X11) and Fedora 39 (X11). Both are using current offered version of Gnome with all available updates installed. Hardware: Dell Precision 3650 Intel i7-11700K 32GB DDR4 EVGA GeForce GTX 970 OC

Current environment: Fedora Linux 39 (Workstation Edition) Linux 6.6.6-200fc39.x86_64 Gnome 45.2 X11

Keyboard: E-Element Z-88 USB keyboard and Motospeed K-82 USB keyboard Mouse: Logitech G502 and Anker Optical Vertical Mouse USB chain: Anker A7515 USB hub > Sabrent USB-SW30 USB switcher -> rear USB port on PC, or keyboard and mouse directly to front USB ports.

These are the changes I've attempted while troubleshooting: Moving USB ports directly connecting to PC vs going through USB hub and switcher full screen vs windowed Ubuntu vs Fedora

I learned of the Xev utility to monitor keyboard and mouse so I ran that utility with the Minecraft game window selected. This is where I found the first bit of info that might come in handy for troubleshooting. I'm not familiar with the output and what it means. The issue just happened while typing this message in Firefox. My keyboard input stopped working in the text input box. I could use the mouse to highlight and select text. I could select other windows with the mouse and type there. I could press the Super key to bring open Activities. Then I noticed my typing was slowly showing up in the text box if I selected it and waited. It was almost like using a very poor dialup connection for a remote terminal back in the 90s; just waiting for my typing to catch up. It took more than 2 minutes for 5 words, a handful of gibberish, and some backspacing to finish showing up. I still can't type in the text input box in Firefox but I was able to select what I had written with the mouse and middle-click to paste it into Text Editor to finish typing.

I haven't tried Wayland yet to determine if the issue is specific to X11.

I will attach a text file of output from the xev utility but below is an example of normal input and what is repeated continuously while the issue is occurring. In the normal output the pressed key is correctly shown in the state line. While the issue occurs, a keys matrix is shown repeatedly with the key I'm pressing being represented in the various locations in the matrix. Apparently 'w' (bound to move forward in Minecraft) is represented by a '32' in Col 5 of Row 1. This changes depending on keypresses but nothing responds in-game or anywhere else until the issue ceases and I can ALT-TAB out of the game or press ESC to release the mouse from the game window.

Normal Xev output from keyboard input in Minecraft:

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12770871, (2305,800), root:(2305,1054),
    state 0x10, keycode 39 (keysym 0x73, s), same_screen YES,
    XLookupString gives 1 bytes: (73) "s"
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12771159, (2373,791), root:(2373,1045),
    state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12771159, (2373,791), root:(2373,1045),
    state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12771207, (2373,791), root:(2373,1045),
    state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12772551, (2409,793), root:(2409,1047),
    state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12772551, (2409,793), root:(2409,1047),
    state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12772623, (2409,793), root:(2409,1047),
    state 0x14, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (01) ""
    XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12772623, (2409,793), root:(2409,1047),
    state 0x14, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (01) ""
    XmbLookupString gives 1 bytes: (01) ""
    XFilterEvent returns: False

Xev output when the issue begins (I'm guessing the key 32 is 'w'):

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
    root 0x1ef, subw 0x0, time 12717159, (31,636), root:(31,890),
    state 0x14, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (17) ""
    XmbLookupString gives 1 bytes: (17) ""
    XFilterEvent returns: False

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  4294967279 0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  4294967279 0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  2   0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
    mode NotifyGrab, detail NotifyNonlinear
3
  • I don't think it's that. I got up to 19 simultaneous keys pressed. Commented Dec 20, 2023 at 20:51
  • In the Xev output you can also see the time of key press and key release. I'm using 2 or 3 keys at a time max. Walk (w, or s), strafe (a, or d) and sprint (left CTRL). The FocusOut...NotifyGrab and FocusIn...NotifyUngrab looks like something stealing focus from the game possibly? I don't know what causes those events or the NotifyNonlinear detail means. Commented Dec 20, 2023 at 21:01
  • Maybe there's a tool or logging I can enable to help further troubleshoot this. I haven't found it yet. Commented Dec 20, 2023 at 21:03

1 Answer 1

0

The keyboard input issue you're encountering in Minecraft Java Edition on Linux, characterized by keys getting "stuck" during gameplay, is a complex problem that could stem from a multitude of factors. Let’s delve into the potential causes and their respective solutions, ensuring a holistic approach to troubleshooting this issue. Potential Causes and Solutions:

  1. X11 vs Wayland:
    • The difference in input handling between X11 and Wayland is significant. Given your issue persists on X11 across different Linux distributions, trying out Wayland could potentially rectify the problem.

2. Keyboard Hardware and Drivers:

  • Updating drivers and firmware for your keyboards is a crucial step. Sometimes, specific models have unique compatibility issues that are resolved in newer driver versions.

3. USB Configuration:

  • Inspecting the USB power management settings and experimenting with different USB ports (like switching from 3.0 to 2.0) could provide insights into any hardware-related conflicts.

4. System Resources and Software Interference:

  • Monitoring resource usage during gameplay is essential. High CPU or RAM usage can cause input lag.
  • Also, check for any software that might interfere with keyboard inputs, such as other device drivers or system monitors.

5. Minecraft Configuration:

  • Since fullscreen mode exacerbates the issue, tweaking in-game settings might offer some relief. Ensure that Minecraft and any mods you're using are updated.

6. Analyzing Xev Output:

  • The continuous key matrix output in xev indicates that the system is receiving constant keypress signals. Deciphering these patterns could be key to understanding the root of the problem.

7. Testing with Wayland:

  • Since Wayland handles input differently than X11, it's a worthwhile avenue to explore.

In the process of troubleshooting, if you're using tools like xev to monitor keyboard inputs, you might also find it interesting to experiment with other utilities or tools that can enhance your Minecraft experience. For instance, if you're into designing structures within the game, the Minecraft Circle Generator minecraftcirclegenerate.com can be a valuable tool. It’s not directly related to your current issue but can be a fun and useful resource for your gameplay. Addressing this issue involves a step-by-step approach, starting from simpler fixes like updating drivers to more comprehensive solutions like switching to Wayland. Documenting each step and its impact is vital in pinpointing the exact cause of your problem.

1
  • Is it just me or does this look like the type of response an LLM would generate? If not, I sincerely apologize to Kiwnjey. Commented Feb 28 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .