pub fn classify_hid_interfaces(
interfaces: &[(String, i64, i64)],
) -> (Vec<String>, Vec<String>)Expand description
Classifies macOS HID interfaces into (keyboards, mice), de-duplicated by name.
This is deliberately simpler than the Linux classifier, because macOS gives better
data. The v0.7.0 Linux finding still holds — on a Logitech unifying receiver no
kernel-visible capability separates a keyboard from a mouse, and fastfetch gets it
wrong in both directions there — but macOS does not present the problem in that form:
it publishes one IOHIDDevice per HID interface, each with its own PrimaryUsage,
so the role is stated rather than inferred. There is no ambiguous case to resolve and
so no need for the HID++ model_name tiebreak or the “report neither” fallback.
A composite device therefore appears in both lists, and that is correct rather than
a bug: Apple Internal Keyboard / Trackpad genuinely is a keyboard and a pointing
device, and it publishes an interface for each. Verified against fastfetch on the same
machine, which lists exactly the same two names under both fields.
Pure and injectable for the usual reason — the test feeds it a verbatim fixture from a real machine rather than consulting whatever is plugged into the one running it.