Drivers Delux Input Devices



Input

The port and miniport drivers, which can be of type WaveCyclic or WavePci, bind together to form a wave filter that represents the capture device. This device typically captures an analog signal from a microphone or other audio source and converts it to a wave PCM stream. The device might also input a digital audio stream through an S/PDIF connector. For devices of type GUIDCLASSMOUSE, a device's function driver: Handles device-specific input. Creates the MOUSEINPUTDATA structures required by MouseClassServiceCallback. Transfers MOUSEINPUTDATA structures to the Mouclass data queue by calling MouseClassServiceCallback in its ISR dispatch completion routine.

Windows may install drivers for select devices, say the graphics card, under certain circumstances. This happens by default for instance when the device is setup, but may also happen when Microsoft pushes driver updates through Windows Updates.

-->

Non-HID keyboards and mice can connect over multiple legacy buses but still use the same class driver. This section contains details on the class drivers themselves. The following sections goes into details on the controllers.

This topic describes the typical physical configuration of keyboard and mouse devices in Microsoft Windows 2000 and later.

The following figures show two common configurations that employ a single keyboard and a single mouse.

The figure on the left shows a keyboard and a mouse connected to a system bus through independent controllers. A typical configuration consists of a PS/2-style keyboard operated through an i8042 controller, and a serial-style mouse operated through a serial port controller.

The following additional information is important for keyboard and mice manufactures:

  • Keyboards are opened in exclusive mode by the operating system stack for security reasons
  • Windows supports the simultaneous connection of more than one keyboard and mouse device.
  • Windows does not support independent access by a client to each device.

Class driver features

This topic describes the features of the following Microsoft Windows 2000 and later system class drivers:

  • Kbdclass, the class driver for devices of GUID_CLASS_KEYBOARD device class

  • Mouclass, the class driver for devices of GUID_CLASS_MOUSE device class

Kbdclass implements the Kbdclass service and its executable image is kbdclass.sys.

Mouclass implements the Mouclass service and its executable image is mouclass.sys.

Kbdclass and Mouclass each feature:

  • Generic and hardware-independent operation of the device class.

  • Plug and Play, power management, and Windows Management Instrumentation (WMI).

  • Operation of legacy devices.

  • Simultaneous operation of more than one device.

  • Connection of a class service callback routine that a function driver uses to transfer data from the input data buffer of the device to the data buffer of the class driver.

Configuration of device objects

The following figure shows the configuration of device objects for a Plug and Play PS/2-style keyboard and mouse device. Each class driver creates an upper-level class filter device object (filter DO) that is attached to a function device object (FDO) through an optional upper-level device filter DO. An upper-level device filter driver creates the upper-level device filter DO. I8042prt creates the function DO and attaches it to a physical device object (PDO) created by the root bus driver.

PS/2 Keyboard

The keyboard driver stack consists of the following.

  • Kbdclass, the upper-level keyboard class filter driver
  • One or more optional upper-level keyboard filter driver
  • I8042prt, the function driver

PS/2 Mouse

The mouse driver stack consists of the following.

  • Mouclass, the upper-level mouse class filter driver
  • One or more optional upper-level mouse filter driver
  • I8042prt, the function driver

Kbdclass and Mouclass can support more than one device in two different modes. In the one-to-one mode, each device has an independent device stack. The class driver creates and attaches an independent class DO to each device stack. Each device stack has its own control state and input buffer. The Microsoft Win32 subsystem accesses input from each device through a unique file object.

In the grandmaster mode, the class driver operates all the devices in the following way:

  • The class driver creates both a grandmaster class DO that represents all of the devices and a subordinate class DO for each device.

    The class driver attaches a subordinate class DO to each device stack. Below the subordinate class DO, the device stack is same as that created in the one-to-one mode.

  • The grandmaster class DO controls the operation of all the subordinate DOs.

  • The Win32 subsystem accesses all device input through the file object that represents the grandmaster class device.

  • All device input is buffered in the grandmaster's data queue.

  • The grandmaster maintains a single global device state.

