HIDGAME

[This is preliminary documentation and subject to change.]

Summary

HidGame is the WDM/HID minidriver for analog joysticks. This driver registers with the HID class driver and responds to IRPs put out by HIDclass. It informs HID class about the capabilities of the joystick and polls the joystick in response to a read IOCTL.

This driver is loaded in reponse to a "New hardware Found" Plug and Play (PnP) event, and consequently must have an entry in an .inf file that binds a PnP hardware ID to this driver. Gameport joysticks are not true PnP devices, so the user (through the GameControllers Control Panel) informs the system about a joystick attached to the gameport. An example of how a new joystick type can be created is provided in the accompanying .inf file. Once a user selects a joystick and gameport, the GameControllers CPL sends an IOCTL to the gameport bus driver (GameEnum), specifying the number of Axis / Buttons and a PnPHardware ID for the joystick. The Gameport Bus informs PnP of a new device arrival. PnP searches the system for a match for the hardwareID and loads the appropriate driver.

BUILDING THE SAMPLE

Use standard Windows NT®/Windows® 2000 build tools. In the hidgame directory, type build. The build script will generate the driver Hidgame.sys

TOOLS

You can test your driver using the the following apps/tools.

  • Game Controllers Control panel from the Standard Control panel

  • Diquick.exe (from the IDW directory or the Microsoft DirectX SDK at Microsoft DirectX Resources)

  • Shipping Microsoft DirectX games

    RESOURCES

    Universal Serial Bus HID Usage Tables, Version 1.0, USB Implementers Forum.

    Microsoft DirectX Resources

    CODE TOUR

    File Manifest

    
    Files         Description
    Hidgame.htm     The documentation for this sample (this file)
    Sources         The generic file for building the code sample
    Makefile        Used as part of the build process
    OEMsetup.inf    The .inf file for installing the code sample
    HidGame.c       DriverEntry, CreateClose, AddDevice and Unload routines
    PnP.c           Support routines for PnP IOCTLs
    RemLock.c       Support routines to enhance checking for removal locking
    Ioctl.c         Support routines for Non PnP IOCTLs ( read/Device descriptor/Device Attributes, and so on)
    HidJoy.c        Support routines to configure the joystick
    Poll.c          Support routine for analog joystick polling
    i386\timing.c   Support routines to use x86 time stamp counter
    Hidgame.h       Common include file
    Debug.h         Definitions to aid debugging
    Analog.h        Definitions specific to analog joystick devices
    Hidgame.rtf     Autodoc doumentation for Hidgame
     

    Programming Tour

    This sample has embedded comments in the source code. The AutoDoc utility was used to generate the following AutoDoc comments RTF file from the source code.

    Top of page

    © 1999 Microsoft Corporation