case IOCTL_GET_RAW_COORDINATE: // For calibration wizard: return raw touch data // without transformation for point collection break;
NTSTATUS EvtDevicePrepareHardware(WDFDEVICE Device, WDFCMRESLIST ResourcesRaw, WDFCMRESLIST ResourcesTranslated) ULONG count = WdfCmResourceListGetCount(ResourcesTranslated); for (ULONG i = 0; i < count; i++) PCM_PARTIAL_RESOURCE_DESCRIPTOR desc = WdfCmResourceListGetDescriptor(ResourcesTranslated, i); if (desc->Type == CmResourceTypeConnection && desc->u.Connection.Class == CM_RESOURCE_CONNECTION_CLASS_SERIAL) if (desc->u.Connection.Type == CM_RESOURCE_CONNECTION_TYPE_SERIAL_I2C) // Save connection ID to open the WDFIOTARGET later ULONG i2cLowPosition = desc->u.Connection.IdLowPart; ULONG i2cHighPosition = desc->u.Connection.IdHighPart; return STATUS_SUCCESS; Use code with caution. 3. Implementing Touch Screen Calibration kmdf hid minidriver for touch i2c device calibration
Calibration is a critical process that ensures the accuracy and reliability of touch input on I2C devices. During calibration, the device is configured to compensate for variations in the touch sensor's electrical properties, such as capacitance and resistance. Proper calibration is essential to: During calibration, the device is configured to compensate
Capture logs via TraceView.exe and correlate with HID class driver traces. Implement WPP (Windows Software Trace Preprocessor) to log
Avoid heavy DbgPrint statements in high-frequency interrupt service routines (ISRs). Implement WPP (Windows Software Trace Preprocessor) to log raw coordinate values and post-calibration outputs efficiently.
┌─────────────┐ Calibration ┌─────────────┐ │ Calibration│ ──────────────────► │ Driver │ │ Utility │ (IOCTL) │ Context │ └─────────────┘ └─────────────┘ │ │ Read Calibration │ Parameters ▼ ┌─────────────┐ Raw Touch ┌─────────────┐ │ I²C │ ◄───────────────► │ Minidriver │ │ Controller │ Data │ (KMDF) │ └─────────────┘ └─────────────┘ │ │ Apply Transformation │ ▼ ┌─────────────┐ │ HID Class │ │ Driver │ └─────────────┘
// Public.h #include <wdf.h> #include <hidport.h>