HID Injection

Input injection is needed for many reasons. One of the most requested reasons is to support SPI screens, which have capacitive or resistive touch panels which can be read via I2C. How do you translate this touch input from the display panel to something Windows can consume?

Windows 10 IoT Core does not contain the traditional Win32 API SendInput. SendInput it is tightly bound to the legacy input system, which is not present in the image. IoT Core does not currently have a replacement for this API, but we hope to introduce a compatible API in the future. In the meantime, this sample will allow you to deploy a driver to perform low level injection of touch, keyboard and mouse events, and can be used until the SendInput equivelent API is available.

The HID Injection sample leverages the Virtual HID Framework.

Prerequisites

In order to build this driver you will need the following:

Optional:

  • If you have git or the github app installed, you can clone the repository as well.

Set up the Kernel Debugger

  1. Set up the Kernel debugger for your device by following the WinDBG instructions.

Building and Deploying the HID Injector

  1. Be sure you’ve installed the Visual Studio update and the Windows 10 Driver Development kit before continuing.
  2. On your development machine, use Windows Explorer to navigate to the folder where you downloaded or cloned samples.
  3. Open the project located Samples\HidInjector\HidInjector.sln.
  4. Select the architecture you intend to deploy to: ARM for Raspberry Pi or Dragon Board, x86 for MinnowBoard Max.
  5. You can now build the solution.

Build the Update package

  1. Open the Deployment and Imaging Tools Environment from the Start Menu with administrative privileges (Search for the program, then right click on it and select Run As Administrator)
  2. In the command window, cd into your project directory.
  3. cd into the driver directory.
  4. run the script CreateDriverPackage.cmd

Copying the HID Injector to your device

  1. Open a network share on your IoT Core device by opening the Run dialog (Win-R), then entering \\\\IP for your IoT Core device\\c$. Enter credentials if prompted.
  2. Create a deploy folder on your IoT Core device.
  3. In Visual Studio, Right Click on the HidInjectorKd project, then select Open Folder in File Explorer.
  4. In the File Explorer that opened on your project, Navigate to the driver directory.
  5. Now, copy the Microsoft.HidInjectionSample.HidInjectionSample.cab to the network folder you opened in the first step.

Installing the HID Injector

Use the Windows device portal to install the Microsoft.HidInjectionSample.HidInjectionSample.cab file.

Install CAB

Verify installation

If you’ve installed the driver, verify the install by navigating to the Web management console http://<your device ip>:8080/devicemanager.htm and looking for the HID Injection Sample node.

HID Injector Sample Application

Included in the solution is a C++ console application used to demonstrate communication with the Hid injection Driver. The Driver is discovered by class using CM_Get_Device_Interface_List. The sample application will inject Touch, Keyboard and Mouse events by synthesizing a HID block, and calling the driver with that block. The Sample application is C+ which requires the console app procedures for deploying.


Was this page helpful?
Additional feedback?
Thank you! We appreciate your feedback.
Follow us