Prefer user-mode calibration (tabcal) when:
Use KMDF calibration only when:
Ensure your affine transform scales each touch point independently. The HID protocol for multi-touch (Usage Page 0x0D, Usage 0x05) requires that each contact’s Tip Switch and X/Y arrays be transformed individually. Use a parallel loop (KeAcquireSpinLock for each touch frame) to maintain performance. kmdf hid minidriver for touch i2c device calibration best
A best-in-class KMDF minidriver adds post-calibration filtering:
A HID minidriver works under the HIDClass umbrella. It handles transport-specific details (I2C read/write) while HIDClass parses reports. Your driver does not need to re-implement HID parsing—only the transport and calibration logic. Prefer user-mode calibration (tabcal) when:
Best Practice: Use the HID_DEVICE_EXTENSION structure and register as a HID minidriver via HidRegisterMinidriver. This keeps your KMDF driver lean.
If calibration must be read from the device, use the SPB target. This involves creating an I2C Write-Read sequence (Write the register address, Read the data). Use KMDF calibration only when : Ensure your
Critical: Perform this initialization in EvtDeviceD0Entry or EvtDevicePrepareHardware, never in the ISR (Interrupt Service Routine).
// Simplified SPB I2C Read logic
NTSTATUS ReadFactoryCalibration(WDFIOTARGET SpbTarget)
// 1. Build the Write-Read request
// Write: The Register Address to read from
// Read: The buffer to hold calibration data
// Ensure the I2C lock is acquired if the bus is shared
// ... Submit request synchronously or asynchronously via WdfIoTargetSendIoctlSynchronously