Kbdclass and Mouclass operate in the one-to-one mode if their registry entry value ConnectMultiplePorts is set to 0x00 (under the key HKLMServicesCurrentControlSet<class service>Parameters, where class service is Kbdclass or Mouclass). Otherwise Kbdclass and Mouclass operate in grandmaster mode.

Open and close via the class driver

The Microsoft Win32 subsystem opens all keyboard and mouse devices for its exclusive use. For each device class, the Win32 subsystem treats input from all the devices as if the input came from a single input device. An application cannot request to receive input from only one particular device.

The Win32 subsystem dynamically opens Plug and Play input devices after it receives notification from the Plug and Play manager that a GUID_CLASS_KEYBOARD or GUID_CLASS_MOUSE device interface is enabled. The Win32 subsystem closes Plug and Play devices after it receives notification that an opened interface is disabled. The Win32 subsystem also opens legacy devices by name (for example, 'DeviceKeyboardLegacyClass0'). Note that once the Win32 subsystem successfully opens a legacy device, it cannot determine if the device is later physically removed.

After Kbdclass and Mouclass receive a create request they do the following for Plug and Play and legacy operation:

  • Plug and Play Operation

    If the device is in the Plug and Play started state, the class driver sends the IRP_MJ_CREATE request down the driver stack. Otherwise the class driver completes the request without sending the request down the driver stack. The class driver sets the trusted file that has read access to the device. If there is a grandmaster device, the class driver sends a create request to all the ports that are associated with the subordinate class devices.

  • Legacy Operation

    The class driver sends an internal device control request to the port driver to enable the device.

Connect a service callback to a device

The class drivers must connect their class service to a device before the device can be opened. The class drivers connect their class service after they attach a class DO to a device stack. The function driver uses the class service callback to transfer input data from a device to the class data queue for the device. The function driver's ISR dispatch completion routine for a device calls the class service callback. Kbdclass provides the class service callback KeyboardClassServiceCallback, and Mouclass provides the class service callback MouseClassServiceCallback.

A vendor can modify the operation of a class service callback by installing an upper-level filter driver for a device. The sample keyboard filter driver Kbfiltr defines the KbFilter_ServiceCallback callback, and the sample mouse filter driver Moufiltr defines the MouFilter_ServiceCallback callback. The sample filter service callbacks can be configured to modify the input data that is transferred from the port input buffer for a device to the class data queue. For example, the filter service callback can delete, transform, or insert data.

The class and filter service callbacks are connected in the following way:

  • The class driver sends an internal device connect request down the device stack (IOCTL_INTERNAL_KEYBOARD_CONNECT or IOCTL_INTERNAL_MOUSE_CONNECT). The class connect data is specified by a CONNECT_DATA structure that includes a pointer to the class device object, and a pointer to the class service callback.

  • After the filter driver receives the connect request, it saves a copy of the class connect data, and replaces the request's connect data with filter connect data. The filter connect data specifies a pointer to the filter device object and a pointer to the filter driver service callback. The filter driver then sends the filtered connect request to the function driver.

The class and filter service callbacks are called in the following way:

  • The function driver uses the filter connect data to make the initial callback to the filter service callback.

  • After filtering the input data, the filter service callback uses the class connect data that it saved to make a callback to the class service callback.

Query and set a keyboard device

I8042prt supports the following internal device control requests to query information about a keyboard device, and to set parameters on a keyboard device:

For more information about all keyboard device control requests, see Human Interface Devices Reference.

Scan code mapper for keyboards

In Microsoft Windows operating systems, PS/2-compatible scan codes provided by an input device are converted into virtual keys, which are propagated through the system in the form of Windows messages. If a device produces an incorrect scan code for a certain key, the wrong virtual key message will be sent. This can be fixed by writing a filter driver that analyzes the scan codes generated by firmware and modifies the incorrect scan code to one understood by the system. However, this is a tedious process and can sometimes lead to severe problems, if errors exist in the kernel-level filter driver.

Windows 2000 and Windows XP include a new Scan Code Mapper, which provides a method that allows for mapping of scan codes. The scan code mappings for Windows are stored in the following registry key:

Note There is also a Keyboard Layouts key (notice the plural form) under the Control key, but that key should not be modified.

In the Keyboard Layout key, the Scancode Map value must be added. This value is of type REG_BINARY (little Endian format) and has the data format specified in the following table.

Start offset (in bytes)Size (in bytes)Data
04Header: Version Information
44Header: Flags
84Header: Number of Mappings
124Individual Mapping
.........
Last 4 bytes4Null Terminator (0x00000000)

The first and second DWORDS store header information and should be set to all zeroes for the current version of the Scan Code Mapper. The third DWORD entry holds a count of the total number of mappings that follow, including the null terminating mapping. The minimum count would therefore be 1 (no mappings specified). The individual mappings follow the header. Each mapping is one DWORD in length and is divided into two WORD length fields. Each WORD field stores the scan code for a key to be mapped.

Once the map is stored in the registry, the system must be rebooted for the mappings to take effect. Note that if the mapping of a scan code is necessary on a keypress, the step is performed in user mode just before the scan code is converted to a virtual key. Doing this conversion in user mode can present certain limitations, such as mapping not working correctly when running under Terminal Services.

To remove these mappings, remove the Scancode Map registry value and reboot.

Example 1

The following presents an example. To swap the left CTRL key with the CAPS LOCK key, use a registry editor (preferably Regedt32.exe) to modify the Scancode Map key with the following value:

The following table contains these entries broken into DWORD fields and the bytes swapped.

Value: Interpretation

0x00000000: Header: Version. Set to all zeroes.

0x00000000: Header: Flags. Set to all zeroes.

0x00000003: Three entries in the map (including null entry).

0x001D003A: Left CTRL key --> CAPS LOCK (0x1D --> 0x3A).

0x003A001D: CAPS LOCK --> Left CTRL key (0x3A --> 0x1D).

0x00000000: Null terminator.

Example 2

It is also possible to add a key not generally available on a keyboard or to remove a key that is never used. The following example shows the value stored in Scancode Map to remove the right CTRL key and change the functionality of the right ALT key to work as a mute key:

The following table contains these entries broken into DWORD fields and the bytes swapped.

Value: Interpretation

0x00000000: Header: Version. Set to all zeroes.

0x00000000: Header: Flags. Set to all zeroes.

0x00000003: Three entries in the map (including null entry).

0xE01D0000: Remove the right CTRL key (0xE01D --> 0x00).

0xE038E020: Right ALT key --> Mute key (0xE038 --> 0xE020).

0x00000000: Null terminator.

After the necessary data is generated, it can be inserted into the registry in several ways.

  • A .reg file can be generated that can be easily incorporated into the system registry using a registry editor.
  • An .inf file can also be created with an [AddReg] section that contains the registry information to be added.
  • Regedt32.exe can be used to manually add the information to the registry.

The Scan Code Mapper has several advantages and disadvantages.

The advantages include:

  • The Mapper can be used as an easy fix to correct firmware errors.
  • Frequently used keys can be added to the keyboard by modifying the map in registry. Keys that aren't often used (for example, right CTRL key) can be mapped to null (removed) or exchanged for other keys.
  • Key locations can be altered easily. Users can easily customize the location of frequently used keys for their benefit.

The following disadvantages are recognized:

  • Once the map is stored in the registry, a system reboot is required to activate it.
  • The mappings stored in the registry work at system level and apply to all users. These mappings cannot be set to work differently depending on the current user.
  • The current implementation restricts the functionality of the map such that mappings always apply to all keyboards connected to the system. It is not currently possible to create a map on a per-keyboard basis.

Query a mouse device

I8042prt supports the following internal device control request to query information about a mouse device:

For more information about all mouse device control requests, see Human Interface Devices Reference.

Registry settings associated with mouse class driver

The following is a list of registry keys associated with the mouse class driver.

[Key: HKLMSYSTEMCurrentControlSetServicesMouclassParameters]

  • MaximumPortsServiced – Not used on Windows XP and later. Only for Windows NT4.
  • PointerDeviceBaseName – Specifies the base name for the device objects created by the mouse class device driver
  • ConnectMultiplePorts – Determines whether there is one or more than one port device object for each class device object. This entry is used primarily by device drivers.
  • MouseDataQueueSize - Specifies the number of mouse events buffered by the mouse driver. It also is used in calculating the size of the mouse driver's internal buffer in the nonpaged memory pool.

Absolute pointing devices

For devices of type GUID_CLASS_MOUSE, a device's function driver:

  • Handles device-specific input.

  • Creates the MOUSE_INPUT_DATA structures required by MouseClassServiceCallback.

  • Transfers MOUSE_INPUT_DATA structures to the Mouclass data queue by calling MouseClassServiceCallback in its ISR dispatch completion routine.

For an absolute pointing device, the device's function driver must set the LastX, LastY, and Flags members of the MOUSE_INPUT_DATA structures in the following way:

  • In addition to dividing the device input value by the maximum capability of the device, the driver scales the device input value by 0xFFFF:

  • The driver sets the MOUSE_MOVE_ABSOLUTE flag in Flags.

  • If the input should be mapped by Window Manager to an entire virtual desktop, the driver sets the MOUSE_VIRTUAL_DESKTOP flag in Flags. If the MOUSE_VIRTUAL_DESKTOP flag is not set, Window Manager maps the input to only the primary monitor.

The following specifies, by type of device, how these special requirements for an absolute pointing device are implemented:

  • HID devices:

    Mouhid, the Windows function driver for HID mouse devices, implements these special requirements automatically.

  • PS/2-style devices:

    An upper-level filter driver is required. The filter driver supplies an IsrHook callback and a class service callback. I8042prt calls the IsrHook to handle raw device input, and calls the filter class service callback to filter the input. The filter class service callback, in turn, calls MouseClassServiceCallback. The combination of the IsrHook callback and the class service callback handles device-specific input, creates the required MOUSE_INPUT_DATA structures, scales the device input data, and sets the MOUSE_MOVE_ABSOLUTE flag.

  • Plug and Play COM port devices that are enumerated by Serenum:

    A Plug and Play function driver is required. The function driver creates the required MOUSE_INPUT_DATA structures, scales the device input data, and sets the MOUSE_MOVE_ABSOLUTE flag before it calls MouseClassServiceCallback.

  • Non-Plug and Play COM port devices:

    A device-specific function driver is required. The function driver creates the required MOUSE_INPUT_DATA structures, scales the device input data, and sets the MOUSE_MOVE_ABSOLUTE flag before it calls MouseClassServiceCallback.

  • Device on an unsupported bus:

    A device-specific function driver is required. The function driver creates the required MOUSE_INPUT_DATA structures, scales the device input data, and sets the MOUSE_MOVE_ABSOLUTE flag before it calls MouseClassServiceCallback.

-->

In Windows 10 you can write a universal audio driver that will work across many types of hardware. This topics discusses the benefits of this approach as well as the differences between different platforms. In addition to the Universal Windows drivers for audio, Windows continues to support previous audio driver technologies, such as WDM.

Getting Started with Universal Windows drivers for Audio

IHVs can develop a Universal Windows driver that works on all devices (desktops, laptops, tablets, phones). This can reduces development time and cost for initial development and later code maintenance.

These tools are available to develop Universal Windows driver support:

  • Visual Studio 2015 Support: There is a driver setting to set “Target Platform” equal to “Universal”. For more information about setting up the driver development environment, see Getting Started with Universal Windows Drivers.

  • APIValidator Tool: You can use the ApiValidator.exe tool to verify that the APIs that your driver calls are valid for a Universal Windows driver. This tool is part of the Windows Driver Kit (WDK) for Windows 10, and runs automatically if you are using Visual Studio 2015 . For more information, see Validating Universal Windows Drivers.

  • Updated DDI reference documentation: The DDI reference documentation is being updated to indicate which DDIs are supported by Universal Windows drivers. For more information, see Audio Devices Reference.

Create a Universal Audio Driver

For step-by-step guidance, see Getting Started with Universal Windows Drivers. Here is a summary of the steps:

  1. Load the universal audio sysvad sample to use as starting point for your universal audio driver. Alternatively, start with the empty WDM driver template and add in code from the universal sysvad sample as needed for your audio driver.

  2. In the project properties, set Target Platform to 'Universal'.

  3. Create an installation package: If your target is device running Windows 10 for desktop editions (Home, Pro, Enterprise, and Education), use a configurable INF file. If your target is device running Windows 10 Mobile, use PkgGen to generate an .spkg file.

  4. Build, install, deploy, and debug the driver for Windows 10 for desktop editions or Windows 10 Mobile.

Sample Code

Sysvad and SwapAPO have been converted to be Universal Windows driver samples. For more information, see Sample Audio Drivers.

Available Programming Interfaces for Universal Windows drivers for Audio

Starting with Windows 10, the driver programming interfaces are part of OneCoreUAP-based editions of Windows. By using that common set, you can write a Universal Windows driver. Those drivers will run on both Windows 10 for desktop editions and Windows 10 Mobile, and other Windows 10 versions.

The following DDIs to are available when working with universal audio drivers.

Convert an Existing Audio Driver to a Universal Windows driver

Follow this process to convert an existing audio driver to a Universal Windows driver.

  1. Determine whether your existing driver calls will run on OneCoreUAP Windows. Check the requirements section of the reference pages. For more information see Audio Devices Reference.

  2. Recompile your driver as a Universal Windows driver. In the project properties, set Target Platform to 'Universal'.

  3. Use the ApiValidator.exe tool to verify that the DDIs that your driver calls are valid for a Universal Windows driver. This tool is part of the Windows Driver Kit (WDK) for Windows 10, and runs automatically if you are using Visual Studio 2015. For more information, see Validating Universal Windows Drivers.

  4. If the driver calls interfaces that are not part of OneCoreUAP, compiler displays errors.

  5. Replace those calls with alternate calls, or create a code workaround, or write a new driver.

Creating a componentized audio driver installation

Overview

To create a smoother and more reliable install experience and to better support component servicing, divide the driver installation process into the following components.

  • DSP (if present) and Codec
  • APO
  • OEM Customizations

Optionally, separate INF files can be used for the DSP and Codec.

This diagram summarizes a componentized audio installation.

A separate extension INF file is used to customize each base driver component for a particular system. Customizations include tuning parameters and other system-specific settings. For more information, seeUsing an Extension INF File.

An extension INF file must be a universal INF file. For more information, see Using a Universal INF File.

For information about adding software using INF files, see Using a Component INF File.

Submitting componentized INF files

APO INF packages must be submitted to the Partner Center separately from the base driver package. For more information about creating packages, see Windows HLK Getting Started.

SYSVAD componentized INF files

To see an example of componentized INF files examine the sysvad/TabletAudioSample, on Github.

File nameDescription
ComponentizedAudioSample.infThe base componentized sample audio INF file.
ComponentizedAudioSampleExtension.infThe extension driver for the sysvad base with additional OEM customizations.
ComponentizedApoSample.infAn APO sample extension INF file.

Drivers Deluxe Input Devices Free

The traditional INF files continue to be available in the SYSVAD sample.

File nameDescription
tabletaudiosample.infA desktop monolitic INF file that contains all of the information needed to install the driver.
Drivers Delux Input devices

APO vendor specific tuning parameters and feature configuration

All APO vendor system specific settings, parameters, and tuning values must be installed via an extension INF package. In many cases, this can be performed in a simple manner with the INF AddReg directive. In more complex cases, a tuning file can be used.

Drivers

Base driver packages must not depend on these customizations in order to function (although of course functionality may be reduced).

UWP Audio Settings APPs

To implement an end user UI, use a Hardware Support App (HSA) for a Windows Universal Audio driver. For more information, see Hardware Support App (HSA): Steps for Driver Developers.

Programmatically launching UWP Hardware Support Apps

To programmatically launch a UWP Hardware Support App, based on a driver event (for example, when a new audio device is connected), use the Windows Shell APIs. The Windows 10 Shell APIs support a method for launching UWP UI based on resource activation, or directly via IApplicationActivationManager. You can find more details on automated launching for UWP applications in Automate launching Windows 10 UWP apps.

APO and device driver vendor use of the AudioModules API

