Device firmware update For USB devices without using a co-installer

USB Device vendors utilise co-installers to update device firmware for devices that use inbox USB device drivers. However, co-installers are non supported by the new “Universal INF” standard, which is a requirement on Windows x. This poses a claiming to existing USB device firmware update process. This topic outlines a recommended method to update USB device firmware without a co-installer.

Requirements

The main requirements from the USB device firmware update process are:

  1. Seamless firmware update with no user interaction

  2. Reliable recovery mechanism (for example, no bricking of devices)

  3. Works on Windows 7 and later

Overview

USB devices like UVC cameras are released with in-field updatable firmware. At that place is no standard method to update the firmware today. One item that is common to all existing update mechanisms is that some custom software suite runs on the client and downloads the firmware to the device. Typically, as role of the device installation procedure, the firmware updating software suite is installed. The co-installer boot starts the firmware update procedure. The absence of co-installers on Windows ten prevents device vendors from updating the firmware on these devices in the field.

The recommended method to circumvent the absenteeism of a co-installer for the USB device firmware update scenario is to utilise a lower filter driver to the USB device that will kick start the firmware update procedure. During the

AddDevice

call, the filter commuter will check the device firmware version and update the firmware if necessary.

Firmware update overview

When a USB device is plugged in to the arrangement, the generic inbox driver is installed for the device. After the installation of the generic commuter, the OS queries the Windows Update server for whatever vendor specific commuter package availability and downloads it and installs the driver. The installed commuter package will perform the firmware update.

There are two ways the firmware could be updated:

  1. Firmware Update Filter Commuter

    1. A vendor supplied lower filter commuter that performs the firmware update.
  2. Firmware Update Device Driver

    1. A vendor supplied lower filter commuter that puts the device in “firmware update mode”.

    2. The device enumerates as a firmware update device.

    3. Vendor supplied firmware update driver will load against this device and updates the firmware.

Read:  Samsung Tv Firmware Update Release Notes 2017

Method one: Firmware Update Filter Driver

In this method, a lower filter driver to the USB device driver will be installed as part of driver update process. This filter commuter will perform the firmware update.

The driver update package on the Windows Update server will contain:

  • A firmware update WDF lower filter driver

  • An extension INF to install the firmware update WDF lower filter driver

  • The “firmware.bin” file

Firmware update UMDF lower filter driver method.

While installing the driver update package, the firmware update WDF filter commuter’due south

AddDevice

routine will be called. From this routine, the WDF filter commuter will go for the device firmware version from the device HW registry key. The device firmware should have placed the firmware version using the MSOS descriptor onto the device HW registry cardinal.

  1. If the device firmware version and the filter driver expected firmware version are dissimilar, or

  2. The firmware version is not bachelor in the device HW registry key

    1. Then, the filter driver will insert itself into the device stack by returning success to

      AddDevice

      callback.
  3. Else, the filter driver will non insert itself into the device stack

    1. Because there is no necessity for updating the firmware equally the device has the expected firmware.

When the
EVT_WDF_DEVICE_D0_ENTRY
callback of the WDF filter commuter is chosen at a later indicate, the filter driver must register for device interface change notifications using CM_Register_Notification or IoRegisterPlugPlayNotification (UMDF or KMDF) to listen to the device interface grade the USB device will register the device into. Eastward.g. The firmware update filter driver for a RGB photographic camera would register for KSCATEGORY_VIDEO_CAMERA. On receiving the notification, the filter driver should post a work-detail that would perform the firmware update.

UMDF based firmware update drivers can use the device specific APIs or issue the control transfers directly to access the USB device to perform the firmware update. For example, the UMDF based filter driver for a camera would use Photographic camera APIs to perform the firmware update.

KMDF based firmware update drivers tin can send the vendor specific commands to perform the firmware update.

On completion of flashing the firmware, the device must disconnect and reconnect to the charabanc. The device will be re-enumerated with new firmware.

The method of using a “firmware update filter driver”, is recommended for devices that have enough resources to hold two full firmware images (the update image and a backup image) on the device retentiveness. The reason is if there were failures during downloading the updated firmware, the device can carelessness the update and kick into its original firmware. Thus, non bricking the device.

Read:  How to Update Firmware on 2014 Hyundai Genesis Coupe

Method 2: Firmware Update Device Commuter

In this method, a lower filter driver to the USB device will exist installed as part of the driver update process. This filter driver will send a command to the device to restart in firmware update mode, where the device exposes a firmware update interface. The commuter for the firmware update interface will load and perform the firmware update.

The driver update package on Windows Update server for the device will contain:

  1. A WDF lower filter driver that will identify the device in firmware update way

  2. An extension INF to install the WDF lower filter commuter

In improver to the driver update parcel, a separate Firmware Update Device Commuter package will be present on Windows Update, with:

  1. A WDF firmware update device commuter and its INF, and

  2. The “firmware.bin” file.

Firmware update WDF driver method.

