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

repeated error connect_failed asio.system:2 #765

Closed
postylem opened this issue Nov 6, 2023 · 2 comments
Closed

repeated error connect_failed asio.system:2 #765

postylem opened this issue Nov 6, 2023 · 2 comments

Comments

@postylem
Copy link
Contributor

postylem commented Nov 6, 2023

This seems very related to #375, but unlike the issue there, I have installed the already built and signed package for dext version 1.15.0, as instructed (not a newer version). Yet, when I run (in the root dir of this repo, after building kmonad)

sudo kmonad keymap/template/apple.kbd -l debug

I get the following behavior: key presses seem to be registered (as printed with the debug flag), but they don't seem to do anything (I can't type in any other apps, or use any keyboard commands, and ctrl-c doesn't cancel the running kmonad process, I have to close my terminal window to stop it).

Password:
Opening KeySink
Initializing Mac key sink
Opening KeySource
Opening IOKit devices
Launching process: emitter_proc
connect_failed asio.system:2
connect_failed asio.system:2
connect_failed asio.system:2
______________________________________________________________
Received event: Press <d>
Running hooks
Registering untimed hook: 1
Emitting: Press <d>
______________________________________________________________
Received event: Release <d>
Running hooks
Registering untimed hook: 1
Emitting: Release <d>
connect_failed asio.system:2
connect_failed asio.system:2
connect_failed asio.system:2
connect_failed asio.system:2

Steps to reproduce, as instructed in the readme:

git clone --recursive https://github.com/kmonad/kmonad.git
cd kmonad

next, as instructed, I install dext from git submodule (installer succeeds without issues) and activate (also no issues)

open c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/dist/Karabiner-DriverKit-VirtualHIDDevice-1.15.0.pkg
/Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate

this prompted me to allow the extension permissions in System Settings > Security, which I granted.

Then I stack install kmonad (I'm using ghcup, and I found I have to use --system-ghc, and set the compiler to the my selected ghc --version, which happens to be 9.4.7, when installing kmonad, otherwise I get an error... I'm not sure if this is important, but the following seems to work with no errors)

stack --system-ghc --compiler ghc-9.4.7 install --flag kmonad:dext --extra-include-dirs=c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/include/pqrs/karabiner/driverkit:c_src/mac/Karabiner-DriverKit-VirtualHIDDevice/src/Client/vendor/include

this results in an executable copied to ~/.local/bin/kmonad

I then give input monitoring privileges to this executable, going to System Settings > Privacy & Security > Input Monitoring, and also give privileges to my terminal emulator (kitty), and then test run sudo kmonad keymap/template/apple.kbd -l debug, getting the error connect_failed asio.system:2 every half-second or so.


Apple M1 Max
macOS 14.1 (23B74)
terminal emulator: kitty.app (also tried in Terminal.app, same issue. Both have Input Monitoring privileges. )

@postylem
Copy link
Contributor Author

postylem commented Nov 6, 2023

sorry I realize this must be a known issue for newer versions of macOS (e.g. #730).

I'll leave this here for now, but I should have looked into more issue threads before opening this one perhaps.

I gather from the discussion in #716 that I should be using the current version of Karabiner VirtualHIDDevice Manager (not 1.15.0, as instructed in the readme). But after installing that version (from here), and verifying it is used

$ defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion

2.1.0

I no longer get the connect_failed asio.system:2 warnings, but still get the behavior that the keys are logged, but don't do anything (so it still doesn't work).

@postylem
Copy link
Contributor Author

postylem commented Nov 6, 2023

OK, in my case, I just needed to remove and reinstall Karabiner-DriverKit-VirtualHIDDevice, like this:

bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/deactivate_driver.sh'
sudo bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/remove_files.sh'
sudo rm -rf /Library/Application\ Support/org.pqrs/

then reinstall if from https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice/releases/download/v2.1.0/Karabiner-DriverKit-VirtualHIDDevice-2.1.0.pkg.

This time, I was prompted to identify my 'new keyboard', and after doing that, kmonad worked. Somehow this hadn't been triggered before, and completely removing and reinstalling was necessary.

@postylem postylem closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant