Drivers Drivercoding Port Devices



-->

In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabling operating systems and other computer programs to access hardware functions without needing to know precise details about the hardware being used. For most devices, the Ports device setup class and the Serial function driver provide the functionality required to operate serial ports and COM ports. To install serial ports and COM ports using these system-supplied components, do the following. Dennis Turpitka, CEO, Apriorit Inc. A driver is an essential software component of an operating system, allowing it to work with various devices, hardware, and virtual ones.

Versions supported

  • Windows 10
  • Windows 8.1

Applies to

  • Device manufacturers of CDC Control devices

Microsoft-provided in-box driver (Usbser.sys) for your Communications and CDC Control device.

In Windows 10, the driver has been rewritten by using the Kernel-Mode Driver Framework that improves the overall stability of the driver.

  • Improved PnP and power management by the driver (such as, handling surprise removal).
  • Added power management features such as USB Selective Suspend.

In addition, UWP applications can now use the APIs provided by the new Windows.Devices.SerialCommunication namespace that allow apps to talk to these devices.

Usbser.sys installation

Drivers drivercoding port devices gigabit

Load the Microsoft-provided in-box driver (Usbser.sys) for your Communications and CDC Control device.

Note

If you trying to install a USB device class driver included in Windows, you do not need to download the driver. They are installed automatically. If they are not installed automatically, contact the device manufacturer. For the list of USB device class driver included in Windows, see USB device class drivers included in Windows.

Windows 10

In Windows 10, a new INF, Usbser.inf, has been added to %Systemroot%Inf that loads Usbser.sys as the function device object (FDO) in the device stack. If your device belongs to the Communications and CDC Control device class, Usbser.sys is loaded automatically.You do not need to write your own INF to reference the driver. The driver is loaded based on a compatible ID match similar to other USB device class drivers included in Windows.

Drivers driver coding port devices lucie

USBClass_02

USBClass_02&SubClass_02

  • If you want to load Usbser.sys automatically, set the class code to 02 and subclass code to 02 in the Device Descriptor. For more information, see USB communications device class. With this approach, you are not required to distribute INF files for your device because the system uses Usbser.inf.
  • If your device specifies class code 02 but a subclass code value other than 02, Usbser.sys does not load automatically. Pnp Manager tries to find a driver. If a suitable driver is not found, the device might not have a driver loaded. In this case, you might have to load your own driver or write an INF that references another in-box driver.
  • If your device specifies class and subclass codes to 02, and you want to load another driver instead of Usbser.sys, you have to write an INF that specifies the hardware ID of the device and the driver to install. For examples, look through the INF files included with sample drivers and find devices similar to your device. For information about INF sections, see Overview of INF Files.

Note

Microsoft encourages you to use in-box drivers whenever possible. On mobile editions of Windows, such as Windows 10 Mobile, only drivers that are part of the operating system are loaded. Unlike desktop editions, it is not possible to load a driver through an external driver package. With the new in-box INF, Usbser.sys is automatically loaded if a USB-to-serial device is detected on the mobile device.

Windows 8.1 and earlier versions

In Windows 8.1 and earlier versions of the operating system, Usbser.sys is not automatically loaded when a USB-to-serial device is attached to a computer. To load the driver, you need to write an INF that references the modem INF (mdmcpq.inf) by using the Include directive. The directive is required for instantiating the service, copying inbox binaries, and registering a device interface GUID that applications require to find the device and talk to it. That INF specifies 'Usbser' as a lower filter driver in a device stack.

The INF also needs to specify the device setup class as Modem to use mdmcpq.inf. Under the [Version] section of the INF, specify the Modem and the device class GUID. for details, see System-Supplied Device Setup Classes.

For more information, see this KB article.

Configure selective suspend for Usbser.sys

Starting in Windows 10, Usbser.sys supports USB Selective Suspend. It allows the attached USB-to-serial device to enter a low power state when not in use, while the system remains in the S0 state. When communication with the device resumes, the device can leave the Suspend state and resume Working state. The feature is disabled by default and can be enabled and configured by setting the IdleUsbSelectiveSuspendPolicy entry under this registry key:

To configure power management features of Usbser.sys, you can set IdleUsbSelectiveSuspendPolicy to:

  • '0x00000001': Enters selective suspend when idle, that is, when there are no active data transfers to or from the device.

  • '0x00000000': Enters selective suspend only when there are no open handles to the device.

That entry can be added in one of two ways:

  • Write an INF that references the install INF and add the registry entry in the HW.AddReg section.

  • Describe the registry entry in an extended properties OS feature descriptor. Add a custom property section that sets the bPropertyName field to a Unicode string, 'IdleUsbSelectiveSuspendPolicy' and wPropertyNameLength to 62 bytes. Set the bPropertyData field to '0x00000001' or '0x00000000'. The property values are stored as little-endian 32-bit integers.

    For more information, see Microsoft OS Descriptors.

Drivers driver coding port devices for windows 10

Develop Windows applications for a USB CDC device

If you install Usbser.sys for the USB CDC device, here are the application programming model options:

  • Starting in Windows 10, a Windows app can send requests to Usbser.sys by using the Windows.Devices.SerialCommunication namespace. It defines Windows Runtime classes that can use to communicate with a USB CDC device through a serial port or some abstraction of a serial port. The classes provide functionality to discover such serial device, read and write data, and control serial-specific properties for flow control, such as setting baud rate, signal states.

  • In Windows 8.1 and earlier versions, you can write a Windows desktop application that opens a virtual COM port and communicates with the device. For more information, see:

    Win32 programming model:

    • .NET framework programming model:

Related topics

-->

Microsoft Windows provides a variety of driver models that you can use to write drivers. The strategy for choosing the best driver model depends on the type of driver you are planning to write. Here are the options:

  • Device function driver
  • Device filter driver
  • Software driver
  • File system filter driver
  • File system driver

For a discussion about the differences between the various types of drivers, see What is a driver? and Device nodes and device stacks. The following sections explain how to choose a model for each type of driver.

Choosing a driver model for a device function driver

As you design a hardware device, one of the first things to consider is whether you need to write a function driver. Ask the following questions:

Can you avoid writing a driver entirely?If you must write a function driver, what is the best driver model to use?To answer these questions, determine where your device fits in the list of technologies described in Device and driver technologies. See the documentation for that particular technology to determine whether you need to write a function driver and to learn about which driver models are available for your device.

Some of the individual technologies have minidriver models. In a minidriver model, the device driver consists of two parts: one that handles general tasks, and one that handles device-specific tasks. Typically, Microsoft writes the general portion and the device manufacturer writes the device-specific portion. The device specific portions have a variety of names, most of which share the prefix mini. Here are some of the names used in minidriver models:

  • Display miniport driver
  • Audio miniport driver
  • Battery miniclass driver
  • Bluetooth protocol driver
  • HID minidriver
  • WIA minidriver
  • NDIS miniport driver
  • Storage miniport driver
  • Streaming minidriver

For an overview of minidriver models, see Minidrivers and driver pairs.

Not every technology listed in Device and driver technologies has a dedicated minidriver model. The documentation for a particular technology might advise you to use the Kernel-Mode Driver Framework (KMDF); the documentation for another technology might advise you to use the User-Mode Driver Framework (UMDF). The key point is that you should start by studying the documentation for your specific device technology. If your device technology has a minidriver model, you must use the minidriver model. Otherwise follow the advice in the your technology-specific documentation about whether to use the UMDF, KMDF, or the Windows Driver Model (WDM).

Choosing a driver model for a device filter driver

Frequently several drivers participate in a single I/O request (like reading data from a device). The drivers are layered in a stack, and the conventional way to visualize the stack is with the first driver at the top and the last driver at the bottom. The stack has one function driver and can also have filter drivers. For a discussion about function drivers and filter drivers, see What is a driver? and Device nodes and device stacks.

If you are preparing to write a filter driver for a device, determine where your device fits in the list of technologies described in Device and driver technologies. Check to see whether the documentation for your particular device technology has any guidance on choosing a filter driver model. If the documentation for your device technology does not offer this guidance, then first consider using UMDF as your driver model. If your filter driver needs access to data structures that are not available through UMDF, consider using KMDF as your driver model. In the extremely rare case that your driver needs access to data structures not available through KMDF, use WDM as your driver model.

Choosing a driver model for a software driver

A driver that is not associated with a device is called a software driver. For a discussion about software drivers, see the What is a driver? topic. Software drivers are useful because they can run in kernel mode, which gives them access to protected operating system data. For information about processor modes, see User mode and kernel mode.

For a software driver, your two options are KMDF and the legacy Windows NT driver model. With both KMDF and the legacy Windows NT model, you can write your driver without being concerned about Plug and Play (PnP) and power management. You can concentrate instead on your driver's primary tasks. With KMDF, you do not have to be concerned with PnP and power because the framework handles PnP and power for you. With the legacy Windows NT model, you do not have to be concerned about PnP and power because kernel-mode services operate in an environment that is completely independent from PnP and power management.

Our recommendation is that you use KMDF, especially if you are already familiar with it. If you want your driver to be completely independent from PnP and power management, use the legacy Windows NT model. If you need to write a software driver that is aware of power transitions or PnP events, you cannot use the legacy Windows NT model; you must use KMDF.

Note In the very rare case that you need to write a software driver that is aware of PnP or power events, and your driver needs access to data that is not available through KMDF, you must use WDM.

Choosing a driver model for a file system driver

Drivers Driver Coding Port Devices Lucie

Drivers

Drivers Driver Coding Port Devices Free

Drivers

For help with choosing a model for a file system filter driver, see File system driver samples. Note that file system drivers can be quite complex and may require knowledge of advanced concepts for driver development.

Choosing a driver model for a file system filter driver

For help with choosing a model for a file system filter driver, see File system minifilter drivers and File system filter drivers.

Choosing a driver model for a file system minifilter driver

For help choosing a model for a file system minifilter driver, see File System Minifilter Drivers.

Drivers Drivercoding Port Devices Lucie

Related topics