Gspy Input Devices Driver



Gspy input devices driver touchpad-->

The section includes the following topics about the operation of the HID class driver:

  • Operational features of the HID class driver
  • Binding the operation of the HID class driver to a HID minidriver
  • Communicating with a HID minidriver
Input

For more info about the Surface MSI naming convention, see Deploy the latest firmware and drivers for Surface devices. If there's not an.msi file that corresponds to the build of Windows 10 you have installed, select the.msi file that's closest to (but still lower than) your build number. Hardware innovation required either overloading data in an existing protocol or creating non-standard hardware with its own specialized driver. HID provided support for these “boot mode” devices while adding support for hardware innovation through extensible, standardized and easily-programmable interfaces.

  • Input devices can be checked and configured individually. Input values can be seen in the input fields. Force feedback can be disabled for each device. Game controllers. The available input devices are shown in the Game Controllers section. Choose a device and click 'Edit'. On the configuration screen there are 3 blocks.
  • The package provides the installation files for Microsoft USB Input Device Driver version 10.0.4. If the driver is already installed on your system, updating (overwrite-installing) may fix various issues, add new functions, or just upgrade to the available version.
  • Windows Apps for Keyboard Drivers. Windows Apps for Keyboard Drivers. Join or Sign In. Sign in to add and modify your software. VIA AC'97 PCI Audio Device Version 6.zip.

See Creating WDF HID minidrivers for more information.

Operational features of the HID class driver

The HID class driver does the following:

  • Provides and manages the upper-level interface that kernel-mode drivers and user-mode applications use to access the HID collections that an input device supports.

    The HID class driver transparently manages and routes all communication between upper-level drivers and applications and the underlying input devices that support HID collections. It manages the different data protocols that are used by different input devices and input queues that support more than one open file on the same HID collection.

    The upper-level interface to HID collections consists of the HID class driver IOCTLs, the HIDClass support routines, and the HIDClass structures.

  • Communicates with a HID minidriver by calling the minidriver's standard driver routines.

  • Creates a functional device object (FDO) for HIDClass input devices enumerated by a lower-level bus or port driver.

    For example, the HID class driver creates and manages the operations of an FDO that represents a USB HID device enumerated by the system-supplied USB driver stack.

  • Provides the functionality of a bus driver for the child devices (HID collections) supported by an underlying input device.

    The HID class driver creates a physical device object (PDO) for each HID collection supported by an input device and manages the collection's operation.

Binding a minidriver to HIDClass

A HID minidriver binds its operation to the HID class driver by calling HidRegisterMinidriver to register itself with the HID class driver. The registration operation does the following:

  • Saves a copy of the entry points (pointers) to the HID minidriver's standard driver routines in the HID class driver's device extension.

    A HID minidriver sets its entry points in the driver object that the minidriver receives as input to its DriverEntry routine. The HID minidriver sets these entry points before it registers with the HID class driver.

  • Resets the entry points in the minidriver's driver object to the entry points for the standard driver routines supplied by the HID class driver.

The HID class driver supplies the following standard driver routines:

  • AddDevice and Unload routines

  • Dispatch routines for the following I/O requests:

The registration process also allocates memory for the HID mindriver device extension. Although the memory is allocated by the HID class driver, only the HID minidriver uses this device extension.

Communicating with a HID minidriver

The HID class driver communicates with a HID minidriver by calling the HID minidriver's AddDevice, Unload, and dispatch routines as follows:

Calling the AddDevice Routine

When the HID class driver's AddDevice routine is called to create a functional device object (FDO), the HID class driver creates the FDO, initializes it, and calls the HID minidriver AddDevice routine. The HID minidriver AddDevice routine does internal device-specific initialization and, if successful, returns STATUS_SUCCESS. If the HID minidriver AddDevice routine is not successful, the HID class driver deletes the FDO and returns the status returned by the HID minidriver AddDevice routine.

Calling the Unload Routine

When the HID class driver Unload routine is called, the HID class driver completes releasing all resources associated with FDO and calls the HID minidriver's Unload routine.

Calling the Dispatch Routines

To operate a device, the HID class driver primarily calls the HID minidriver dispatch routine for internal device control requests.

In addition, when the I/O manager sends Plug and Play, power, or system control requests to the HID class driver for an FDO, the HID class driver processes the request, and calls the HID minidriver's corresponding dispatch routine.

The HID class driver does not send the following requests to the HID minidriver: create, close, or device control.

Operation of a HID minidriver

A HID transport minidriver abstracts the operation of a hardware bus or port that your input device attaches to.

HID minidrivers can be built using one of the following frameworks:

  • UMDF – User Mode Driver Framework
  • KDMF – Kernel Mode Driver Framework
  • WDM – Legacy Windows Driver Model

Microsoft recommends using a Frameworks based solution (KMDF or UMDF (on Windows 8 only)). For more information on each of the driver models, please visit the following sections:

  • KMDF-based HID minidriver, see Creating Framework-based HID Minidrivers
  • UMDF-based HID minidriver, see Creating UMDF-based HID Minidrivers

The following section talks about registering a WDM based HID Minidriver but much of it is pertinent to a KMDF based Frameworks driver also. All HID minidriver must register with the HID class driver, and the HID class driver communicates with the minidriver by calling the minidriver's standard driver routines.

For more information about the functionality that a HID minidriver must support in its standard driver routines, see the following topics:

  • Registering a HID Minidriver
  • HID Minidriver Driver Extension
  • Using the HID_DEVICE_EXTENSION Structure
  • Standard Driver Routines Provided by a HID Minidriver

For more information about the HID class driver, see Operation of the HID Class Driver

Registering a HID minidriver

After a HID minidriver completes all other driver initialization in its DriverEntry routine, the HID minidriver binds its operation to the HID class driver by calling HidRegisterMinidriver.

When the HID minidriver registers with the HID class driver, it uses a HID_MINIDRIVER_REGISTRATION structure to specify the following: HID revision, the HID minidriver driver object, the size of a HID minidriver device extension, and whether devices are polled or not.

HID minidriver extension

A HID minidriver device extension is device-specific, and is only used by a HID minidriver. The HID class driver allocates the memory for the minidriver device extension when the class driver creates its device extension for a functional device object (FDO). The HID minidriver specifies the size of its device extension when it registers the minidriver with the HID class driver. The size is specified by the DeviceExtensionSize member of a HID_MINIDRIVER_REGISTRATION structure.

Using the HID_DEVICE_EXTENSION structure

A HID minidriver must use a HID_DEVICE_EXTENSION structure as the layout for the device extension created by the HID class driver for a functional device object (FDO). The HID class driver sets the members of this structure when it initializes the FDO. A HID minidriver must not change the information in this structure.

A HID_DEVICE_EXTENSION structure contains the following members:

  • PhysicalDeviceObject is a pointer to the physical device object (PDO) that represents the underlying input device.

  • NextDeviceObject is a pointer to the top of the device stack beneath the FDO.

  • MiniDeviceExtension is a pointer to the HID minidriver device extension.

Given a pointer to the FDO of an input device, the following GET_MINIDRIVER_DEVICE_EXTENSION macro returns a pointer to a HID minidriver extension:

PDEVICE_EXTENSION is a pointer to a device-specific device extension declared by a HID minidriver.

Similarly, a HID minidriver can obtain a pointer to the input device's PDO and the top of the device stack beneath the input device's FDO.

When a HID minidriver sends an IRP down the device stack, it should use NextDeviceObject as the target device object.

Standard minidriver routines

A HID minidriver must provide the following standard driver support routines:

  • HID Minidriver DriverEntry Routine
  • HID Minidriver AddDevice Routine
  • HID Minidriver Unload Routine

A HID minidriver must also support the dispatch routines described in Dispatch Routines Provided by a HID Minidriver.

DriverEntry routine

The DriverEntry routine in a HID minidriver does the following:

  • Creates a driver object for the linked pair of drivers (HID class driver and a HID minidriver).

  • Sets the required driver entry points in the HID minidriver driver object.

  • Calls HidRegisterMinidriver to register the HID minidriver with the HID class driver.

  • Does device-specific configurations that are only used by the HID minidriver.

AddDevice routine

The HID class driver handles creating and initializing the functional device object (FDO) for an underlying input device. The HID class driver also operates the FDO from the perspective of the upper-level interface to the underlying device and its child devices (HID collections).

The HID class driver AddDevice routine calls the HID minidriver AddDevice routine so that the minidriver can do internal device-specific initialization.

The parameters that are passed to the HID minidriver AddDevice routine are the minidriver driver object and the FDO. (Note that the HID class driver passes the FDO to the minidriver AddDevice routine, not to the physical device object for the underlying input device.)

The HID minidriver AddDevice routine obtains a pointer to the minidriver device extension from the FDO.

  • Typically, the HID minidriver AddDevice routine does the following:

  • Initializes the minidriver device extension. The device extension is only used by the minidriver.

  • Returns STATUS_SUCCESS. If the minidriver returns an error status, the HID class driver deletes the FDO and returns the error status to the Plug and Play manager.

