-
Notifications
You must be signed in to change notification settings - Fork 312
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
[Mac] Upgrade Karabiner-DriverKit-VirtualHIDDevice to v2.1.0 #716
[Mac] Upgrade Karabiner-DriverKit-VirtualHIDDevice to v2.1.0 #716
Conversation
Well, any Mac people still around to test this? :) |
@vosaica I'm getting the following error when building on a MacBook Air M1:
I updated to the most recent version of all Haskell stacks, maybe they're too new?
|
I am also using Stack 2.11.1 for building. Are you using the stack command |
I am happy to test it, I just have no experience with installing anything else than the master branch. If I understand properly, I would have to install some other branch?? Following the instructions from the installation document, I am getting the same error message in the end as @nightscape . I am on MBA M1, Ventura 13.5 |
@agemartin I guess you might have encountered an issue related to submodules. Here are steps I took to compile:
If that still doesn't work, please let me know :-) I wonder if this is also the problem you have met?@nightscape |
@vosaica Thanks a lot for the support, I successfully compiled your branch. However, when I try to run kmonad, I am getting the following error:
I have added it to Input Monitoring in Security & Privacy. I also checked other issues mentioning this error but don't really get what could the solution here. Any ideas? |
Yes, the reason for this branch is to upgrade the dext version to 2.1.0 since the older version is no longer supported on later version of macOS. You just need to upgrade your dext, and you can find them here. |
@vosaica did that, now when I run it it says the following and the whole keyboard does not react. I can only kill monad by pressing the 7,100 key next to 1
|
I'm sorry to hear that. This seems weird. Normally, there would be a log that says |
@vosaica I installed the dext from the link you provided, compiled kmonad with the provided command, but I face the same issue as @agemartin. Keyboard does not respond except for the 7,100 key which kills kmonad. |
@nightscape @agemartin After reinstall my system, I think I reproduced the problem. Probably both of you forgot to activate the Karabiner driver. Which can be activated using |
The command you provided + a reboot actually worked! |
I tried it, also with |
@vosaica I simply installed a new copy of the OS (which turns out to be ventura beta) (without sweeping the disk) and now it works. |
@vosaica Every once in a while the keyboard stops responding, so I have to kill and run it again. Not particularly often so I can still use it. So far did not spot in what situation does it happen. (btw I indeed see the Karabiner virtual keyboard in keyboards) |
I have been running it now with Seems to me like the issue started somewhere here:
and would have gone like that forever:
The keymap I am running is not particularly simple but I hadn't observed this issues on Monterey. |
Also, I have been getting errors like this:
tried every single key on the keyboard and did not find any which would actually cause that. I believe I already saw a message regarding switch 5. |
typically the keyboard stop responding after closing the laptop |
I have the same issue. After standby, the keyboard does not work any more. I press |
Unfortunately this PR breaks the $ nix build "./nix?submodules=1"
error: builder for '/nix/store/md7ram8vzy47r9vws5k9aka5c57pvxv5-kmonad-0.4.1.drv' failed with exit code 1;
last 10 log lines:
>
> c_src/mac/keyio_mac.hpp:169:72: error:
> error: use of undeclared identifier 'kIOMainPortDefault'
> IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
> ^
> |
> 169 | IONotificationPortRef notification_port = IONotificationPortCreate(kIOMainPortDefault);
> | ^
> 2 errors generated.
> `cc' failed in phase `C Compiler'. (Exit code: 1) This is because this PR actually mixes two updates:
For just an update of Patch
The rest of the changes in this PR are only because you are compiling it against newer SDK that is defined in Unfortunately it is not possible (AFAIK) to update Is it possible to use some C++ macro and switch between |
Hi everyboday, I was just wondering if there's any chance to resolve this (kmonad freezing whenever/mostly when computer goes to sleep mode)? |
I haven't found a solution yet, but a launcher script as OK'ish workaround: #!/bin/bash
# Path to the kmonad binary
KMONAD_PATH="~/.local/bin/kmonad"
KMONAD_CONFIG_PATH="~/Workspaces/devtools/kmonad-contrib/keymaps/nightscape/bone_mac.kbd"
# Counter for how many times kmonad has crashed
CRASH_COUNT=0
# Timestamp of the first crash in the current sequence
FIRST_CRASH_TIMESTAMP=0
while true; do
# Run kmonad with superuser permissions
echo "Starting kmonad"
echo "sudo $KMONAD_PATH $KMONAD_CONFIG_PATH"
sudo $KMONAD_PATH $KMONAD_CONFIG_PATH
# If kmonad exits, it has crashed. Increment the crash counter.
CRASH_COUNT=$((CRASH_COUNT + 1))
# If this is the first crash in the current sequence, record the timestamp
if [ $CRASH_COUNT -eq 1 ]; then
FIRST_CRASH_TIMESTAMP=$(date +%s)
fi
# Get the current timestamp
CURRENT_TIMESTAMP=$(date +%s)
# Calculate the time difference between the first crash and now
TIME_DIFF=$((CURRENT_TIMESTAMP - FIRST_CRASH_TIMESTAMP))
# If kmonad has crashed 3 times in less than 60 seconds, exit the loop
if [ $CRASH_COUNT -ge 3 ] && [ $TIME_DIFF -lt 60 ]; then
echo "kmonad has crashed too frequently. Exiting."
exit 1
fi
# If more than 60 seconds have passed since the first crash, reset the crash counter
if [ $TIME_DIFF -ge 60 ]; then
CRASH_COUNT=0
fi
# Wait for a second before trying to restart kmonad
sleep 1
done |
@nightscape Thank you so much for the script - it works and would be a totally OK'ish solution if only I could run KMONAD without entering my password. So far I have been failing with that. I edited the sudoers file to be able to run all commands without sudo but whenever I run KMONAD without sudo, I get the following error, which to my understanding indicates I am not allowed to access some files without the sudo privileges. Any idea what I could do to fix this?
|
Hi @agemartin, I always have the following script ready: bash -c "sudo chmod u+w /etc/pam.d/sudo; if ! grep -qxE 'auth[[:space:]]+sufficient[[:space:]]+pam_tid\\.so' /etc/pam.d/sudo; then awk 'NR==2{print \"auth sufficient pam_tid.so\"} {print}' /etc/pam.d/sudo > temp_sudo && sudo mv temp_sudo /etc/pam.d/sudo; fi; sudo chmod u-w /etc/pam.d/sudo"
That adds the required line to enable the fingerprint sensor to
|
I have written a guide for macOS |
@nightscape nice, that works and certainly it is nicer to use the fingerprint than entering the password all the time. thanks! @amiorin thanks! I tried the command from your guide, |
@amiorin
EDIT: now it works! I just run it with sudo and it goes through without asking for the password. (trying to run it without sudo leads to the same error as before, so the way to go is to run it with sudo...) |
I have lost track a bit @vosaica where do we stand with this? |
All is working great here. Best keyboard experience I've ever had on MacOS. |
I'd like to merge this as well! Currently just waiting on how the nix situation develops. @sixtysecrun do you perhaps have a fix already in mind? |
I have created a PR vosaica#3 that should fix |
I can confirm that the above patch works great. |
Compiling against Apple SDK older than 12.0 ends with errors: error: use of undeclared identifier 'kIOMainPortDefault' That is because `kIOMainPortDefault` was introduced in SDK 12.0 (Monterey) and before that the `kIOMasterPortDefault` should be used. `kIOMasterPortDefault` was deprecated and was removed in SDK 12.0 References: - https://developer.apple.com/documentation/iokit/kiomainportdefault - https://developer.apple.com/documentation/iokit/kiomasterportdefault
261e4ef
to
a96f039
Compare
Thanks everyone for the testing and patching up! :) |
My understanding based on this thread is that Monterey (12), Ventura (13) and Sonoma (14) are now all supported? Should kmonad/docs/installation.md be updated? Installation.md only mentions macos up to Big Sur (11) Edit: seems to be correct - am now running kmonad on Sonoma, seems to be working well so far. |
Could you update the installation documentation for mac? |
Can I confirm this is working only for Karabiner-DriverKit-VirtualHIDDevice v2.1.0 and not (yet) for the latest v3.1.0 as included with Karabiner? |
Merely install v3.1.0 while still using the kmonad compiled with v2.1.0 should not work. There are some breaking changes in v3.1.0. However, if you want to use the newer version of v3.1.0, you can try this branch where I updated the Karabiner-DriverKit https://github.com/vosaica/kmonad/tree/Dev-DriverKit-v3.1.0 If you have got the compile environment set up, this will do the compilation
|
I have been using this branch for several months, and it's been running well. I'm not sure if someone wants to upgrade Karabiner-DriverKit to v3.1.0. On one hand, there are some breaking changes so I have to edit the dext.cpp, and on the other hand, v3.1.0 doesn't seem to introduce any new features. @slotThe If you want, I can create a PR for this upgrade |
Thank you so much, I will try it.
Even if there are no new features in v3.1.0, in my mind it seems important for this project to keep up with the latest Karabiner driver, at least to avoid problems for people who are coming from Karabiner - as I am.
Again, thank you for this work.
|
@vosaica Sure, go ahead! |
I tried this and it didn't fix it for me. I upgraded to Karabiner 14.13.0 and System Settings is showing Karabiner DriverKit VirtualHIDKeyboard 1.7.0.
Returns If I run kmonad I get the connected message but there is no keyboard input at all. I have to use my mouse to shutdown the iTerm window kmonad is running in and reconnect my keyboard to get it working again. |
@TC72 Have you tried activating the extension as mentioned before? It is working for me on Sonoma. |
Thanks for the reply, as it's showing in system settings I thought that was enough to be sure it's activated? |
Hi @TC72 - yes I recently upgraded to the newest Karabiner, then I tried the fork using the instructions given here by @vosaica - I can't remember if I activated the extension then but I have had to do this in the past so I probably did. Forgive me for stating the obvious but have you tried a restart? Otherwise perhaps it might be a case of having more that one extension installed; I'm not sure how that might occur but you could search your system for the filename and see if there's a duplicate. |
@robrecord thanks I did try to restart. I'll see if activating helps. |
Good luck |
@robrecord thanks once again for all your help. I'm not sure what combination fixed this but now when I run kmonad I see this output instead of just
Now I learn to create keymaps. |
I tried upgrading Karabiner-DriverKit-VirtualHIDDevice to their latest version.
The required work seems surprisingly minimal. I tried compiling and running it on the Ventura and beta version of Sonoma, and it appears to be working fine.
I will update the installation documentation, once we confirm that the new code can be merged.