Kmdf Hid Minidriver For Touch I2c Device Calibration May 2026

A real-world scenario: An industrial HMI running in a warehouse (-10°C to 50°C). The I2C touch controller’s raw coordinates drifted 120 pixels over the temperature range.

Solution implemented via KMDF minidriver:

This illustrates the power of a custom KMDF HID minidriver for touch I2C device calibration – something impossible with generic drivers.


Use Device Manager → Human Interface Devices → Properties → Details → "Hardware IDs" to confirm driver attachment. kmdf hid minidriver for touch i2c device calibration

Use HIDClient or HidDig tool to dump feature reports.

After calibration, construct a valid HID Touch Report. According to the HID over I2C specification, a typical multi-touch report includes:

Use WdfRequestSend down to the HID class driver via a touch collection. A real-world scenario: An industrial HMI running in


NTSTATUS MyTouchCalibEvtDeviceAdd(WDFDEVICE Device)
WDF_IO_QUEUE_CONFIG queueConfig;
    WDFQUEUE queue;
    WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchSequential);
    queueConfig.EvtIoInternalDeviceControl = MyTouchCalibEvtInternalDeviceControl;
    WdfIoQueueCreate(Device, &queueConfig, WDF_NO_OBJECT_ATTRIBUTES, &queue);
// Store calibration parameters (read from registry)
CALIBRATION_DATA calib;
ReadCalibrationRegistry(Device, &calib);
WdfDeviceSetContext(Device, &calib);
return STATUS_SUCCESS;

typedef struct 
    int x_offset;
    int y_offset;
    float x_gain;
    float y_gain;
 CALIBRATION_DATA;

VOID ApplyCalibrationToReport(BYTE* report, ULONG len) // Assuming HID report format: TipSwitch(1), X(2), Y(2), Pressure(2) if (len < 7) return; USHORT rawX = (USHORT)(report + 1); USHORT rawY = (USHORT)(report + 3); This illustrates the power of a custom KMDF

CALIBRATION_DATA* calib = GetCalibrationContext();
USHORT calX = (USHORT)(rawX * calib->x_gain + calib->x_offset);
USHORT calY = (USHORT)(rawY * calib->y_gain + calib->y_offset);
// Clamp to valid range (0–32767 for HID)
calX = max(0, min(32767, calX));
calY = max(0, min(32767, calY));
*(USHORT*)(report + 1) = calX;
*(USHORT*)(report + 3) = calY;

This implementation involves hooking into the EvtDevicePrepareHardware event to retrieve data and EvtDeviceD0Entry to apply it to the hardware.

Generic HIDI2C.sys does not support:

Manufacturers often provide user-mode calibration tools, but these suffer from race conditions during boot and lack the ability to inject corrected data before Windows Touch loads.