Unload routine

The Unload routine of the HID class driver calls the HID minidriver Unload routine. A HID minidriver releases any internal resources allocated by the minidriver.

Dispatch routines

A HID minidriver must supply the following dispatch routines: create, close, internal device control, system control, Plug and Play, and power management. Except for internal device control requests, most of these dispatch routines provide minimal function. When the HID class driver calls these dispatch routines, it passes the minidriver driver object and the functional device object (FDO).

IRP_MJ_CREATE

In compliance with WDM requirements, the HID class driver and a HID minidriver provide a dispatch routine for create requests. However, the FDO cannot be opened. The HID class driver returns STATUS_UNSUCCESSFUL.

A HID minidriver only needs to provide a stub. The create dispatch routine is never called.

IRP_MJ_CLOSE

In compliance with WDM requirements, the HID class driver and a HID minidriver must provide a dispatch routine for close requests. However, the FDO cannot be opened. The HID class driver returns STATUS_INVALID_PARAMETER_1.

A HID minidriver only needs to provide a stub. The close dispatch routine is never called.

Gspy input devices driver touchpad

IRP_MJ_DEVICE_CONTROL

A HID minidriver does not need a dispatch routine for device control requests. The HID class driver does not pass device control requests to a minidriver.

IRP_MJ_INTERNAL_DEVICE_CONTROL

A HID minidriver must provide a dispatch routine for internal device control requests that supports the requests described in HID MinidriverIOCTLs.

The HID class driver primarily uses internal device control requests to access the underlying input device.

The HID minidriver handles these requests in a device-specific way.

IRP_MJ_SYSTEM_CONTROL

A HID minidriver must provide a dispatch routine for system control requests. However, a HID minidriver is only required to pass system control requests down the device stack as follows:

  • Skip the current IRP stack location

  • Send the request down the FDO's device stack

IRP_MJ_PNP

A HID minidriver must supply a dispatch routine for Plug and Play requests.

The HID class driver does all the Plug and Play processing associated with the FDO. When the HID class driver processes a Plug and Play request, it calls the HID minidriver Plug and Play dispatch routine.

A HID minidriver Plug and Play dispatch routine does the following:

Gspy Input Devices Driver Update

  • Handles sending the request down the FDO's device stack and completing the request on the way back up the device stack, as appropriate for each type of request.

  • Does device-specific processing associated with certain requests to update information about the state of the FDO.

    For example, the minidriver might update the Plug and Play state of the FDO (in particular, whether the FDO is started, stopped, or in the process of being removed).

IRP_MJ_POWER

The HID minidriver must supply a dispatch routine for power requests. However, the HID class driver handles the power processing for the FDO.

In compliance with WDM requirements, a HID minidriver sends power requests down the FDO's device stack in the following way:

  • Skips the current IRP stack location

  • Starts the next power IRP

  • Sends the power IRP down the FDO's device stack

Devices

Typically, the HID minidriver passes power requests down the device stack without additional processing.

1.1. The simplest example¶

Here comes a very simple example of an input device driver. The device hasjust one button and the button is accessible at i/o port BUTTON_PORT. Whenpressed or released a BUTTON_IRQ happens. The driver could look like:

1.2. What the example does¶

First it has to include the <linux/input.h> file, which interfaces to theinput subsystem. This provides all the definitions needed.

In the _init function, which is called either upon module load or whenbooting the kernel, it grabs the required resources (it should also checkfor the presence of the device).

Then it allocates a new input device structure with input_allocate_device()and sets up input bitfields. This way the device driver tells the otherparts of the input systems what it is - what events can be generated oraccepted by this input device. Our example device can only generate EV_KEYtype events, and from those only BTN_0 event code. Thus we only set thesetwo bits. We could have used:

as well, but with more than single bits the first approach tends to beshorter.

Then the example driver registers the input device structure by calling:

This adds the button_dev structure to linked lists of the input driver andcalls device handler modules _connect functions to tell them a new inputdevice has appeared. input_register_device() may sleep and therefore mustnot be called from an interrupt or with a spinlock held.

While in use, the only used function of the driver is:

which upon every interrupt from the button checks its state and reports itvia the:

call to the input system. There is no need to check whether the interruptroutine isn’t reporting two same value events (press, press for example) tothe input system, because the input_report_* functions check thatthemselves.

Then there is the:

call to tell those who receive the events that we’ve sent a complete report.This doesn’t seem important in the one button case, but is quite importantfor for example mouse movement, where you don’t want the X and Y valuesto be interpreted separately, because that’d result in a different movement.

