Razer Blade keyboard keeps on going to sleep

I am currently going through some remote debugging on my Son's Laptop :upside_down_face:
He's out of country and mostly offline which makes things a little difficult, but here it goes.

He's running up-to-date Manjaro KDE Stable on a Razer Blade Laptop, the problem he experiences is that the keyboard goes to sleep after every few seconds without input and while it goes to sleep it blocks all input for a while. It will come back eventually but this makes typing quite annoying, close to unusable.

The puzzling thing is that this has been working before with an off the stick installation on this machine without any issues, he reinstalled the OS for some reason and this new install, maybe a bit more recent software but other than that identical, showed this behaviour right from the start.

To get to the bottom of this we just tried booting from a live USB and the keyboard worked fine.
He's using Kernel 5.0.9-2, the USB stick had 4.19 so we tried that kernel just now as well, unfortunately no success.
We checked journalctl and dmesg for any obvious messages but couldn't find anything.
Keyboard in KDE settings is the Generic 101 key-PC one, live-USB and installed.
We also tried the Razer peripherals driver from AUR just now, also without success.
This feels like a simple setting set wrong but we couldn't find anything yet.

And now I am running out of ideas, can anyone think of something else to check?
How can I identify which keyboard driver is in play and where would the driver/settings for this driver be located?

System:    Host: johannes-pc Kernel: 4.19.36-1-MANJARO x86_64 bits: 64 Desktop: KDE Plasma 5.15.4 Distro: Manjaro Linux 
Machine:   Type: Laptop System: Razer product: Blade v: 2.04 serial: <root required> 
           Mobo: Razer model: Razer CH20 serial: <root required> UEFI: Razer v: 1.03 date: 01/08/2019 
Battery:   ID-1: BAT0 charge: 42.6 Wh condition: 82.4/80.2 Wh (103%) 
CPU:       Topology: 6-Core model: Intel Core i7-8750H bits: 64 type: MT MCP L2 cache: 9216 KiB 
           Speed: 1100 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 1100 2: 1100 3: 1100 4: 1100 5: 1100 6: 1100 7: 1100 
           8: 1100 9: 1100 10: 1100 11: 1100 12: 1100 
Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
           Device-2: NVIDIA TU106M [GeForce RTX 2060 Mobile] driver: N/A 
           Display: x11 server: X.Org 1.20.4 driver: intel resolution: 1920x1080~144Hz 
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 630 (Coffeelake 3x8 GT2) v: 4.5 Mesa 19.0.3 
Audio:     Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel 
           Device-2: NVIDIA TU106 High Definition Audio driver: snd_hda_intel 
           Sound Server: ALSA v: k4.19.36-1-MANJARO 
Network:   Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi 
           IF: wlo1 state: up mac: d4:3b:04:1b:0f:6c 
Drives:    Local Storage: total: 484.60 GiB used: 24.85 GiB (5.1%) 
           ID-1: /dev/nvme0n1 vendor: LITE-ON model: CA3-8D512 size: 476.94 GiB 
           ID-2: /dev/sda type: USB vendor: Generic model: Flash Disk size: 7.66 GiB 
Partition: ID-1: / size: 97.65 GiB used: 24.80 GiB (25.4%) fs: btrfs dev: /dev/dm-0 
           ID-2: /home size: 97.65 GiB used: 24.80 GiB (25.4%) fs: btrfs dev: /dev/dm-0 
Sensors:   System Temperatures: cpu: 45.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 300 Uptime: 6m Memory: 15.56 GiB used: 1.49 GiB (9.6%) Shell: bash inxi: 3.0.33

Edit: One thing I forgot, we ran dmesg -T | grep keyboard as well. On my machine this gives me one line with, I presume the driver, on his we didn't get anything.

Hah. Fun. That means we're remote debugging remote debugging...

Sounds power management-related.

Possibly a kernel driver regression, or a change to power management tools. For example, TLP was updated from 1.1 to 1.2.1 and depending on what happened the default configuration may have changed.

Does an external USB keyboard work as expected?

I have been quiet regarding this one because due to remoteness not much happened for a while. But we finally found the root cause.
We went trough a fresh install and carefully watched if and when the problem shows again. Well, it's due to Powertop optimizing the entry below:

Autosuspend for USB device Razer Blade [Razer]

The moment this entry is set to be optimized the keyboard will be switched off to save power.
As usual, in hindsight this is kind of obvious :slight_smile:

@jonathon, you were spot on!