macoskeyboardhidiokitdarwin

Mac low-level keyboard device corresponding to Linux /dev/input?


What is the name of the low-level keyboard device in macOS (somewhere in Darwin / Mach / IOKit) that corresponds to /dev/input in Linux? (e.g. /dev/input/event0)

Context: I'm asking because want to 'map' the Mac device to a Docker container running Linux.


Solution

  • There is no such direct correspondence with a /dev/ node on macOS. HID events are (eventually) processed in the IOHIDSystem class in the kernel and are transferred to user space into WindowServer via the IOHIDUserClient. Applications can also directly access aspects of a HID device directly via the IOHIDLib, which uses IOHIDLibUserClient to get kernel HID data.

    macOS only uses /dev/ nodes for a handful of device types, notably block devices (diskXsY, rdiskXsY), serial ports, and the traditional UNIX virtual devices such as null, zero, random, etc. There are also a few BSDisms, such as BPF. Almost everything else is handled only via IOKit.