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

VoodooPS2: Need improvements on using Caps Lock key to change input source #435

Closed
stevezhengshiqi opened this issue Jul 24, 2019 · 6 comments
Labels

Comments

@stevezhengshiqi
Copy link

stevezhengshiqi commented Jul 24, 2019

After enabling Use the Caps Lock key to switch to and from ABC, the input sources can't be changed by pressing Caps Lock, and there's an inconsistency issue between Caps Lock button light and lowercase or uppercase status.

However, in some circumstances, using Caps Lock to change input sources is working, like the address bar in Safari.app, Xcode, or editing markdown files, etc. In these circumstances, Use the Caps Lock key to switch to and from ABC option can't control Caps Lock's behavior - pressing Caps Lock key will always shift input sources.

Related issues in Rehabman's repo:
RehabMan/OS-X-Voodoo-PS2-Controller#154
RehabMan/OS-X-Voodoo-PS2-Controller#142

This issue happened when using Simplified Chinese and English input sources.

@vit9696
Copy link
Contributor

vit9696 commented Jul 24, 2019

@vit9696 vit9696 closed this as completed Jul 24, 2019
@stevezhengshiqi
Copy link
Author

@vit9696 Thank you for pointing out. It’s a good work around, but is it possible that the Caps Lock key can be used to change input source just like a native Mac?

@vit9696
Copy link
Contributor

vit9696 commented Jul 24, 2019

Well, the thing does not work well for me even on USB keyboard. The related cause of the issue seems to rest here. I will reopen the issue, but we have no plans to work on it any soon.

@vit9696 vit9696 reopened this Jul 24, 2019
@vit9696 vit9696 added enhancement New feature or request priority:low labels Jul 24, 2019
@frol
Copy link

frol commented Sep 10, 2019

I have updated the workaround to the following (I just assumed that Sierra and High Sierra require the "full" workaround while I can only test on Mojave and I need to only fire key_down + key_up):

diff --git a/VoodooPS2Keyboard/VoodooPS2Keyboard.cpp b/VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
index ee3bcaf..d7f4fb4 100644
--- a/VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
+++ b/VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
@@ -1747,13 +1747,17 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(const UInt8* packet)
     //REVIEW: work around for caps lock bug on Sierra 10.12...
     if (adbKeyCode == 0x39 && version_major >= 16)
     {
-        if (goingDown)
+        // Mojave 10.14 only needs a part of the workaround:
+        // https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/issues/142#issuecomment-529813842
+        if (goingDown || version_major >= 18)
         {
-            static bool firsttime = true;
             clock_get_uptime(&now_abs);
             dispatchKeyboardEventX(adbKeyCode, true, now_abs);
             clock_get_uptime(&now_abs);
             dispatchKeyboardEventX(adbKeyCode, false, now_abs);
+        }
+        if (goingDown && version_major < 18) {
+            static bool firsttime = true;
             if (!firsttime)
             {
                 clock_get_uptime(&now_abs);

Should I send a PR?

Here is the kext:
VoodooPS2Controller-2.0.3-frol-RELEASE.zip

I can now use CapsLock to switch language layouts (configured via native MacOS preferences) and Ctrl + CapsLock toggles the upper/lower-case modes on my Lenovo y50-70 Mojave!

Thank you for your hard work!

@usr-sse2
Copy link
Contributor

usr-sse2 commented Sep 10, 2019

I think that version checks are not needed. Sierra and High Sierra had issues when using 'full' workaround but it was still better than having a four-state Caps Lock button without the workaround.

I'll check your patch and merge if it works.

@usr-sse2
Copy link
Contributor

@frol It works, thanks!

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

No branches or pull requests

5 participants