Realtek: per-device MinVersion floor; fix RTL8157/8159 stale-driver pick#5
Conversation
…r pick The Microsoft Update Catalog has no modern (11XX-line NetAdapterCx) driver for the USB 5G/10G parts RTL8157 (PID_8157) and RTL8159 (PID_815A); the only HWID match is a 2016/2018 generic NDIS driver (11.19.602.2025) whose INF blankets ~16 legacy PIDs. "Highest [version] wins" therefore shipped a 9-year-old driver for those chips, while their siblings 8153/8156 correctly get current 115x.x builds. Add an optional per-device MinVersion floor to Invoke-DriverScrape: candidates below the floor are dropped, and a device left with no survivors is SKIPPED with the reason recorded in the manifest. Floor RTL8157 at 1157 and RTL8159 at 1159 so the antique is skipped today and a real per-chip driver is auto-selected the moment Realtek publishes a 115x.x build (its [version] major clears the floor). RTL8126/8127 were also flagged but are NOT a bug: the engine already selects their newest catalog driver (1126.27 / 1127.27, Sep 2025). They trail 8125/8168 only because Realtek published a newer release (rel-29, Feb 2026) for the mainstream 1G/2.5G parts but not the niche 5G/10G PCIe parts. Confirmed by dumping the full dual-query candidate sets. Backward-compatible (devices without MinVersion are unchanged). Tests: +5 assertions, 74 passed / 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces an optional per-device MinVersion floor configuration to filter out stale, generic legacy drivers from the Microsoft Update Catalog, ensuring only modern, chip-specific drivers are selected. It also updates the manifest generation to report when a device is skipped due to this floor and adds corresponding unit tests and configurations for Realtek devices. The review feedback suggests adding a warning if a configured MinVersion fails to parse to prevent silent failures, and optimizing a pipeline check in the loop by using member enumeration and the -notin operator instead of Where-Object.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| # driver whose INF blankets dozens of PIDs), so the device skips rather than ships | ||
| # the antique. A real per-chip driver (whose [version] major encodes the model, e.g. | ||
| # 1157.x) clears the floor automatically once Realtek publishes it. | ||
| $minVersion = if ($Device.ContainsKey('MinVersion')) { ConvertTo-CsVersion $Device.MinVersion } else { $null } |
There was a problem hiding this comment.
If MinVersion is defined in the configuration but fails to parse (due to a typo or invalid format), it will silently return $null and skip the floor check. Adding a warning when MinVersion is present but cannot be parsed helps prevent silent failures and configuration errors.
$minVersion = $null
if ($Device.ContainsKey('MinVersion')) {
$minVersion = ConvertTo-CsVersion $Device.MinVersion
if (-not $minVersion) {
Write-Warning "Device $label has an unparseable MinVersion '$($Device.MinVersion)'."
}
}
| } | ||
|
|
||
| # A device whose every candidate was floored out: record why, for the manifest. | ||
| if ($minVersion -and $floorDropped -gt 0 -and -not ($AvailablePackages | Where-Object { $_.Key -eq $deviceKey })) { |
There was a problem hiding this comment.
Using a pipeline with Where-Object inside a loop to check for the existence of a key in $AvailablePackages is inefficient and less idiomatic in PowerShell. Since $AvailablePackages is an array of custom objects, you can leverage member enumeration ($AvailablePackages.Key) and the -notin operator for a cleaner, faster, and more direct check.
if ($minVersion -and $floorDropped -gt 0 -and $deviceKey -notin $AvailablePackages.Key) {
…le-driver pick" This reverts the changes merged in PR #5 (merge commit 0f18b5f). Its premise was disproven: 11.19.602.2025 is NOT a stale 2016 generic NDIS driver — it is the CURRENT Realtek USB NetAdapterCx family driver. Verified by extracting the live catalog package: - binaries rtucx22x64.sys (PE32+ x86-64) and rtucx22arm64.sys (PE32+ ARM64); "rtucx" = Realtek USB NetAdapterCx - CAB packaged 2025/08 on the catalog CDN; the DriverVer 03/30/2016 is cosmetic - INF explicitly binds USB\VID_0BDA&PID_8157 AND PID_815A across all REV codes, in both [Realtek.NTamd64] and [Realtek.ntarm64] - the catalog serves it in x64 AND ARM64 (ARM64 updateid 7da54d16-6faf-4214-b869-93f53467a9e1) The MinVersion='1157'/'1159' floor skipped exactly that driver, shipping nothing for 8157/8159 and dropping the only ARM64 driver available for them. The pre-PR behavior (selecting 11.19.602.2025) was correct; RTL8126/8127 were never a bug. Tests: 81 passed / 0 failed (post-#4 baseline restored). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Revert PR #5: 11.19.602.2025 is the current NetAdapterCx driver, not stale
What
Adds an optional per-device
MinVersionfloor to the catalog scrape engine and uses it to fix RTL8157/8159 selecting an ancient driver.Why
A Gemini check flagged that several Realtek USB/PCIe parts pull older drivers than their siblings. Running the actual engine + verifying against the live catalog split this into two cases:
RTL8157 / RTL8159 — real defect (fixed here). The catalog has no modern (11XX-line NetAdapterCx) driver for these USB 5G/10G parts. The only HWID match is a 2016/2018 generic NDIS driver (
11.19.602.2025) whose INF blankets ~16 legacy PIDs. "Highest[version]wins" then shipped that 9-year-old driver, while siblings 8153/8156 correctly get current115x.xbuilds (Jan 2026).RTL8126 / RTL8127 — NOT a bug (no change). The engine already selects their newest catalog driver (
1126.27/1127.27, Sep 2025). They trail 8125/8168 only because Realtek shipped a newer release (rel-29, Feb 2026) for the mainstream 1G/2.5G parts but not the niche 5G/10G PCIe parts. Confirmed by dumping the full dual-query candidate sets — there is nothing newer to fetch.How
Invoke-DriverScrapenow reads an optionalMinVersionper device; candidates below it are dropped, and a device left with no survivors isSKIPPEDwith the reason recorded in the manifest.realtek.psd1floors RTL8157 at1157and RTL8159 at1159, so:11.x<1157/1159) is skipped today, and115x.xbuild (its[version]major clears the floor) — no future code change needed.Live run confirms: 8153→
1153.22.113.2026, 8156→1156.22.113.2026, 8157/8159 → "all candidates below MinVersion; none selected" → SKIPPED.Compatibility / tests
MinVersionbehave exactly as before (the floor-less PCIe entries cannot regress).Test-CatalogScrape.ps1: +5 assertions (MinVersion floor semantics + psd1 wiring). 74 passed / 0 failed.🤖 Generated with Claude Code