Drivers Interson USB Devices
2021年3月4日Download here: http://gg.gg/ojbs5
-->
*Kinds Of Usb Devices
*Examples Of Usb Devices
Universal Serial Bus (USB) provides an expandable, hot-pluggable Plug and Play serial interface that ensures a standard, low-cost connection for peripheral devices such as keyboards, mice, joysticks, printers, scanners, storage devices, modems, and video conferencing cameras. Migration to USB is recommended for all peripheral devices that use legacy ports such as PS/2, serial, and parallel ports.
The USB-IF is a Special Interest Groups (SIGs) that maintains the Official USB Specification, test specifications and tools.
Windows operating systems include native support for USB host controllers, hubs, and devices and systems that comply with the official USB specification. Windows also provides programming interfaces that you can use to develop device drivers and applications that communicate with a USB device.USB in WindowsWindows 10: What’s new for USB
Overview of new features and improvements in USB in Windows 10.USB FAQ
Frequently asked questions from driver developers about the USB stack and features that are supported in USB.Microsoft OS Descriptors for USB Devices
Windows defines MS OS descriptors that allows better enumeration when connected to system running Windows operating systemMicrosoft-provided USB driversUSB device-side drivers in Windows
A set of drivers for handling common function logic for USB devices.USB host-side drivers in Windows
Microsoft provides a core stack of drivers that interoperate with devices that are connected to EHCI and xHCI controllers.USB-IF device class drivers
Windows provides in-box device class drivers for many USB-IF approved device classes, audio, mass storage, and so on.USB generic function driver–WinUSB
Windows provides Winusb.sys that can be loaded as a function driver for a custom device and a function of a composite device.USB generic parent driver for composite devices–Usbccgp
Parent driver for USB devices with multiple functions. Usbccgp creates physical device objects (PDOs) for each of those functions. Those individual PDOs are managed by their respective USB function drivers, which could be the Winusb.sys driver or a USB device class driver.WDF extension for developing USB drivers
*USB connector manager class extension (UcmCx) reference
*USB host controller (UCX) reference
*USB function class extension (UFX) reference Testing USB devices with Windows
Get information about the tools that you can use to test your USB hardware or software, capture traces of operations and other system events, and observe how the USB driver stack responds to a request sent by a client driver or an application.
Read an overview of tests in the Hardware Certification Kit that enable hardware vendors and device manufacturers to prepare their USB devices and host controllers for Windows Hardware Certification submission.
Other Resources for USBOfficial USB Specification
Provides complete technical details for the USB protocol.Microsoft Windows USB Core Team Blog
Check out posts written by the Microsoft USB Team. The blog focuses on the Windows USB driver stack that works with various USB Host controllers and USB hubs found in Windows PC. A useful resource for USB client driver developers and USB hardware designers understand the driver stack implementation, resolve common issues, and explain how to use tools for gathering traces and log files.OSR Online Lists - ntdev
Discussion list managed by OSR Online for kernel-mode driver developers.Windows Dev-Center for Hardware Development
Miscellaneous resources based on frequently asked questions from developers who are new to developing USB devices and drivers that work with Windows operating systems.
USB-related videosUWP apps for USB devicesUnderstanding USB 3.0 in Windows 8Building great USB 3.0 devicesUSB Debugging Innovations in Windows 8 (Part I, II, & III)
USB hardware for learningMUTT devices
MUTT and SuperMUTT devices and the accompanying software package are integrated into the HCK suite of USB tests. They provide automated testing that can be used during the development cycle of USB controllers, devices and systems, especially stress testing.OSR USB FX2 Learning Kit
If you are new to USB driver development. The kit is the most suitable to study USB samples included in this documentation set. You can get the learning kit from OSR Online Store.Write a USB client driver (KMDF, UMDF)
Introduces you to USB driver development. Provides information about choosing the most appropriate model for providing a USB driver for your device. This section also includes tutorials about writing your first user-mode and kernel-mode USB drivers by using the USB templates included with Microsoft Visual Studio.Write a USB host controller driver
If you are developing an xHCI host controller that is not compliant with the specification or developing a custom non-xHCI hardware (such as a virtual host controller), you can write a host controller driver that communicates with UCX. For example, consider a wireless dock that supports USB devices. The PC communicates with USB devices through the wireless dock by using USB over TCP as a transport.
*USB host controller (UCX) reference Write a function controller driver for a USB device
You can develop a controller driver that handles all USB data transfers and commands sent by the host to the device. This driver communicates with the Microsoft-provided USB function controller extension (UFX).
USB function class extension (UFX) reference Write a USB Type-C connector driver
Windows 10 introduces support for the new USB connector: USB Type-C. You can write a driver for the connector that communicates with the Microsoft-provided class extension module: UcmCx to handle scenarios related to Type-C connectors such as, which ports support Type-C, which ports support power delivery.
USB connector manager class extension (UcmCx) reference Write a USB dual-role controller driver
USB Dual Role controllers are now supported in Windows 10. Windows includes in-box client drivers for ChipIdea and Synopsys controllers. For other controllers, Microsoft provides a set of programming interfaces that allow the dual-role class extension (UrsCx) and its client driver to communicate with each other to handle the role-switching capability of a dual-role controller.
For more information about this feature, see:
USB dual-role controller driver programming reference Write a USB driver for emulated devices
Windows 10 introduces support for emulated devices. Now you can develop an emulated Universal Serial Bus (USB) host controller driver and a connected virtual USB device. Both components are combined into a single KMDF driver that communicates with the Microsoft-provided USB device emulation class extension (UdeCx).
Emulated USB host controller driver programming reference Write a UWP app
Provides step-by-step instructions about implementing USB features in a UWP app. To write such an app for a USB device you need Visual Studio and Microsoft Windows Software Development Kit (SDK) .Write a Windows desktop app
Describes how an application can call WinUSB Functions to communicate with a USB device.
WinUSB functions Common programming scenarios
List of common tasks that a driver or an app performs in order to communicate with a USB device. Get quick info about the programming interfaces you need for each task.
USB samples
Development toolsDownload kits and tools for Windows
This package supports the following driver models USB Mass Storage Device from Gateway. Full Specifications. What’s new in version 6.0.6000.20062. Date Added November 10, 2008. We have used a number of ultrasound systems before we invested in Interson’s USB ultrasound system. Our staff has placed over 10,000 PICC lines using only one IV device per procedure. The USB ultrasound system has helped us continue our 100% success rate. The Universal Serial Bus Logo. USB, short for Universal Serial Bus, is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocols used in a bus for connection, communication, and power supply between computers and electronic devices. It is currently developed by the USB Implementers Forum. Motorola Device Manager contains USB drivers and software to connect your Motorola phone or tablet to your computer using a USB cable.-->
In this topic you’ll use the USB User-Mode Driver template provided with Microsoft Visual Studio 2019 to write a user-mode driver framework (UMDF)-based client driver. After building and installing the client driver, you’ll view the client driver in Device Manager and view the driver output in a debugger.
UMDF (referred to as the framework in this topic) is based on the component object model (COM). Every framework object must implement IUnknown and its methods, QueryInterface, AddRef, and Release, by default. The AddRef and Release methods manage the object’s lifetime, so the client driver does not need to maintain the reference count. The QueryInterface method enables the client driver to get interface pointers to other framework objects in the Windows Driver Frameworks (WDF) object model. Framework objects perform complicated driver tasks and interact with Windows. Certain framework objects expose interfaces that enable a client driver to interact with the framework.
A UMDF-based client driver is implemented as an in-process COM server (DLL), and C++ is the preferred language for writing a client driver for a USB device. Typically, the client driver implements several interfaces exposed by the framework. This topic refers to a client driver-defined class that implements framework interfaces as a callback class. After these classes are instantiated, the resulting callback objects are partnered with particular framework objects. This partnership gives the client driver the opportunity to respond to device or system-related events that are reported by the framework. Whenever Windows notifies the framework about certain events, the framework invokes the client driver’s callback, if one is available. Otherwise the framework proceeds with the default processing of the event. The template code defines driver, device, and queue callback classes.
For an explanation about the source code generated by the template, see Understanding the UMDF template code for USB client driver.Prerequisites
For developing, debugging, and installing a user-mode driver, you need two computers:
*A host computer running Windows 7 or a later version of the Windows operating system. The host computer is your development environment, where you write and debug your driver.
*A target computer running the version of the operating system that you want to test your driver on, for example, Windows 10, version 1903. The target computer has the user-mode driver that you want to debug and one of the debuggers.
In some cases, where the host and target computers are running the same version of Windows, you can have just one computer running Windows 7 or a later version of the Windows. This topic assumes that you are using two computers for developing, debugging, and installing your user mode driver.
Before you begin, make sure that you meet the following requirements:Software requirements
*
Your host computer has Visual Studio 2019.
*
Your host computer has the latest Windows Driver Kit (WDK) for Windows 10, version 1903.
The kit include headers, libraries, tools, documentation, and the debugging tools required to develop, build, and debug a USB client driver. You can get the latest version of the WDK from How to Get the WDK.
*
Your host computer has the latest version of debugging tools for Windows. You can get the latest version from the WDK or you can Download and Install Debugging Tools for Windows.
*
If you are using two computers, you must configure the host and target computers for user-mode debugging. For more information, see Setting Up User-Mode Debugging in Visual Studio.Hardware requirements
Get a USB device for which you will be writing the client driver. In most cases, you are provided with a USB device and its hardware specification. The specification describes device capabilities and the supported vendor commands. Use the specification to determine the functionality of the USB driver and the related design decisions.
If you are new to USB driver development, use the OSR USB FX2 learning kit to study USB samples included with the WDK. It contains the USB FX2 device and all the required hardware specifications to implement a client driver.Recommended reading
*Developing Drivers with Windows Driver Foundation, written by Penny Orwick and Guy Smith. For more information, see Developing Drivers with WDF.InstructionsStep 1: Generate the UMDF driver code by using the Visual Studio 2019 USB driver template
For instructions about generating UMDF driver code, see Writing a UMDF driver based on a template.For USB-specific code, select the following options in Visual Studio 2019
*In the New Project dialog box, in the search box at the top, type USB.
*n the middle pane, select User Mode Driver, USB (UMDF V2).
*lick Next.
*Enter a project name, choose a save location, and click Create.
The following screen shots show the New Project dialog box for the USB User-Mode Driver template.
This topic assumes that the name of the project is ’MyUSBDriver_UMDF_’. It contains the following files:FilesDescriptionDriver.h; Driver.cDeclares and defines a callback class that implements the IDriverEntry interface. The class defines methods that are invoked by the framework driver object. The main purpose of this class is to create a device object for the client driver.Device.h; Device.cDeclares and defines a callback class that implements the IPnpCallbackHardware interface. The class defines methods that are invoked by the framework device object. The main purpose of this class is to handle events occurring as a result of Plug and Play (PnP) state changes. The class also allocates and initializes resources required by the client driver as long as it is loaded in the system.IoQueue.h; IoQueue.cDeclares and defines a callback class that implements the IQueueCallbackDeviceIoControl interface. The class defines methods that are invoked by the framework queue object. The purpose of this class is to retrieve I/O requests that are queued in the framework.Internal.hProvides common declarations shared by the client driver and user applications that communicate with the USB device. It also declares tracing functions and macros.Dllsup.cppContains the implementation of the driver module’s entry point.<Project name>.infINF file that is required to install the client driver on the target computer.Exports.defDEF file that exports the entry point function name of the driver module.Step 2: Modify the INF file to add information about your device
Before you build the driver, you must modify the template INF file with information about your device, specifically the hardware ID string.To provide the hardware ID string
*
Attach your USB device to your host computer and let Windows enumerate the device.
*
Open Device Manager and open properties for your device.
*
On the Details tab, select Hardward Ids under Property.
The hardware ID for the device is displayed in the list box. Select and hold (or right-click) and copy the hardware ID string.
*
In Solution Explorer, expand Driver Files, and open the INF.
*
Replace the following your hardware ID string.
[Standard.NT$ARCH$]
%DeviceName%=MyDevice_Install, USBVID_vvvv&PID_pppp
Notice the AddReg entries in the driver’s information (INF) file.
[CoInstallers_AddReg] ;
HKR,CoInstallers32,0x00010008,’WudfCoinstaller.dll’
HKR,CoInstallers32,0x00010008,’WudfUpdate_01011.dll’
HKR,CoInstallers32,0x00010008,’WdfCoInstaller01011.dll,WdfCoInstaller’
HKR,CoInstallers32,0x00010008,’WinUsbCoinstaller2.dll’
*WudfCoinstaller.dll (configuration co-installer)
*WUDFUpdate_<version>.dll (redistributable co-installer)
*Wdfcoinstaller<version>.dll (co-installers for KMDF)
*Winusbcoinstaller2.dll ((co-installers for Winusb.sys)
*MyUSBDriver_UMDF_.dll (client driver module)
If your INF AddReg directive references the UMDF redistributable co-installer (WUDFUpdate_<version>.dll ), you must not make a reference to the configuration co-installer (WUDFCoInstaller.dll). Referencing both co-installers in the INF will lead to installation errors.
All UMDF-based USB client drivers require two Microsoft-provided drivers: the reflector and WinUSB.
*
Reflector—If your driver gets loaded successfully, the reflector is loaded as the top-most driver in the kernel-mode stack. The reflector must be the top driver in the kernel mode stack. To meet this requirement, the template’s INF file specifies the reflector as a service and WinUSB as a lower-filter driver in the INF:
[MyDevice_Install.NT.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.
*
WinUSB—The installation package must contain coinstallers for Winusb.sys because for the client driver, WinUSB is the gateway to the kernel-mode USB driver stack. Another component that gets loaded is a user-mode DLL, named WinUsb.dll, in the client driver’s host process (Wudfhost.exe). Winusb.dll exposes WinUSB Functions that simplify the communication process between the client driver and WinUSB.Step 3: Build the USB client driver code
To build your driver
*Open the driver project or solution in Visual Studio 2019.
*Right-click the solution in the Solution Explorer and select Configuration Manager.
*From the Configuration Manager, select your Active Solution Configuration (for example, Debug or Release) and your Active Solution Platform (for example, Win32) that correspond to the type of build you are interested in.
*Verify that your device interface GUID is accurate throughout the project.
*The device interface GUID is defined in Trace.h and is referenced from MyUSBDriverUMDFCreateDevice in Device.c. When you create your project with the name ’MyUSBDriver_UMDF_’, Visual Studio 2019 defines the device interface GUID with the name GUID_DEVINTERFACE_MyUSBDriver_UMDF_ but calls WdfDeviceCreateDeviceInterface with the incorrect parameter ’GUID_DEVINTERFACE_MyUSBDriverUMDF’. Replace the incorrect parameter with the name defined in Trace.h to ensure that the driver builds properly.
*From the Build menu, click Build Solution.
For more information, see Building a Driver.Step 4: Configure a computer for testing and debugging
To test and debug a driver, you run the debugger on the host computer and the driver on the target computer. So far, you have used Visual Studio on the host computer to build a driver. Next you need to configure a target computer. To configure a target computer, follow the instructions in Provision a computer for driver
https://diarynote.indered.space
-->
*Kinds Of Usb Devices
*Examples Of Usb Devices
Universal Serial Bus (USB) provides an expandable, hot-pluggable Plug and Play serial interface that ensures a standard, low-cost connection for peripheral devices such as keyboards, mice, joysticks, printers, scanners, storage devices, modems, and video conferencing cameras. Migration to USB is recommended for all peripheral devices that use legacy ports such as PS/2, serial, and parallel ports.
The USB-IF is a Special Interest Groups (SIGs) that maintains the Official USB Specification, test specifications and tools.
Windows operating systems include native support for USB host controllers, hubs, and devices and systems that comply with the official USB specification. Windows also provides programming interfaces that you can use to develop device drivers and applications that communicate with a USB device.USB in WindowsWindows 10: What’s new for USB
Overview of new features and improvements in USB in Windows 10.USB FAQ
Frequently asked questions from driver developers about the USB stack and features that are supported in USB.Microsoft OS Descriptors for USB Devices
Windows defines MS OS descriptors that allows better enumeration when connected to system running Windows operating systemMicrosoft-provided USB driversUSB device-side drivers in Windows
A set of drivers for handling common function logic for USB devices.USB host-side drivers in Windows
Microsoft provides a core stack of drivers that interoperate with devices that are connected to EHCI and xHCI controllers.USB-IF device class drivers
Windows provides in-box device class drivers for many USB-IF approved device classes, audio, mass storage, and so on.USB generic function driver–WinUSB
Windows provides Winusb.sys that can be loaded as a function driver for a custom device and a function of a composite device.USB generic parent driver for composite devices–Usbccgp
Parent driver for USB devices with multiple functions. Usbccgp creates physical device objects (PDOs) for each of those functions. Those individual PDOs are managed by their respective USB function drivers, which could be the Winusb.sys driver or a USB device class driver.WDF extension for developing USB drivers
*USB connector manager class extension (UcmCx) reference
*USB host controller (UCX) reference
*USB function class extension (UFX) reference Testing USB devices with Windows
Get information about the tools that you can use to test your USB hardware or software, capture traces of operations and other system events, and observe how the USB driver stack responds to a request sent by a client driver or an application.
Read an overview of tests in the Hardware Certification Kit that enable hardware vendors and device manufacturers to prepare their USB devices and host controllers for Windows Hardware Certification submission.
Other Resources for USBOfficial USB Specification
Provides complete technical details for the USB protocol.Microsoft Windows USB Core Team Blog
Check out posts written by the Microsoft USB Team. The blog focuses on the Windows USB driver stack that works with various USB Host controllers and USB hubs found in Windows PC. A useful resource for USB client driver developers and USB hardware designers understand the driver stack implementation, resolve common issues, and explain how to use tools for gathering traces and log files.OSR Online Lists - ntdev
Discussion list managed by OSR Online for kernel-mode driver developers.Windows Dev-Center for Hardware Development
Miscellaneous resources based on frequently asked questions from developers who are new to developing USB devices and drivers that work with Windows operating systems.
USB-related videosUWP apps for USB devicesUnderstanding USB 3.0 in Windows 8Building great USB 3.0 devicesUSB Debugging Innovations in Windows 8 (Part I, II, & III)
USB hardware for learningMUTT devices
MUTT and SuperMUTT devices and the accompanying software package are integrated into the HCK suite of USB tests. They provide automated testing that can be used during the development cycle of USB controllers, devices and systems, especially stress testing.OSR USB FX2 Learning Kit
If you are new to USB driver development. The kit is the most suitable to study USB samples included in this documentation set. You can get the learning kit from OSR Online Store.Write a USB client driver (KMDF, UMDF)
Introduces you to USB driver development. Provides information about choosing the most appropriate model for providing a USB driver for your device. This section also includes tutorials about writing your first user-mode and kernel-mode USB drivers by using the USB templates included with Microsoft Visual Studio.Write a USB host controller driver
If you are developing an xHCI host controller that is not compliant with the specification or developing a custom non-xHCI hardware (such as a virtual host controller), you can write a host controller driver that communicates with UCX. For example, consider a wireless dock that supports USB devices. The PC communicates with USB devices through the wireless dock by using USB over TCP as a transport.
*USB host controller (UCX) reference Write a function controller driver for a USB device
You can develop a controller driver that handles all USB data transfers and commands sent by the host to the device. This driver communicates with the Microsoft-provided USB function controller extension (UFX).
USB function class extension (UFX) reference Write a USB Type-C connector driver
Windows 10 introduces support for the new USB connector: USB Type-C. You can write a driver for the connector that communicates with the Microsoft-provided class extension module: UcmCx to handle scenarios related to Type-C connectors such as, which ports support Type-C, which ports support power delivery.
USB connector manager class extension (UcmCx) reference Write a USB dual-role controller driver
USB Dual Role controllers are now supported in Windows 10. Windows includes in-box client drivers for ChipIdea and Synopsys controllers. For other controllers, Microsoft provides a set of programming interfaces that allow the dual-role class extension (UrsCx) and its client driver to communicate with each other to handle the role-switching capability of a dual-role controller.
For more information about this feature, see:
USB dual-role controller driver programming reference Write a USB driver for emulated devices
Windows 10 introduces support for emulated devices. Now you can develop an emulated Universal Serial Bus (USB) host controller driver and a connected virtual USB device. Both components are combined into a single KMDF driver that communicates with the Microsoft-provided USB device emulation class extension (UdeCx).
Emulated USB host controller driver programming reference Write a UWP app
Provides step-by-step instructions about implementing USB features in a UWP app. To write such an app for a USB device you need Visual Studio and Microsoft Windows Software Development Kit (SDK) .Write a Windows desktop app
Describes how an application can call WinUSB Functions to communicate with a USB device.
WinUSB functions Common programming scenarios
List of common tasks that a driver or an app performs in order to communicate with a USB device. Get quick info about the programming interfaces you need for each task.
USB samples
Development toolsDownload kits and tools for Windows
This package supports the following driver models USB Mass Storage Device from Gateway. Full Specifications. What’s new in version 6.0.6000.20062. Date Added November 10, 2008. We have used a number of ultrasound systems before we invested in Interson’s USB ultrasound system. Our staff has placed over 10,000 PICC lines using only one IV device per procedure. The USB ultrasound system has helped us continue our 100% success rate. The Universal Serial Bus Logo. USB, short for Universal Serial Bus, is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocols used in a bus for connection, communication, and power supply between computers and electronic devices. It is currently developed by the USB Implementers Forum. Motorola Device Manager contains USB drivers and software to connect your Motorola phone or tablet to your computer using a USB cable.-->
In this topic you’ll use the USB User-Mode Driver template provided with Microsoft Visual Studio 2019 to write a user-mode driver framework (UMDF)-based client driver. After building and installing the client driver, you’ll view the client driver in Device Manager and view the driver output in a debugger.
UMDF (referred to as the framework in this topic) is based on the component object model (COM). Every framework object must implement IUnknown and its methods, QueryInterface, AddRef, and Release, by default. The AddRef and Release methods manage the object’s lifetime, so the client driver does not need to maintain the reference count. The QueryInterface method enables the client driver to get interface pointers to other framework objects in the Windows Driver Frameworks (WDF) object model. Framework objects perform complicated driver tasks and interact with Windows. Certain framework objects expose interfaces that enable a client driver to interact with the framework.
A UMDF-based client driver is implemented as an in-process COM server (DLL), and C++ is the preferred language for writing a client driver for a USB device. Typically, the client driver implements several interfaces exposed by the framework. This topic refers to a client driver-defined class that implements framework interfaces as a callback class. After these classes are instantiated, the resulting callback objects are partnered with particular framework objects. This partnership gives the client driver the opportunity to respond to device or system-related events that are reported by the framework. Whenever Windows notifies the framework about certain events, the framework invokes the client driver’s callback, if one is available. Otherwise the framework proceeds with the default processing of the event. The template code defines driver, device, and queue callback classes.
For an explanation about the source code generated by the template, see Understanding the UMDF template code for USB client driver.Prerequisites
For developing, debugging, and installing a user-mode driver, you need two computers:
*A host computer running Windows 7 or a later version of the Windows operating system. The host computer is your development environment, where you write and debug your driver.
*A target computer running the version of the operating system that you want to test your driver on, for example, Windows 10, version 1903. The target computer has the user-mode driver that you want to debug and one of the debuggers.
In some cases, where the host and target computers are running the same version of Windows, you can have just one computer running Windows 7 or a later version of the Windows. This topic assumes that you are using two computers for developing, debugging, and installing your user mode driver.
Before you begin, make sure that you meet the following requirements:Software requirements
*
Your host computer has Visual Studio 2019.
*
Your host computer has the latest Windows Driver Kit (WDK) for Windows 10, version 1903.
The kit include headers, libraries, tools, documentation, and the debugging tools required to develop, build, and debug a USB client driver. You can get the latest version of the WDK from How to Get the WDK.
*
Your host computer has the latest version of debugging tools for Windows. You can get the latest version from the WDK or you can Download and Install Debugging Tools for Windows.
*
If you are using two computers, you must configure the host and target computers for user-mode debugging. For more information, see Setting Up User-Mode Debugging in Visual Studio.Hardware requirements
Get a USB device for which you will be writing the client driver. In most cases, you are provided with a USB device and its hardware specification. The specification describes device capabilities and the supported vendor commands. Use the specification to determine the functionality of the USB driver and the related design decisions.
If you are new to USB driver development, use the OSR USB FX2 learning kit to study USB samples included with the WDK. It contains the USB FX2 device and all the required hardware specifications to implement a client driver.Recommended reading
*Developing Drivers with Windows Driver Foundation, written by Penny Orwick and Guy Smith. For more information, see Developing Drivers with WDF.InstructionsStep 1: Generate the UMDF driver code by using the Visual Studio 2019 USB driver template
For instructions about generating UMDF driver code, see Writing a UMDF driver based on a template.For USB-specific code, select the following options in Visual Studio 2019
*In the New Project dialog box, in the search box at the top, type USB.
*n the middle pane, select User Mode Driver, USB (UMDF V2).
*lick Next.
*Enter a project name, choose a save location, and click Create.
The following screen shots show the New Project dialog box for the USB User-Mode Driver template.
This topic assumes that the name of the project is ’MyUSBDriver_UMDF_’. It contains the following files:FilesDescriptionDriver.h; Driver.cDeclares and defines a callback class that implements the IDriverEntry interface. The class defines methods that are invoked by the framework driver object. The main purpose of this class is to create a device object for the client driver.Device.h; Device.cDeclares and defines a callback class that implements the IPnpCallbackHardware interface. The class defines methods that are invoked by the framework device object. The main purpose of this class is to handle events occurring as a result of Plug and Play (PnP) state changes. The class also allocates and initializes resources required by the client driver as long as it is loaded in the system.IoQueue.h; IoQueue.cDeclares and defines a callback class that implements the IQueueCallbackDeviceIoControl interface. The class defines methods that are invoked by the framework queue object. The purpose of this class is to retrieve I/O requests that are queued in the framework.Internal.hProvides common declarations shared by the client driver and user applications that communicate with the USB device. It also declares tracing functions and macros.Dllsup.cppContains the implementation of the driver module’s entry point.<Project name>.infINF file that is required to install the client driver on the target computer.Exports.defDEF file that exports the entry point function name of the driver module.Step 2: Modify the INF file to add information about your device
Before you build the driver, you must modify the template INF file with information about your device, specifically the hardware ID string.To provide the hardware ID string
*
Attach your USB device to your host computer and let Windows enumerate the device.
*
Open Device Manager and open properties for your device.
*
On the Details tab, select Hardward Ids under Property.
The hardware ID for the device is displayed in the list box. Select and hold (or right-click) and copy the hardware ID string.
*
In Solution Explorer, expand Driver Files, and open the INF.
*
Replace the following your hardware ID string.
[Standard.NT$ARCH$]
%DeviceName%=MyDevice_Install, USBVID_vvvv&PID_pppp
Notice the AddReg entries in the driver’s information (INF) file.
[CoInstallers_AddReg] ;
HKR,CoInstallers32,0x00010008,’WudfCoinstaller.dll’
HKR,CoInstallers32,0x00010008,’WudfUpdate_01011.dll’
HKR,CoInstallers32,0x00010008,’WdfCoInstaller01011.dll,WdfCoInstaller’
HKR,CoInstallers32,0x00010008,’WinUsbCoinstaller2.dll’
*WudfCoinstaller.dll (configuration co-installer)
*WUDFUpdate_<version>.dll (redistributable co-installer)
*Wdfcoinstaller<version>.dll (co-installers for KMDF)
*Winusbcoinstaller2.dll ((co-installers for Winusb.sys)
*MyUSBDriver_UMDF_.dll (client driver module)
If your INF AddReg directive references the UMDF redistributable co-installer (WUDFUpdate_<version>.dll ), you must not make a reference to the configuration co-installer (WUDFCoInstaller.dll). Referencing both co-installers in the INF will lead to installation errors.
All UMDF-based USB client drivers require two Microsoft-provided drivers: the reflector and WinUSB.
*
Reflector—If your driver gets loaded successfully, the reflector is loaded as the top-most driver in the kernel-mode stack. The reflector must be the top driver in the kernel mode stack. To meet this requirement, the template’s INF file specifies the reflector as a service and WinUSB as a lower-filter driver in the INF:
[MyDevice_Install.NT.Services]
AddService=WUDFRd,0x000001fa,WUDFRD_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WinUsb,0x000001f8,WinUsb_ServiceInstall ; this service is installed because its a filter.
*
WinUSB—The installation package must contain coinstallers for Winusb.sys because for the client driver, WinUSB is the gateway to the kernel-mode USB driver stack. Another component that gets loaded is a user-mode DLL, named WinUsb.dll, in the client driver’s host process (Wudfhost.exe). Winusb.dll exposes WinUSB Functions that simplify the communication process between the client driver and WinUSB.Step 3: Build the USB client driver code
To build your driver
*Open the driver project or solution in Visual Studio 2019.
*Right-click the solution in the Solution Explorer and select Configuration Manager.
*From the Configuration Manager, select your Active Solution Configuration (for example, Debug or Release) and your Active Solution Platform (for example, Win32) that correspond to the type of build you are interested in.
*Verify that your device interface GUID is accurate throughout the project.
*The device interface GUID is defined in Trace.h and is referenced from MyUSBDriverUMDFCreateDevice in Device.c. When you create your project with the name ’MyUSBDriver_UMDF_’, Visual Studio 2019 defines the device interface GUID with the name GUID_DEVINTERFACE_MyUSBDriver_UMDF_ but calls WdfDeviceCreateDeviceInterface with the incorrect parameter ’GUID_DEVINTERFACE_MyUSBDriverUMDF’. Replace the incorrect parameter with the name defined in Trace.h to ensure that the driver builds properly.
*From the Build menu, click Build Solution.
For more information, see Building a Driver.Step 4: Configure a computer for testing and debugging
To test and debug a driver, you run the debugger on the host computer and the driver on the target computer. So far, you have used Visual Studio on the host computer to build a driver. Next you need to configure a target computer. To configure a target computer, follow the instructions in Provision a computer for driver
https://diarynote.indered.space
コメント