On Friday, 24 January 2025 at 00:19, 'Sanjay Sheth' via fwupd <
fw...@googlegroups.com> wrote:
> Another interesting finding from both Google & Logitech dev setup:
> "fwupdtool install /path/to/cab" fails,
> but following always works:
> "fwupdtool --verbose --plugins logitech_bulkcontroller install-blob /path/to/firmware.bin"
Okay, that's certainly interesting. I've got a release RB so reinstall is an expected failure, but like you say, when installing v1.9.556 onto v1.9.556 I get:
install-blob: failed to write-firmware: firmware upgrade failed (which is expected, as the RB can only upgrade)
install:      failed to write-firmware: failed to write end transfer packet: not CMD_ACK, got timeout (which is the bad thing)
I did a full -vv log of both operations, and lightly filtered them (e.g. ts in the JSON blob is different) and attached the diff.txt file
The first two differences seem to be the differing protocol return orders, as documented in 
https://github.com/fwupd/fwupd/tree/main/plugins/logitech-bulkcontroller#design-notes
The third is a ts difference, and a GUID that changed -- which I think we can ignore.
The fourth is where it gets interesting, and makes sense in the `failed to write end transfer packet` context:
@@ -774906,18 +482009,25 @@ FuPluginLogitechBulkController response:
 FuPluginLogitechBulkController request:        03 cc 00 00 97 03 00 00 14 25 3a f7 
 FuPluginLogitechBulkController response:       01 ff 00 00 04 00 00 00 03 cc 00 00 
 FuPluginLogitechBulkController request:        04 cc 00 00 24 00 00 00 01 00 00 00 
-FuPluginLogitechBulkController response:       02 ff 00 00 08 00 00 00 04 cc 00 00 
+FuPluginLogitechBulkController response:       01 ff 00 00 08 00 00 00 04 cc 00 00 
..so when:
 * using install-blob we send EndTransfer (0xCC04) and get Ack     (0xFF01)
 * using install      we send EndTransfer (0xCC04) and get Timeout (0xFF02) 
Recapturing the logs, this time with timestamps turned on I see:
install-blob:
11:48:10.355 FuPluginLogitechBulkController request:        03 cc 00 00 97 03 00 00 14 25 3a f7 
11:48:10.356 FuPluginLogitechBulkController response:       01 ff 00 00 04 00 00 00 03 cc 00 00 
(1ms)
11:48:12.780 FuPluginLogitechBulkController request:        04 cc 00 00 24 00 00 00 01 00 00 00 
11:48:18.578 FuPluginLogitechBulkController response:       01 ff 00 00 08 00 00 00 04 cc 00 00 
(5798ms)
install:
11:51:31.356 FuPluginLogitechBulkController request:        03 cc 00 00 97 03 00 00 14 25 3a f7 
11:51:31.357 FuPluginLogitechBulkController response:       01 ff 00 00 04 00 00 00 03 cc 00 00 
(1ms)
11:51:54.377 FuPluginLogitechBulkController request:        04 cc 00 00 24 00 00 00 01 00 00 00 
11:51:54.380 FuPluginLogitechBulkController response:       02 ff 00 00 08 00 00 00 04 cc 00 00 
(3ms)
So for some reason, install-blob is asking the hardware to EndTransfer and it returns with Ack in ~6s -- but install is asking the hardware to EndTransfer and it returns in 3ms with Timeout.
Should we retry the FU_LOGITECH_BULKCONTROLLER_CMD_END_TRANSFER if the first one returns with timeout? I'm very confused why install and install-blob should differ here; it's the same device initialization. I even used `--plugins logitech_bulkcontroller` to restrict install down to just the bulkcontroller initialization.
The only difference I can see, from a timing point of view, is that:
install:
 - Call FuPlugin->setup() to create the FuPluginLogitechBulkController (716ms)
 - decompress cab archive (9125ms)
 - write firmware...
install-blob:
 - Call FuPlugin->setup() to create the FuPluginLogitechBulkController (730ms)
 - write firmware...
I tried to simulate this using something like this:
@@ -1402,6 +1402,9 @@ fu_logitech_bulkcontroller_device_setup(FuDevice *device, GError **error)
+       g_usleep(9125 * 1000);
        return TRUE;
 }
But install-blob still "succeeded", even when I made the delay much much bigger. So, the timestamp difference between ->setup() and ->write_firmware() is maybe not the issue here. 
Perhaps it's the cabinet decompressor or stream operations -- this is a 6GB payload so I guess there might be a >4GB 32 bit bug somewhere. To test this I did a complete -vv of both install and install-blob, this time unlimiting the buffer logging -- so each file is ~6GB in size. This certainly gave "diff" something to chew on.
This gave the other attached file, decompress.patch -- again lightly filtered for clarity. It shows the same differing protocol return orders we saw in the earlier log, and the Timeout (0xFF02) failure -- but doesn't show any differences in the byte data we send the hardware.
At this point I'm a bit stumped -- can you share with me what EndTransfer is actually doing in the firmware, device-side so to speak?
Richard.