Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix capturing emulation data for dell-dock #6985

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

superm1
Copy link
Member

@superm1 superm1 commented Mar 27, 2024

Using a proxy and composite devices leads to some mismatches with how emulation data is captured. These commits help it.

I captured this using an old WD19TB I found.

$ fwupdmgr get-devices --filter emulated
WARNING: This package has not been validated, it may not work properly.
LENOVO 21D2SIT061
│
├─WD19TB:
│ │   Device ID:          48d6d6f37e7e7285eea2e215be449958b00246d7
│ │   Summary:            High performance dock
│ │   Current version:    01.01.00.07
│ │   Vendor:             Dell Inc. (USB:0x413C)
│ │   Install Duration:   2 seconds
│ │   Serial Number:      J4T6SV2/3169046018716226
│ │   Update State:       Success
│ │   Update Message:     The update will continue when the device USB cable has been unplugged.
│ │   Last modified:      2024-03-27 04:21
│ │   GUID:               cd357cf1-40b2-5d87-b8df-bb2dd82774aa ← USB\VID_413C&PID_B06E&hub&embedded
│ │   Device Flags:       • Supported on remote server
│ │                       • Device update needs activation
│ │                       • Device stages updates
│ │                       • Device can recover flash failures
│ │                       • Device is usable for the duration of the update
│ │                       • Updatable
│ │                       • Signed Payload
│ │                       • Emulated
│ │   Device Requests:    • Message (custom)
│ │ 
│ ├─Package level of Dell dock:
│ │     Device ID:        947b690100e39186e0f84e1a7e65c4c1805321fe
│ │     Summary:          A representation of dock update status
│ │     Current version:  01.00.36.01
│ │     Vendor:           Dell Inc. (USB:0x413C)
│ │     Install Duration: 2 seconds
│ │     Update State:     Success
│ │     Update Message:   The update will continue when the device USB cable has been unplugged.
│ │     Update Error:     Pending activation
│ │     Last modified:    2024-03-27 04:21
│ │     GUIDs:            d8927ff5-a5b2-5618-848b-8e8bfb75b66f
│ │                       8ceeeffd-51b6-580c-9b75-69143227aff8 ← USB\VID_413C&PID_B06E&hub&status
│ │     Device Flags:     • Supported on remote server
│ │                       • Device can recover flash failures
│ │                       • Device is usable for the duration of the update
│ │                       • Updatable
│ │                       • Unsigned Payload
│ │                       • Emulated
│ │     Device Requests:  • Message (custom)
│ │   
│ ├─RTS5413 in Dell dock:
│ │     Device ID:        91e14468ba8b4fa96e38d6a2e5761a1e184526e5
│ │     Summary:          USB 3.1 Generation 1 Hub
│ │     Current version:  01.22
│ │     Vendor:           Dell Inc. (USB:0x413C)
│ │     Install Duration: 2 seconds
│ │     Update State:     Success
│ │     Update Message:   The update will continue when the device USB cable has been unplugged.
│ │     Last modified:    2024-03-27 04:21
│ │     GUIDs:            b27d25f1-019d-5718-b41a-02ddaefe5577 ← USB\VID_413C&PID_B06F
│ │                       ac5b774c-b49d-566b-9255-85f0f7f8a4ed ← USB\VID_413C&PID_B06F&hub
│ │     Device Flags:     • Updatable
│ │                       • Supported on remote server
│ │                       • Device stages updates
│ │                       • Device is usable for the duration of the update
│ │                       • Signed Payload
│ │                       • Emulated
│ │     Device Requests:  • Message (custom)
│ │   
│ ├─RTS5487 in Dell dock:
│ │     Device ID:        dd07c50fa2af962e92734d9858c470432e1e6e23
│ │     Summary:          USB 3.1 Generation 2 Hub
│ │     Current version:  01.57
│ │     Vendor:           Dell Inc. (USB:0x413C)
│ │     Install Duration: 2 seconds
│ │     Update State:     Success
│ │     Update Message:   The update will continue when the device USB cable has been unplugged.
│ │     Last modified:    2024-03-27 04:21
│ │     GUIDs:            acfcd89b-105d-55b9-b85b-08bf8508f38c ← USB\VID_413C&PID_B06E
│ │                       568ffa1e-a0db-5287-9ea3-872b60f7730b ← USB\VID_413C&PID_B06E&hub
│ │     Device Flags:     • Updatable
│ │                       • Supported on remote server
│ │                       • Device stages updates
│ │                       • Device is usable for the duration of the update
│ │                       • Signed Payload
│ │                       • Emulated
│ │     Device Requests:  • Message (custom)
│ │   
│ └─VMM5331 in Dell dock:
│       Device ID:        54325b801dd0ebc0b69d51776a57c3adf1efbeea
│       Summary:          Multi Stream Transport controller
│       Current version:  05.07.04
│       Vendor:           Dell Inc. (USB:0x413C)
│       Install Duration: 2 seconds
│       Update State:     Success
│       Update Error:     Pending activation
│       Last modified:    2024-03-27 04:21
│       GUID:             89fec0b6-6b76-5008-b82c-5e5c6c164007 ← MST-panamera-vmm5331-259
│       Device Flags:     • Supported on remote server
│                         • Device stages updates
│                         • Device is usable for the duration of the update
│                         • Updatable
│                         • Unsigned Payload
│                         • Emulated

$ fwupdmgr install ./05*cab --allow-reinstall 
WARNING: This package has not been validated, it may not work properly.
Waiting…                 [***************************************] Less than one minute remaining…
Successfully installed firmware

Here is the emulation file I captured. Assuming all is good @hughsie can you please add it to the matching LVFS upload and then build the device-test using it so we can have coverage in our tests?
wd19tb.zip

Type of pull request:

@superm1 superm1 requested review from hughsie and CragW March 27, 2024 04:26
@superm1
Copy link
Member Author

superm1 commented Mar 27, 2024

52790d8 might not be needed after 6440ffc, let me know thoughts on it.

@@ -3031,8 +3031,10 @@ fu_engine_prepare(FuEngine *self,
!fu_device_has_flag(device, FWUPD_DEVICE_FLAG_EMULATED)) {
if (!fu_engine_backends_save_phase(self, error))
return FALSE;
if (!fu_engine_backends_clear_phase(self, error))
return FALSE;
if (fu_device_get_composite_id(device) == NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm missing the why -- how do you think it should work differently from a 40,000ft view for composite updates?

Copy link
Member Author

@superm1 superm1 Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem for composite updates is that you can't clear the USB events for a given device in between stages because a bunch of devices may use that USB device. With 52790d8 reverted, you end up with:

In the client:

Failed to query dock info: write over HID-I2C failed: failed after 5 retries: failed to SetReport: no matching event for ControlTransfer:Direction=0x01,RequestType=0x01,Recipient=0x01,Request=0x09,Value=0x0200,Idx=0x0000,Data=QMYAAAAAGgDsAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEYAQEABwAFBwQAAAEiAAABVwAAYAABADYBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,Length=0xc0

In the daemon:

12:13:26.826 FuEngine             failed to cleanup failed composite action: failed to composite_cleanup using dell_dock: write over HID-I2C failed: failed after 5 retries: failed to SetReport: no matching event for ControlTransfer:Direction=0x01,RequestType=0x01,Recipient=0x01,Request=0x09,Value=0x0200,Idx=0x0000,Data=QMYAAAAAAwDsAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0BAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,Length=0xc0

Copy link
Member Author

@superm1 superm1 Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess another way to look at it is that there is mismatch in the engine for the concept of "install phase" for composite device. A given device goes through all the install phases, it's not a full engine state.

  • fu_engine_install_releases: Iterates over releases/devices. Calls fu_engine_install_release
  • fu_engine_install_release: Goes over one release/device. Calls fu_engine_install_blob
  • fu_engine_install_blob: Goes over one device w/ a blob. Calls fu_engine_backends_save_phase a bunch of times for each install phase.

Clearing events for all USB devices on each device add causes the
data to get lost for a composite device.

Split up the clear phase to a separate step that is only called
when doing an actual update.
@superm1 superm1 force-pushed the superm1/composite-emulation branch from a0bc0bc to dddc824 Compare March 27, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants