microsoft / CFU

Component Firmware Update
MIT License
59 stars 27 forks source link

How to use FwUpdateCfu.exe to send firmware image update files to virtual device #52

Open WeiChengLiao opened 2 years ago

WeiChengLiao commented 2 years ago

Hi All,

I follow the steps from CFU virtual HID device firmware update simulation and create a virtual device in device manager. image

Than, I build the solutions "VirtualDeviceFirmwareUpdate.sln & CfuExample.sln" to generate .inf, .cat, .dll, two offers, two payloads and FwUpdateCfu.exe. \CFU\Host\MonolithicPackageExample\VirtualDeviceFwUpdate\Debug\x64\VirtualDeviceFirmwareUpdatePackage\VirtualDeviceFirmwareUpdatePackage image

When I try to execute tool, there is an error message: FwUpdateCfu.exe version protocolCfgExample.cfg

Argv #1 is: version
Argv #2 is: protocolCfgExample.cfg
Error Device not found or not working

Here is content of my config:

#instructions:
#Fill in csv tag and the value in hex for each item
#order not important
#only the first 2 fields will be looked at so values after that are considered comments
VID,0x045e,#mandatory (each vendor must maintain their own Vendor defined Utility Page collections)
PID,0x0111,#optional
USAGEPAGE,0xFA00,#mandatory (each vendor must maintain their own Vendor defined Utility Page collections)
USAGECOLLECTION,0xF5,#optional (if you don't specify, the tool will attempt to talk to all devices with matching UsagePage/Vid/Pid on the usages specified below)
VERSION_FEATURE_USAGE,0x62,#mandatory for all procedures
CONTENT_OUTPUT_USAGE,0x61,#mandatory for fwUpdate procedure
CONTENT_RESPONSE_INPUT_USAGE,0x66,#mandatory for fwUpdate procedure
OFFER_OUTPUT_USAGE,0x8e,#mandatory for fwUpdate procedure
OFFER_RESPONSE_INPUT_USAGE,0x8a,#mandatory for fwUpdate procedure

Is there any advice ?

Thanks

allen6kid7 commented 2 years ago

hi, how did you generate the virtual HID device? I also followed the steps from the guide, but it failed to generate. Any hints? 图片

WeiChengLiao commented 2 years ago

hi, how did you generate the virtual HID device? I also followed the steps from the guide, but it failed to generate. Any hints? 图片

Hi, I just follow the steps in document.

samtertzakian commented 1 year ago

To make the tool work with a virtual device, you need to make a change to the tool.

You need to update the code that checks for PID/VID to add the "VHF" component of the string. If you want to make this change and submit a PR you are welcome to. We will eventually update this tool to do this.

This is the code that would need to be updated... The issue is that it does not account for the "VHF" part of the HWID string.

   // Filter on both if both set
    if (ProtocolSettings.Vid && ProtocolSettings.Pid) 
    {
        swprintf(vidPidFilterString, 256, L"VID_%04X&PID_%04X", 
                 ProtocolSettings.Vid, ProtocolSettings.Pid);
        if (!wcsstr(DevicePath, vidPidFilterString))
        {
            // The device found doesn't match the vid and pid
            //wprintf(L"The device found does not match the VID/PID\n");
            hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
            goto Exit;

        }
    }
    // Filter on vid only (vid is mandatory)
    else
    {
        swprintf(vidPidFilterString, 256, L"VID_%04X", ProtocolSettings.Vid);
        if (!wcsstr(DevicePath, vidPidFilterString))
        {
            // The device found doesn't match the vid
            hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
            goto Exit;
        }
    }
ChandrashekarCYoga commented 1 month ago

I am facing same issue. Is this fixed by any chance?