The Audio Modules API/DDI is designed to standardize the communication transport (but not the protocol) for commands passed between a UWP application or user-mode service to a kernel driver module or DSP processing block. Audio Modules requires a driver implementing the correct DDI to support module enumeration and communication. The commands are passed as binary and interpretation/definition is left up to the creator.

Audio Modules is not currently designed to facilitate direct communication between a UWP app and a SW APO running in the audio engine.

For more information about audio modules, see Implementing Audio Module Communication and Configure and query audio device modules.

APO HWID strings construction

APO Hardware IDs incorporate both standard information and vendor-defined strings.

They are constructed as follows:

Where:

  • v(4) is the 4-character identifier for the APO device vendor. This will be managed by Microsoft.
  • a(4) is the 4-character identifier for the APO, defined by the APO vendor.
  • n(4) is the 4-character PCI SIG-assigned identifier for the vendor of the subsystem for the parent device. This is typically the OEM identifier.
  • s(4) is the 4-character vendor-defined subsystem identifier for the parent device. This is typically the OEM product identifier.

Plug and Play INF version and date evaluation for driver update

The Windows Plug and Play system evaluates the date and the driver version to determine which drive to install when multiple drivers exist. For more information, see How Windows Ranks Drivers.

To allow the latest driver to be used, be sure and update the date and version, for each new version of the driver.

APO driver registry key

For third party-defined audio driver/APO registry keys, use HKR with the exception of HKLMSystemCurrentControlSet.

Use a Windows Service to facilitate UWP <-> APO communication

Drivers Deluxe Input Devices Cheat

A Windows Service is not strictly required for management of user-mode components like APOs, however, if your design includes an RPC server to facilitate UWP <-> APO communication, we recommend implementing that functionality in a Windows Service that then controls the APO running in the audio engine.

Building the Sysvad Universal Audio Sample for Windows 10 Desktop

Complete the following steps to build the sysvad sample for Windows 10 desktop.

Drivers Delux Input Devices Adapter

  1. Locate the desktop inf file (tabletaudiosample.inf) and set the manufacturer name to a value such as 'Contoso'

  2. In Solution Explorer, select and hold (or right-click) Solution 'sysvad' , and choose Configuration Manager. If you are deploying to a 64 bit version of Windows, set the target platform to x64. Make sure that the configuration and platform settings are the same for all of the projects.

  3. Build the all of the projects in the sysvad solution.

  4. Locate the output directory for the build from the build. For example it could be located in a directory like this:

  5. Navigate to the Tools folder in your WDK installation and locate the PnpUtil tool. For example, look in the following folder: C:Program Files (x86)Windows Kits10Toolsx64PnpUtil.exe .

  6. Copy the following files to the system that you want to install the sysvad driver:

FileDescription
TabletAudioSample.sysThe driver file.
tabletaudiosample.infAn information (INF) file that contains information needed to install the driver.
sysvad.catThe catalog file.
SwapAPO.dllA sample driver extension for a UI to manage APOs.
PropPageExt.dllA sample driver extension for a property page.
KeywordDetectorAdapter.dllA sample keyword detector.

Drivers Delux Input Devices Device

Install and test the driver

Drivers Deluxe Input Devices Download

Follow these steps to install the driver using the PnpUtil on the target system.

Input Devices Of Computer

  1. Open and Administrator command prompt and type the following in the directory that you copied the driver files to.

    pnputil -i -a tabletaudiosample.inf

  2. The sysvad driver install should complete. If there are any errors you can examine this file for additional information: %windir%infsetupapi.dev.log

  3. In Device Manager, on the View menu, choose Devices by type. In the device tree, locate Microsoft Virtual Audio Device (WDM) - Sysvad Sample. This is typically under the Sound, video and game controllers node.

  4. On the target computer, open Control Panel and navigate to Hardware and Sound > Manage audio devices. In the Sound dialog box, select the speaker icon labeled as Microsoft Virtual Audio Device (WDM) - Sysvad Sample, then select Set Default, but do not select OK. This will keep the Sound dialog box open.

  5. Locate an MP3 or other audio file on the target computer and double-click to play it. Then in the Sound dialog box, verify that there is activity in the volume level indicator associated with the Microsoft Virtual Audio Device (WDM) - Sysvad Sample driver.





Comments are closed.