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

[Bug] Adafruit RP2040 Macropad key stuck after Windows resume from sleep #19600

Closed
2 tasks
ForsakenRei opened this issue Jan 15, 2023 · 12 comments
Closed
2 tasks
Assignees

Comments

@ForsakenRei
Copy link
Contributor

ForsakenRei commented Jan 15, 2023

Describe the Bug

I have an Adafruit RP2040 Macropad and tried different build recently while the last issue of media key was fixed, there is still a problem when Windows resume from sleep.

After PC resume from sleep, the first key I pressed on the macropad will get stuck, for example I have KC_F13 on it and I pressed it then it will be held until I reset the macropad(it seems reconnect will release the key but the macropad was stuck as I cannot change layers etc). It basically become unresponsible after the first key press.

I'm on the lastest dev branch

Keyboard Used

adafruit/macropad

Link to product page (if applicable)

https://www.adafruit.com/product/5128

Operating System

Windows 10 22H2

qmk doctor Output

Ψ QMK Doctor is checking your environment.                                                      
Ψ CLI version: 1.1.0                                                                            
Ψ QMK home: C:/Users/Shigure/qmk_firmware                                                       
Ψ Detected Windows 10 (10.0.19045).                                                             
Ψ Git branch: develop                                                                           
Ψ Repo version: 0.19.9                                                                          
⚠ Git has unstashed/uncommitted changes.                                                        
Ψ - Latest develop: 2023-01-14 04:24:54 -0600 (45851a10f6) -- Add RGB565 and RGB888 color suppor
t to Quantum Painter (#19382)                                                                   
Ψ - Latest upstream/master: 2023-01-14 02:25:07 +0000 (3f2cbc9e68) -- Pr/reorder docker podman c
heck (#19561)                                                                                   
Ψ - Latest upstream/develop: 2023-01-15 15:04:32 +0000 (0730740add) -- Add mmoskal/uf2-stm32f103
 bootloader support (#19594)                                                                    
Ψ - Common ancestor with upstream/master: 2023-01-14 02:25:07 +0000 (3f2cbc9e68) -- Pr/reorder d
ocker podman check (#19561)                                                                     
Ψ - Common ancestor with upstream/develop: 2023-01-14 04:24:54 -0600 (45851a10f6) -- Add RGB565 
and RGB888 color support to Quantum Painter (#19382)                                            
Ψ All dependencies are installed.                                                               
Ψ Found arm-none-eabi-gcc version 10.1.0                                                        
Ψ Found avr-gcc version 8.5.0                                                                   
Ψ Found avrdude version 6.4                                                                     
Ψ Found dfu-programmer version 0.7.2                                                            
Ψ Found dfu-util version 0.11                                                                   
Ψ Submodules are up to date.                                                                    
Ψ Submodule status:                                                                             
Ψ - lib/chibios: 2023-01-03 19:29:26 +0000 --  (0062927e3)                                      
Ψ - lib/chibios-contrib: 2023-01-11 16:42:27 +0100 --  (a224be15)                               
Ψ - lib/googletest: 2021-06-11 06:37:43 -0700 --  (e2239ee6)                                    
Ψ - lib/lufa: 2022-08-26 12:09:55 +1000 --  (549b97320)                                         
Ψ - lib/vusb: 2022-06-13 09:18:17 +1000 --  (819dbc1)                                           
Ψ - lib/printf: 2022-06-29 23:59:58 +0300 --  (c2e3b4e)                                         
Ψ - lib/pico-sdk: 2022-09-19 18:02:44 +0200 --  (8d56ea3)                                       
Ψ - lib/lvgl: 2022-04-11 04:44:53 -0600 --  (e19410f8)                                          
Ψ QMK is ready to go, but minor problems were found

Is AutoHotKey / Karabiner installed

  • AutoHotKey (Windows)
  • Karabiner (macOS)

Other keyboard-related software installed

N/A

Additional Context

The unstashed changes come from the doc translation I haven't finish yet.

Maybe related to #18591? It's a different board so I opened a separate issue.

@scchow
Copy link

scchow commented Jan 19, 2023

I have also been seeing this issue with another board I've been working on.
I've posted a writeup of my observations in this comment.

One thing I noticed was that is that disabling my RGB fixes the issue. (Albeit not a great solution because I like RGB :))

Can you try turning off the RGB by setting RGB_MATRIX_ENABLE = no in your rules.mk and see if the stuck key still occurs? If so, then we are probably encountering the same problem, which can help narrow the issue down.

I've been seeing this issue on a split keyboard (Sofle with Elite-Pi controller) using RGB_LIGHT instead of RGB_MATRIX so if we are running into the same problem. then the problem may be more widespread than my relatively niche setup.

@ForsakenRei
Copy link
Contributor Author

I have also been seeing this issue with another board I've been working on. I've posted a writeup of my observations in this comment.

One thing I noticed was that is that disabling my RGB fixes the issue. (Albeit not a great solution because I like RGB :))

Can you try turning off the RGB by setting RGB_MATRIX_ENABLE = no in your rules.mk and see if the stuck key still occurs? If so, then we are probably encountering the same problem, which can help narrow the issue down.

I've been seeing this issue on a split keyboard (Sofle with Elite-Pi controller) using RGB_LIGHT instead of RGB_MATRIX so if we are running into the same problem. then the problem may be more widespread than my relatively niche setup.

That's quite interesting, I will give it a try and see if RGB is the trick.

@ForsakenRei
Copy link
Contributor Author

ForsakenRei commented Jan 20, 2023

@scchow yes once I disable the RGB everything works just fine upon resume from sleep. Quite interesting though, I will proabably resync the repo sometime later today and see if anything changed.

For some reason I can only reproduce this issue on my desktop PC, I tested on my laptop but it didn't happen at all. I guess it's related to the sleep mode on a laptop, which is quite different from a desktop PC.

@scchow
Copy link

scchow commented Jan 20, 2023 via email

@ForsakenRei
Copy link
Contributor Author

ForsakenRei commented Jan 20, 2023

Good to know! I'll be doing some more debugging myself this weekend. I started noticing this problem after I made some significant changes to my keymap, so hopefully some regression tests can show which commit/feature broke it. Can you link your keymap/config files? It would be nice to cross reference what features we both have enabled to help narrow things down.

https://github.com/ForsakenRei/RP2040-MacroPad here's mine, I didn't update the rules.mk yet.

I didn't experience the inactivaty then stuck issue though, I will leave it a few hours today and see if I can reproduce that. At least the likelyhood of something wrong of RGB driver is higher now.

@KarlK90
Copy link
Member

KarlK90 commented Jan 21, 2023

@ForsakenRei @scchow could you please check if my fixes to the ws2812 vendor driver in #19652 fix your deadlocks.

@KarlK90 KarlK90 self-assigned this Jan 21, 2023
@scchow
Copy link

scchow commented Jan 21, 2023

could you please check if my fixes to the ws2812 vendor driver in #19652 fix your deadlocks.

Good catch on the timer overflow into deadlock! I've merged your fix into my branch and am currently testing it now. (Unfortunately have to leave my board idle for a while to see if it works.)

In the meantime, I've been working on a separate issue where keypresses from my rp2040 board doesn't wake Windows after it goes to S3 sleep (similar to #19008 and #16934).

At first, I thought it might have had the same root cause as this issue, but now it seems like it may be something entirely different.

Thanks for your help!

Update 1:

Left keyboard idle for 1 hour: Keyboard was able to respond without hanging (computer did not go to sleep in this period). This is very promising, I'll do another test overnight today to see if the stuck key issue has really been resolved.

@npross
Copy link

npross commented Jan 21, 2023

I've recently completed my sofle build with kb2040 controllers and I have seen issues that sound very similar. My list of problems have been: Can't always wake my laptop from sleep, and other unresponsive keyboard issues from boot, sleep etc... I look forward to your findings. I don't feel I can be much help actually diagnosing these issues but I certainly can apply patches and do some testing. I have already applied @KarlK90 fix to see if some of my issues go away. Thanks for your efforts!

@scchow
Copy link

scchow commented Jan 22, 2023

@KarlK90 Can confirm that I am no longer seeing the stuck key issue after applying your patch. Thanks!

I made a separate issue for the wake from S3 sleep problem here: #19663.

@ForsakenRei
Copy link
Contributor Author

@ForsakenRei @scchow could you please check if my fixes to the ws2812 vendor driver in #19652 fix your deadlocks.

Just got back home and it seems it all works for others, I will give it a try as well. Thanks for your effort!

@KarlK90
Copy link
Member

KarlK90 commented Jan 23, 2023

Thanks everyone for testing #19652 it has now been merged into develop. @ForsakenRei please close this issue if this resolves your issue.

@ForsakenRei
Copy link
Contributor Author

ForsakenRei commented Jan 24, 2023

Thanks everyone for testing #19652 it has now been merged into develop. @ForsakenRei please close this issue if this resolves your issue.

I think the key stuck issue was solved perfectly. I didn't have the S3 sleep issue but do encountered some weird RGB issue, I will do some test before open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants