KMDF is Microsoft's modern framework for developing kernel-mode drivers. It abstracts away much of the complexity of legacy Windows Driver Model (WDM) programming by providing a set of object-oriented APIs and built-in support for Plug and Play (PnP) and power management. In the context of touch devices, a KMDF-based minidriver is highly advantageous because it offers robust performance, direct access to hardware resources, and availability across all Windows platforms that support WDF. However, this power comes with a caveat: poorly written KMDF transport minidrivers can potentially crash the entire system, making careful development and testing essential.
+-----------------------------------+ | Windows Touch Input Stack | +-----------------------------------+ | +-----------------------------------+ | HIDCLASS.sys | (Class Driver) +-----------------------------------+ | +-----------------------------------+ | Your KMDF Minidriver | (Custom HID Minidriver) +-----------------------------------+ | +-----------------------------------+ | SpbCx.sys | (Simple Peripheral Bus Framework) +-----------------------------------+ | +-----------------------------------+ | I2C Controller Driver | +-----------------------------------+ | [ I2C Hardware Bus ] | +-----------------------------------+ | Touch I2C Device | (Hardware) +-----------------------------------+ Key Framework Components
KMDF allows developers to build stable, modern kernel-mode drivers that handle complex hardware interactions—including I2C bus negotiation, interrupt management, and power sequencing—while reducing the risk of system instability compared to older WDM models. However, HID minidrivers are not a standard fit in the KMDF architecture because the HID class driver has conflicting requirements for the driver dispatch table. Microsoft resolves this with a special pass-through driver ( MsHidKmdf.sys ), which resides between the HID class driver and your minidriver, acting as the functional driver while forwarding I/O requests to your filter driver. kmdf hid minidriver for touch i2c device calibration
Calibration is rarely a single, universal process; it depends heavily on the firmware of the I2Ccap I squared cap C
NTSTATUS TouchEvtDeviceAdd( _In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit ) NTSTATUS status; WDFDEVICE device; PDEVICE_CONTEXT devContext; HID_MINIDRIVER_REGISTRATION hidRegistration; UNREFERENCED_PARAMETER(Driver); // Invoke HID Class function to configure DeviceInit status = HidRegisterMinidriver(&hidRegistration); // Note: Actual binding requires assigning the WDFDEVICE to the HID stack status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &device); if (!NT_SUCCESS(status)) return status; devContext = GetDeviceContext(device); devContext->WdfDevice = device; // Allocate resources, assign I2C targets, initialize spinlocks for calibration data return status; Use code with caution. 4. The Touch Calibration Pipeline However, this power comes with a caveat: poorly
If you are dealing with a specific Silead or Goodix sensor, or need help creating a custom calibration tool, please let me know. Share public link
Calibrating KMDF HID Minidrivers for Touch I2C Devices: A Comprehensive Engineering Guide Microsoft resolves this with a special pass-through driver
The HID minidriver sits the Microsoft-supplied HID class driver within the device's driver stack. Unlike a full-function driver, the minidriver does not typically parse HID reports or implement the entire HID protocol. Instead, it functions as a lower filter driver that handles low-level transport-specific operations, such as communicating over I²C, managing device power sequencing, and performing hardware initialization.