Skip to content

[FwUpdateCfu] Update config file to match CfuVirtualHid#65

Open
forderud wants to merge 2 commits into
microsoft:masterfrom
forderud:protocolCfgExample-fix
Open

[FwUpdateCfu] Update config file to match CfuVirtualHid#65
forderud wants to merge 2 commits into
microsoft:masterfrom
forderud:protocolCfgExample-fix

Conversation

@forderud
Copy link
Copy Markdown

@forderud forderud commented Oct 3, 2024

The FwUpdateCfu config file is currently unable to query version & update FW for the virtual HID device found in this repo (CfuVirtualHid). This PR seeks to fix this. The PR require #64 and #66 to be merged first.

Impact to functionality:

  • FwUpdateCfu.exe version protocolCfgExample.cfg is now able to successfully query FW version (see below).
  • FwUpdateCfu.exe update protocolCfgExample.cfg CfuVirtualHidDevice_MCU.offer.bin CfuVirtualHidDevice_MCU.payload.bin is now able to successfully update the FW version (see below).

Changes to match defines in the CfuVirtualHid driver:

  • Change PID to match PRODUCT_ID
  • Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE
  • Change USAGECOLLECTION to match CFU_DEVICE_USAGE
  • Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE
  • Change CONTENT_OUTPUT_USAGE to match PAYLOAD_OUTPUT_USAGE
  • Change CONTENT_RESPONSE_INPUT_USAGE to match PAYLOAD_INPUT_USAGE_MIN
  • Change OFFER_OUTPUT_USAGE to match OFFER_OUTPUT_USAGE_MIN
  • Change OFFER_RESPONSE_INPUT_USAGE to match OFFER_INPUT_USAGE_MIN

FwUpdateCfu.exe output

Observed output when running FwUpdateCfu.exe version protocolCfgExample.cfg with this PR:

Argv #1 is: version
Argv #2 is: protocolCfgExample.cfg
INVALID_HANDLE_VALUE \\?\HID#{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}#5&1a8c06af&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}grabbing usage 42, type 2 from collection of 6
Found device 0:
Header 0x02000002
FwVersion 123.4.5
Property 0x00003000
from device \\?\HID#HID_DEVICE_SYSTEM_VHF#2&b84b253&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

Observed output when running FwUpdateCfu.exe update protocolCfgExample.cfg CfuVirtualHidDevice_MCU.offer.bin CfuVirtualHidDevice_MCU.payload.bin with this PR:

Argv #1 is: update
Argv #2 is: protocolCfgExample.cfg
Argv #3 is: CfuVirtualHidDevice_MCU.offer.bin
Argv #4 is: CfuVirtualHidDevice_MCU.payload.bin
INVALID_HANDLE_VALUE \\?\HID#{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}#5&1a8c06af&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}grabbing usage 42, type 2 from collection of 6
Found device 0:
Header 0x02000002
FwVersion 123.4.5
Property 0x00003000
from device \\?\HID#HID_DEVICE_SYSTEM_VHF#2&b84b253&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Only one device found, auto-selecting.
Processing offer against \\?\HID#HID_DEVICE_SYSTEM_VHF#2&b84b253&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
grabbing usage 31, type 1 from collection of 6
grabbing usage 26, type 0 from collection of 6
grabbing usage 1E, type 1 from collection of 6
grabbing usage 1A, type 0 from collection of 6

HidD_SetOutputReport of reportId: 37 length: 17
HidD_SetOutputReport 37 17
SetOutputReport for Offer:
bank: 0
milestone: 0
platformId: 0x0
protocolRevision: 0x2
compatVariantMask: 0x0
componentId: 0x30
forceIgnoreVersion: 0x0
forceReset: 0x0
segment: 0x0
token: 0x0
FW Update offer accepted for CfuVirtualHidDevice_MCU.offer.bin
Beginning content packet transfers:
HidD_SetOutputReport of reportId: 32 length: 61
HidD_SetOutputReport 32 61
Successfully sent 1 content packets (50.0% complete)
HidD_SetOutputReport of reportId: 32 length: 61
HidD_SetOutputReport 32 61
Successfully sent 2 content packets (100.0% complete)

FW Update Completed Successfully in 0.007073 seconds!

The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device found in this repo (CfuVirtualHid). This PR seeks to fix this, so that the tool can at least query FW version. The PR require the PID/VID filtering fix in microsoft#64 to be merged first.

Impact to functionality:
* "FwUpdateCfu.exe version protocolCfgExample.cfg" is now able to successfully query FW version.
* "FwUpdateCfu.exe update protocolCfgExample.cfg CfuVirtualHidDevice_MCU.offer.bin CfuVirtualHidDevice_MCU.payload.bin" still fails (not a regression in this PR). This will need to be addressed later.

Changes to match defines in the CfuVirtualHid driver:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
@forderud forderud force-pushed the protocolCfgExample-fix branch from 9dde8c8 to 389d104 Compare October 3, 2024 12:07
@forderud forderud changed the title [FwUpdateCfu] Update config file to improve CfuVirtualHid compatibility [FwUpdateCfu] Update config file to match CfuVirtualHid Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant