logitech-rallysystem plugin support firmware upgrade of composite device. Device has multiple sub-devices: Audio, TableHub etc.
Device limitation:
Only Audio sub-device has topology information of all sub-devices, e.g. overall system version, version of each sub-devices etc. But only another sub-device (TableHub), can upgrade firmware for all sub-devices.
Compute Host limitation:
Leveraging udev rules, it only communicates with one sub-device/pid to query overall system version and push new firmware, if needed. Since only TableHub sub-device can upgrade firmware, host leverages this sub-device/pid in udev rules file.
Current design:
Set version information of each sub-devices, as they are created (LOGITECH_RALLYSYSTEM_AUDIO_DEVICE/LOGITECH_RALLYSYSTEM_TABLEHUB_DEVICE), Leverage plugin_device_added() to overwrite version information of TableHub sub-device to system version. Since this is the sub-device that compute host leverage
Issue:
Leveraging udev rules, host queries version information of TableHub device when the device is plugged-in. Since udev rules (D-Bus signals) are triggered before plugin_device_added(), host assumes, version reported by TableHub sub-system, as overall system version. This impacts upgrade flow. If host waits, for few seconds after udev rules (D-Bus signal) are triggered, then it correctly gets system version, because by that time, plugin_device_added() overwrites TableHub sub-system version with overall system version.
Is there any API we can leverage in plugin to defer/delay, until sub-device (TableHub) version is overwritten to system version?
Here are the verbose logs, all events happens virtually at same timestamp. In other words, it is a timing issue, when host query system version and trigger firmware upgrade:
19:56:33.695 FuPlugin emit added from logitech_rallysystem: 34970f527332351a0bcf41f574486e570aa73309
19:56:33.695 FuDeviceList ::added 34970f527332351a0bcf41f574486e570aa73309 [Logi Rally Table Hub]
19:56:33.695 FuMain ADDED:
FuLogitechRallysystemTablehubDevice:
DeviceId: 34970f527332351a0bcf41f574486e570aa73309
Name: Logi Rally Table Hub
Guid: afd482e8-642e-5592-aeda-d70e34fb5798 ← USB\VID_046D&PID_088F
Plugin: logitech_rallysystem
Protocol: com.logitech.vc.rallysystem
Flags: updatable|signed-payload|can-emulation-tag
Vendor: Logitech, Inc.
VendorId: USB:0x046D
Version: 1.1.540
<...SNIP...>
19:56:33.695 FuPlugin fu_plugin_device_added(logitech_rallysystem)
19:56:33.695 FuDevice changing version for 34970f527332351a0bcf41f574486e570aa73309: 1.1.540->1.2.135
19:56:33.695 FuPluginLogitechRallysystem overwriting tablehub version to 1.2.135