mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-13 18:07:20 -06:00
Refines driver mapping logic and adds diagnostic logging
Improves JSON parsing of the driver mapping file to handle different file structures more reliably. Adds logging to show all potential driver mapping rules that match the current system, making it easier to diagnose rule selection.
This commit is contained in:
@@ -545,7 +545,7 @@ if (Test-Path -Path $driverMappingPath -PathType Leaf) {
|
||||
WriteLog "Detected System: Manufacturer='$systemManufacturer', Model='$systemModel'"
|
||||
|
||||
# Load and parse the mapping file, ensuring it's always an array
|
||||
$driverMappings = @(Get-Content -Path $driverMappingPath -Raw | ConvertFrom-Json -ErrorAction SilentlyContinue)
|
||||
$driverMappings = Get-Content -Path $driverMappingPath | Out-String | ConvertFrom-Json -ErrorAction SilentlyContinue
|
||||
|
||||
# Find all matching rules and select the most specific one
|
||||
$matchingRules = @()
|
||||
@@ -553,6 +553,7 @@ if (Test-Path -Path $driverMappingPath -PathType Leaf) {
|
||||
# Use -like for wildcard matching.
|
||||
# This checks if the system model starts with the rule model, or vice-versa, for flexibility.
|
||||
if ($systemManufacturer -like "$($rule.Manufacturer)*" -and ($systemModel -like "$($rule.Model)*" -or $rule.Model -like "$systemModel*")) {
|
||||
WriteLog "Match found: Manufacturer='$($rule.Manufacturer)', Model='$($rule.Model)'"
|
||||
$matchingRules += $rule
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user