Skip to content

Realtek: per-device MinVersion floor; fix RTL8157/8159 stale-driver pick#5

Merged
jm2 merged 1 commit into
mainfrom
jm2/realtek-minversion-floor
Jun 25, 2026
Merged

Realtek: per-device MinVersion floor; fix RTL8157/8159 stale-driver pick#5
jm2 merged 1 commit into
mainfrom
jm2/realtek-minversion-floor

Conversation

@jm2

@jm2 jm2 commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What

Adds an optional per-device MinVersion floor 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 current 115x.x builds (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-DriverScrape now reads an optional MinVersion per device; candidates below it are dropped, and a device left with no survivors is SKIPPED with the reason recorded in the manifest. realtek.psd1 floors RTL8157 at 1157 and RTL8159 at 1159, so:

  • the 2016 generic driver (11.x < 1157/1159) 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) — 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

  • Backward-compatible: devices without MinVersion behave 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

…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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 })) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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) {

@jm2 jm2 merged commit 0f18b5f into main Jun 25, 2026
6 checks passed
jm2 added a commit that referenced this pull request Jun 25, 2026
…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>
jm2 added a commit that referenced this pull request Jun 25, 2026
Revert PR #5: 11.19.602.2025 is the current NetAdapterCx driver, not stale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant