Kmdf Hid Minidriver For Touch I2c Device Calibration Direct

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. kmdf hid minidriver for touch i2c device calibration


For a multi-touch device, your HID Report Descriptor must conform to the Windows Precision Touchpad (PTP) or HID-over-I2C v1.0 spec. A minimal single-touch descriptor: After calibration, construct a valid HID Touch Report

0x05, 0x0D,        // Usage Page (Digitizer)
0x09, 0x04,        // Usage (Touch Screen)
0xA1, 0x01,        // Collection (Application)
0x85, 0x01,        // Report ID 1
0x09, 0x22,        // Usage (Finger)
0xA1, 0x00,        // Collection (Physical)
0x09, 0x42,        // Usage (Tip Switch)
0x15, 0x00,        // Logical Minimum (0)
0x25, 0x01,        // Logical Maximum (1)
0x75, 0x01,        // Report Size (1)
0x95, 0x01,        // Report Count (1)
0x81, 0x02,        // Input (Data,Var,Abs)
0x09, 0x30,        // Usage (X)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65535)
0x75, 0x10,        // Report Size (16)
0x95, 0x01,        // Report Count (1)
0x81, 0x02,        // Input (Data,Var,Abs)
... etc ...
0xC0, 0xC0

Your minidriver returns this descriptor in TouchCalibEvtGetDescriptor. The calibrated X and Y values must fit within the logical maximum defined here. Use WdfRequestSend down to the HID class driver


Add WPP traces for calibration flow:

WPP_INIT_TRACING(DriverObject, RegistryPath);
TraceEvents(TRACE_LEVEL_INFO, DBG_INIT,
    "Calibration version %d loaded, size %d", version, size);