Add HIDP support#61
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Human Interface Device Protocol support via the kernel's HIDP module, turning the previously empty HIDP target into a working session-management layer:
HIDPSocket— control socket for kernel HID sessions:addConnectionbridges connected L2CAP control (PSM 17) and interrupt (PSM 19) sockets into a kernel input device, passing the HID report descriptor, parser version, device identity (vendor/product/version), name, flags, and idle timeout;removeConnectiondestroys a session;connections()lists active sessions;connectionInformation(for:)queries a single device.HIDPIObut had no request types). The add request embeds a pointer to the caller's report descriptor buffer, and the connection list embeds a pointer to a caller-allocated array — both wired internally with the buffers kept alive for the duration of the call.HIDPConnectionFlag(virtual cable unplug, boot protocol mode),HIDPConnectionState, and a publicHIDPConnectioninfo struct.Together with the classic L2CAP conveniences (#58), this enables HID hosting without a daemon; fetching the report descriptor via service discovery remains a follow-up.
Test plan
swift buildsucceeds with no new warningsCAP_NET_ADMIN(root)