1.3. dev->open() and dev->close()¶

In case the driver has to repeatedly poll the device, because it doesn’thave an interrupt coming from it and the polling is too expensive to be doneall the time, or if the device uses a valuable resource (eg. interrupt), itcan use the open and close callback to know when it can stop polling orrelease the interrupt and when it must resume polling or grab the interruptagain. To do that, we would add this to our example driver:

Note that input core keeps track of number of users for the device andmakes sure that dev->open() is called only when the first user connectsto the device and that dev->close() is called when the very last userdisconnects. Calls to both callbacks are serialized.

The open() callback should return a 0 in case of success or any nonzero valuein case of failure. The close() callback (which is void) must always succeed.

1.4. Basic event types¶

The most simple event type is EV_KEY, which is used for keys and buttons.It’s reported to the input system via:

See uapi/linux/input-event-codes.h for the allowable values of code (from 0 toKEY_MAX). Value is interpreted as a truth value, ie any nonzero value means keypressed, zero value means key released. The input code generates events onlyin case the value is different from before.

In addition to EV_KEY, there are two more basic event types: EV_REL andEV_ABS. They are used for relative and absolute values supplied by thedevice. A relative value may be for example a mouse movement in the X axis.The mouse reports it as a relative difference from the last position,because it doesn’t have any absolute coordinate system to work in. Absoluteevents are namely for joysticks and digitizers - devices that do work in anabsolute coordinate systems.

Having the device report EV_REL buttons is as simple as with EV_KEY, simplyset the corresponding bits and call the:

function. Events are generated only for nonzero value.

However EV_ABS requires a little special care. Before callinginput_register_device, you have to fill additional fields in the input_devstruct for each absolute axis your device has. If our button device had alsothe ABS_X axis:

Or, you can just say:

This setting would be appropriate for a joystick X axis, with the minimum of0, maximum of 255 (which the joystick must be able to reach, no problem ifit sometimes reports more, but it must be able to always reach the min andmax values), with noise in the data up to +- 4, and with a center flatposition of size 8.

If you don’t need absfuzz and absflat, you can set them to zero, which meanthat the thing is precise and always returns to exactly the center position(if it has any).

1.5. BITS_TO_LONGS(), BIT_WORD(), BIT_MASK()¶

These three macros from bitops.h help some bitfield computations:

1.6. The id* and name fields¶

The dev->name should be set before registering the input device by the inputdevice driver. It’s a string like ‘Generic button device’ containing auser friendly name of the device.

The id* fields contain the bus ID (PCI, USB, ...), vendor ID and device IDof the device. The bus IDs are defined in input.h. The vendor and device idsare defined in pci_ids.h, usb_ids.h and similar include files. These fieldsshould be set by the input device driver before registering it.

The idtype field can be used for specific information for the input devicedriver.

The id and name fields can be passed to userland via the evdev interface.

1.7. The keycode, keycodemax, keycodesize fields¶

Input Devices Of Computer

These three fields should be used by input devices that have dense keymaps.The keycode is an array used to map from scancodes to input system keycodes.The keycode max should contain the size of the array and keycodesize thesize of each entry in it (in bytes).

Gspy Input Devices Drivers

Userspace can query and alter current scancode to keycode mappings usingEVIOCGKEYCODE and EVIOCSKEYCODE ioctls on corresponding evdev interface.When a device has all 3 aforementioned fields filled in, the driver mayrely on kernel’s default implementation of setting and querying keycodemappings.

1.8. dev->getkeycode() and dev->setkeycode()¶

getkeycode() and setkeycode() callbacks allow drivers to override defaultkeycode/keycodesize/keycodemax mapping mechanism provided by input coreand implement sparse keycode maps.

1.9. Key autorepeat¶

... is simple. It is handled by the input.c module. Hardware autorepeat isnot used, because it’s not present in many devices and even where it ispresent, it is broken sometimes (at keyboards: Toshiba notebooks). To enableautorepeat for your device, just set EV_REP in dev->evbit. All will behandled by the input system.

Gspy Input Devices Driver Download

1.10. Other event types, handling output events¶

The other event types up to now are:

  • EV_LED - used for the keyboard LEDs.
  • EV_SND - used for keyboard beeps.

They are very similar to for example key events, but they go in the otherdirection - from the system to the input device driver. If your input devicedriver can handle these events, it has to set the respective bits in evbit,and also the callback routine:

Gspy Input Devices Driver Touchpad

Gspy input devices driver vga

This callback routine can be called from an interrupt or a BH (although thatisn’t a rule), and thus must not sleep, and must not take too long to finish.