Skip to content

Upstream: migrate Kanata to the current VirtualHIDDevice protocol #982

Description

@malpern

Direction

Treat this as an upstream-first Kanata compatibility project, independent of KeyPath integration.

The immediate goal is to make the latest upstream Kanata compatible with the current Karabiner-DriverKit-VirtualHIDDevice protocol, validate the result as a standalone Kanata change, submit it upstream, and get it merged. KeyPath should consume the upstream result afterward in a separate integration step.

Do not update the KeyPath submodule, bundled driver package, release scripts, installer, or macOS 27 lane as part of the upstream PR.

Context

Karabiner-DriverKit-VirtualHIDDevice v8.0.0 uses client protocol 7. The Kanata driverkit client currently targets the older protocol-5 API and local-datagram transport.

Breaking changes since the currently supported driver include:

  • v7 changed IPC from pqrs::local_datagram to pqrs::unix_domain_stream and moved the client protocol from 5 to 6.
  • v8 removed virtual_hid_device_service::request::get_status, changed subsequent request enum values, removed virtual_hid_device_service/utility.hpp, and moved the protocol from 6 to 7.
  • Clients using the embedded C++ headers must be rebuilt and adapted to the new API.

KeyPath also carries Kanata-side work that must not be lost when designing the upstream change:

Verify authorship and current upstream provenance before deciding whether each behavior should be ported, redesigned, or omitted.

Phase 1: upstream Kanata implementation

Work from the latest jtroo/kanata main branch in a dedicated Kanata checkout and branch.

  1. Reproduce the current incompatibility against VirtualHIDDevice v8.
  2. Update the Kanata karabiner-driverkit client and vendored headers/source to the selected current protocol.
  3. Replace removed status APIs with the supported client signals:
    • driver_activated
    • virtual_hid_keyboard_ready
    • virtual_hid_pointing_ready
  4. Port the reconnect, report-reset, convergence, and stuck-key protections where they remain semantically necessary.
  5. Add focused automated coverage around protocol framing/state, readiness transitions, reconnect behavior, report convergence, and shutdown cleanup.
  6. Test standalone Kanata with the matching current VirtualHID daemon on supported macOS versions available outside KeyPath.
  7. Keep the upstream diff focused and free of KeyPath-specific paths, packaging, naming, or assumptions.
  8. Open a PR against jtroo/kanata, address upstream review and CI, and continue until it is merged.

Upstream acceptance criteria

  • Latest upstream Kanata builds against and communicates with the selected current VirtualHIDDevice release.
  • Client and daemon use the same protocol version.
  • No references remain to removed v8 APIs.
  • Keyboard output, readiness, reconnect, shutdown, and stuck-key recovery are validated.
  • The implementation is acceptable upstream and the Kanata PR is merged.

Phase 2: KeyPath integration

Begin only after the upstream Kanata work is merged.

Create a separate KeyPath issue or focused follow-up PR to:

  • update the KeyPath Kanata fork from the merged upstream commit
  • reconcile any remaining KeyPath-only patches without duplicating upstream behavior
  • update the bundled VirtualHID package and release tooling
  • rebuild the Kanata engine and host bridge
  • run signed/notarized install and upgrade verification
  • hand the resulting build to the separate macOS 27 validation lane

Non-goals for the upstream PR

  • KeyPath installer or UI changes
  • KeyPath release packaging
  • KeyPath submodule updates
  • broad Kanata macOS architecture cleanup
  • claiming macOS 27 support without that lane completing its own validation

Completion rule

This ticket is complete when the standalone Kanata protocol migration has been merged upstream and a clearly scoped KeyPath integration follow-up exists. KeyPath adoption is downstream work, not part of the upstream PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-riskPotential regression risk not yet confirmed as a reproducible KeyPath defectdriver-kithuman-in-loopHuman involvement required; use on-hold separately when implementation cannot proceedkanataScope: upstream Kanata or its macOS input backendon-holdValid work intentionally deferred pending evidence, dependency, or product decisionresearchNeeds investigation or external discovery before implementation scope is clearupstream

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions