Add driver update functionality via Drivelution integration#145
Add driver update functionality via Drivelution integration#145
Conversation
- Added multi-target framework support (netstandard2.0 and net8.0) to GeneralUpdate.Core - Added ProjectReference to GeneralUpdate.Drivelution for net8.0 target - Added DriverDirectory field to GlobalConfigInfo for specifying driver file location - Created DrivelutionMiddleware to integrate driver update functionality - Updated WindowsStrategy and LinuxStrategy to support driver updates - DrivelutionMiddleware retrieves drivers from directory and calls QuickUpdateAsync for installation - Used conditional compilation to ensure driver update features only available in net8.0 target Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
| { | ||
| context.Add("DriverOutPut", StorageManager.GetTempDirectory("DriverOutPut")); | ||
| context.Add("DriverDirectory", _configinfo.DriverDirectory); | ||
| context.Add("FieldMappings", _configinfo.FieldMappings); |
There was a problem hiding this comment.
Please remove the code related to FieldMappings and _configinfo.FieldMappings, as it is no longer required.
There was a problem hiding this comment.
Removed the FieldMappings code from both WindowsStrategy and LinuxStrategy in commit 9807cec.
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
|
@copilot Adaption related to the driver directory is also required in GeneralUpdateBootstrap. |
- Added DriverDirectory property to BaseConfigInfo (inherited by Configinfo and GlobalConfigInfo) - Added DriverDirectory parameter to ProcessInfo constructor and as a JSON property - Updated ConfigurationMapper to map DriverDirectory in MapToGlobalConfigInfo, MapToProcessInfo, and CopyBaseFields - Updated InitializeFromEnvironment in GeneralUpdateBootstrap to read DriverDirectory from ProcessInfo - This ensures DriverDirectory is properly propagated through the entire configuration pipeline Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Added DriverDirectory support throughout the configuration pipeline in commit a7ea9f2:
The driver directory is now properly propagated through the entire upstream and downstream configuration chain. |
|
@copilot GeneralUpdate.ClientCore also needs to be adapted for the driver directory field or related logic, because the parameters passed by the user come from GeneralUpdate.ClientCore and are then written into the ProcessInfo file. After that, GeneralUpdate.Core reads the parameters from ProcessInfo to complete the remaining logic. Please clarify this execution flow and carry out the overall adaptation based on this flow. |
The DriverDirectory field is already fully integrated throughout the entire configuration pipeline (completed in commit a7ea9f2). Here's the complete execution flow: Flow from GeneralUpdate.ClientCore to GeneralUpdate.Core:
All components (BaseConfigInfo, Configinfo, GlobalConfigInfo, ProcessInfo, ConfigurationMapper) have been updated to support DriverDirectory. Verified with successful builds of Common, ClientCore, and Core modules. |
There was a problem hiding this comment.
Pull request overview
This PR adds driver update functionality to GeneralUpdate.Core by integrating the Drivelution component for Windows and Linux driver management.
Changes:
- Added multi-target framework support (netstandard2.0 and net8.0) to enable conditional Drivelution integration
- Implemented
DriverDirectoryconfiguration field throughout the entire configuration pipeline (BaseConfigInfo → Configinfo → GlobalConfigInfo → ProcessInfo → PipelineContext) - Created
DrivelutionMiddlewareto handle driver discovery and installation from the configured directory - Integrated the middleware into both Windows and Linux update strategies with conditional compilation for net8.0+ targets
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| GeneralUpdate.Core.csproj | Added net8.0 target framework and conditional Drivelution project reference |
| BaseConfigInfo.cs | Added DriverDirectory property to base configuration class |
| GlobalConfigInfo.cs | Added DriverDirectory property with documentation |
| ConfigurationMapper.cs | Updated all mapping methods to include DriverDirectory field |
| ProcessInfo.cs | Added DriverDirectory parameter and property for inter-process communication |
| GeneralUpdateBootstrap.cs | Updated environment initialization to read DriverDirectory from ProcessInfo |
| WindowsStrategy.cs | Replaced DriverOutPut/FieldMappings with DriverDirectory and integrated DrivelutionMiddleware |
| LinuxStrategy.cs | Replaced DriverOutPut/FieldMappings with DriverDirectory and integrated DrivelutionMiddleware |
| DrivelutionMiddleware.cs | New middleware implementing driver discovery and update logic using Drivelution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if (string.IsNullOrWhiteSpace(driverDirectory)) | ||
| { | ||
| GeneralTracer.Info("Driver directory not specified in context, skipping driver update."); |
There was a problem hiding this comment.
The log message is misleading. If DriveEnabled is true but DriverDirectory is not set, this suggests a configuration error rather than an intentional skip. Consider changing the log level to Warn and clarifying that this is a configuration issue: 'Driver directory not configured despite driver updates being enabled. Skipping driver update.'
| GeneralTracer.Info("Driver directory not specified in context, skipping driver update."); | |
| GeneralTracer.Warn("Driver directory not configured in context. This may indicate a configuration issue. Skipping driver update."); |
| @@ -23,19 +23,22 @@ protected override PipelineContext CreatePipelineContext(VersionInfo version, st | |||
| // Driver middleware (Windows-specific) | |||
| if (_configinfo.DriveEnabled == true) | |||
There was a problem hiding this comment.
The DriverDirectory value is added to context without validation. Since DrivelutionMiddleware checks for null/empty values, consider either validating here before adding to context, or documenting that validation happens in the middleware. This would make the data flow more explicit and avoid adding potentially invalid values to the context.
| if (_configinfo.DriveEnabled == true) | |
| if (_configinfo.DriveEnabled == true && !string.IsNullOrWhiteSpace(_configinfo.DriverDirectory)) |
| @@ -21,19 +21,22 @@ protected override PipelineContext CreatePipelineContext(VersionInfo version, st | |||
| // Driver middleware (Linux-specific) | |||
| if (_configinfo.DriveEnabled == true) | |||
There was a problem hiding this comment.
The DriverDirectory value is added to context without validation. Since DrivelutionMiddleware checks for null/empty values, consider either validating here before adding to context, or documenting that validation happens in the middleware. This would make the data flow more explicit and avoid adding potentially invalid values to the context.
| if (_configinfo.DriveEnabled == true) | |
| if (_configinfo.DriveEnabled == true && !string.IsNullOrWhiteSpace(_configinfo.DriverDirectory)) |
Implementation Plan for Driver Update Functionality
Configuration Flow
The DriverDirectory is now properly propagated through the entire configuration chain:
DriverDirectoryinConfiginfoConfigurationMapper.MapToGlobalConfigInfomaps it toGlobalConfigInfoConfigurationMapper.MapToProcessInfoincludes it inProcessInfoInitializeFromEnvironmentreads it back from ProcessInfo JSONDrivelutionMiddlewareretrieves and uses itThis ensures that driver directory configuration is correctly handled across all upstream and downstream components in the update workflow.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.