While installing the driver update package, the WDF lower filter driver’s AddDevice routine will exist called. From this routine, the filter driver will query for the device firmware version from the device HW registry central. The device firmware should have placed the “firmware version”, using the MSOS descriptor or the USB device’s extension INF, onto the device HW registry key.

  1. If the device firmware version and the filter driver expected firmware versions are different or

  2. The firmware version is not bachelor in the device HW registry key

  3. Then, the WDF filter driver will insert itself into the device stack.

  4. Else, the WDF filter driver will non insert itself into the device stack

When the
EVT_WDF_DEVICE_D0_ENTRY
callback of the WDF filter driver is called at a later indicate, the filter driver will issue a vendor specific command to the device which will place it in firmware update way. i.eastward. The device will disconnect and reconnect, exposing the firmware update interface.

The organization will enumerate the firmware update device interface. A custom firmware update WDF driver supplied by the vendor, in the firmware update packet, will be load for this firmware update interface. This driver will update the firmware.

When the
EVT_WDF_DEVICE_D0_ENTRY
callback of the WDF firmware update driver is called at a later point, the driver must post a work-detail that would perform the firmware update.

On completion of flashing the firmware, the device must disconnect and reconnect to the bus. The device will be re-enumerated with new firmware.

Read:  Insignia Google Home Can't Finish Updating Firmware

This method is recommended for devices that cannot concord the updated and original firmware images due to shortage of memory on the device. The reason is if there were failures during downloading the updated firmware, the device can abandon the update and boot the device into its firmware update manner again and the firmware update tin exist retried. Thus, not bricking the device.

Recovery

The firmware update process tin fail for various reasons. If that happens, when the device is enumerated once more, the firmware update driver may try to update the firmware again and may fail again and this update process could end upwardly in a loop. The firmware update driver must put an upper limit to the number of retries it tin perform. When the firmware update retries gets across a threshold (for instance, 3 retries) and so the filter driver should not attempt to update the firmware again, until a new version of the commuter is downloaded from WU. The firmware update driver may use the registry to persist the retry states.

At the end of device firmware update, we recommend that the device reset itself and re-enumerate.

Both methods of firmware update, the device role must exist stopped earlier performing the firmware update. This ensures there are no open handle to the device and avoids whatsoever OS restart requirement.

Sample INF

            ;============================================================================== ; Microsoft Extension INF for USB Camera Firmware Update UMDF Filter Commuter ; Copyright (C) Microsoft Corporation.  All rights reserved. ;==============================================================================  [Version] Signature="$WINDOWS NT$" Class=Extension ClassGUID={e2f84ce7-8efa-411c-aa69-97454ca4cb57} Provider=%CONTOSO% ExtensionId = {BC6EE554-271C-48C8-B713-8078833962BD} ; replace with your own GUID CatalogFile.NT = SampleExtension.true cat DriverVer=08/28/2017,ten.0.1700.000  [SourceDisksFiles] ContosoFirmwareUpdateFilterDriver.dll=1 ContosoFirmware.bin=one  [SourceDisksNames] i = %MediaDescription%  [DestinationDirs] UMDriverCopy=12,UMDF ; re-create to drivers\UMDF ContosoFirmwareCopy=12,ContosoFirmware ; copy to drivers\ContosoFirmware DefaultDestDir = 12  [UMDriverCopy] ContosoFirmwareUpdateFilterDriver.dll  [ContosoFirmwareCopy] ContosoFirmware.bin  [Manufacturer] %CONTOSO% = ContosoFirmwareUpdateFilterDriver,ntamd64  [ContosoFirmwareUpdateFilterDriver.ntamd64] ; replace with your camera device VID PID %ContosoCamera.DeviceDesc% = ContosoFirmwareUpdateFilterDriver_Install, USB\VID_1234&PID_1234&REV_1234  [ContosoFirmwareUpdateFilterDriver_Install] CopyFiles=UMDriverCopy, ContosoFirmwareCopy  [ContosoFirmwareUpdateFilterDriver_Install.HW] AddReg = ContosoFirmwareUpdateFilterDriver.AddReg  [ContosoFirmwareUpdateFilterDriver.AddReg] ; Load the redirector every bit an lower filter on this specific device. ; 0x00010008 - FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND HKR,,"LowerFilters",0x00010008,"WUDFRd"  [ContosoFirmwareUpdateFilterDriver_Install.Services] AddService=WUDFRd,0x000001f8,WUDFRD_ServiceInstall  [WUDFRD_ServiceInstall] DisplayName = %WudfRdDisplayName% ServiceType = 1 StartType = 3 ErrorControl = 1 ServiceBinary = %12%\WUDFRd.sys  [ContosoFirmwareUpdateFilterDriver_Install.Wdf] UmdfService=ContosoFirmwareUpdateFilterDriver, ContosoFirmwareUpdateFilterDriver.UmdfFilter UmdfServiceOrder=ContosoFirmwareUpdateFilterDriver  [ContosoFirmwareUpdateFilterDriver.UmdfFilter] UmdfLibraryVersion=2.0.0 ServiceBinary= "%12%\UMDF\ContosoFirmwareUpdateFilterDriver.dll"  [Strings] CONTOSO = "Contoso Inc." ContosoCamera.DeviceDesc = "Contoso Camera Extension" MediaDescription="Contoso Camera Firmware Update Filter Commuter Installation Media" WudfRdDisplayName = "WDF Reflector Driver"