Skip to content

IPC feature to exchange data regardless of HID device mode #379

Closed

Description

@nefarius

For the longest time a common challenge with any HID driver that offloads work to HIDCLASS.SYS (and xinputhid.sys) is exchanging data with the device (driver) that is not defined in the report descriptor (e.g. custom feature requests, multiple collections and alike) and may cause compatibility issues.

A custom collection with multiple feature reports is not always possible; the XInput mode depends on a standard report descriptor that does not use Report IDs and therefore can not be modified without breaking compatibility.

We currently have a mixture of "reading from JSON" for data input and "writing to status properties" to fetch status, which works but is clunky, timing sensitive and gets verbose to extend and maintain fast.

I've started implementing a shared memory region in the driver that is accessible from any other user-mode application and acts as an IPC mechanism for pre-defined messages that get exchanged between app (client) and the driver in a HTTP-like request-response fashion. With this method, it does not matter which HID device mode is active; the data exchange bypasses the HID stack and happens via shared memory and synchronization objects (events, mutexes) and allows for write operations from non-elevated processes.

IPC use-cases

A collection of command ideas to use this mechanism with:

  • On-demand Bluetooth pairing to any custom address (similar to the legacy "SIXAXIS Pair Tool") at any point during runtime
  • Toggle volatile runtime settings (like alternate rumble switching)
  • Allow any non-HID app to read the raw unmodified HID input report
  • Allow any non-HID app to update LEDs and send rumble commands
    • Allows for overriding the XInput player ID with whatever value matches best
  • Allow any non-HID app to submit custom USB control requests (great for motion calibration R&D)
  • Allow for any app to send pairing requests to arbitrary MAC addresses (to offer the same feature as the old SixaxisPairTool)

Activity

  1. added
    enhancement
    Core
    on Aug 14, 2024
  2. added this to the Version 3 milestone on Aug 14, 2024
  3. self-assigned this
    on Aug 14, 2024
  4. nefarius commented on Sep 5, 2026

    @nefarius
    OwnerAuthor

    Status update on the IPC work:

    Elevation is gone (already on master). PR #431 dropped the old OpenProcess / DuplicateHandle path against WUDFHost. The driver now publishes a named per-slot event Global\DsHidMiniHidReportEvent{slot} with the same Authenticated-Users DACL as the other IPC objects, so a non-elevated client can open it with EventWaitHandle.OpenExisting and wait for reports.

    Raw input reports are now multi-consumer. The per-slot event is switching from auto-reset (one waiter wins) to manual-reset, and each HID slot carries a seqlock (SequenceNumber: odd = write in progress, even = stable). Every waiting app is woken on the same report, readers retry on a torn snapshot, and disconnect zeros the slot then signals so blocked clients see SlotIndex == 0 instead of hanging until timeout. This is on feat/ipc-multi-consumer-input-reports.

    Still open from the original checklist:

    • Toggle volatile runtime settings (alternate rumble, etc.)
    • Allow any non-HID app to update LEDs / send rumble (DSHM_IPC_MSG_CMD_DEVICE_SET_PLAYER_INDEX is wired end-to-end in the SDK, but the driver handler still returns STATUS_NOT_IMPLEMENTED)
    • Submit custom USB control requests
    • Pairing to an arbitrary MAC is already implemented (SetHostAddress / PAIR_TO)

    IPC remains gated behind the IPCEnabled registry value under the driver parameters key and is not in any released driver build yet. The SDK can now be packed in CI; publishing Nefarius.DsHidMini.IPC to nuget.org is on-demand via sdk-v* tags and OIDC trusted publishing (publish-to-nuget.yml).

  5. nefarius commented on Sep 9, 2026

    @nefarius
    OwnerAuthor

    Status update on the remaining IPC checklist:

    Player index, rumble, and volatile alternate rumble are implemented on feat/ipc-runtime-output-commands (PR #509).

    • DSHM_IPC_MSG_CMD_DEVICE_SET_PLAYER_INDEX no longer returns STATUS_NOT_IMPLEMENTED. Slots 1–7 use the console LED combinations (5 = 1+4, 6 = 2+4, 7 = 3+4). Automatic LED authority is handed to the application so battery refreshes do not overwrite the slot; configured Driver authority returns STATUS_ACCESS_DENIED. The reply command tag was also corrected (SET_PLAYER_INDEX instead of PAIR_TO).
    • New SetRumble / DSHM_IPC_MSG_CMD_DEVICE_SET_RUMBLE sends motor strengths through the existing rescale, keep-alive, and Navigation-suppression path.
    • New SetAlternateRumbleMode / DSHM_IPC_MSG_CMD_DEVICE_SET_ALTERNATE_RUMBLE_MODE toggles RumbleControlState.AltMode.IsEnabled only (under OutputReport.Lock). JSON is not updated; a config hot-reload restores the file value.

    These controls are volatile and available to any non-elevated authenticated client, same as the other IPC objects. SDK APIs stay source-compatible for SetPlayerIndex.

    Still open from the original checklist:

    • Submit custom USB control requests (deferred: the IPC objects are writable by any authenticated user, so a generic transfer API would let any local app issue device control requests)

    Pairing (SetHostAddress / PAIR_TO) and multi-consumer raw input reports were already done. IPC remains gated behind the IPCEnabled registry value under the driver parameters key and is not in any released driver build yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Coreenhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions