Skip to content

wdfserial: fix diag port re-enumeration by clearing DeviceRemoveEvent, incrementing QCDeviceGeneration, and refreshing ReportDeviceName on D0Entry - #103

Merged
Chenxi Han (5656hcx) merged 1 commit into
qualcomm:developfrom
rohimish-qc:bugfix/diag_re-enumeration_fixes
Aug 18, 2026
Merged

wdfserial: fix diag port re-enumeration by clearing DeviceRemoveEvent, incrementing QCDeviceGeneration, and refreshing ReportDeviceName on D0Entry#103
Chenxi Han (5656hcx) merged 1 commit into
qualcomm:developfrom
rohimish-qc:bugfix/diag_re-enumeration_fixes

Conversation

@rohimish-qc

Copy link
Copy Markdown
Contributor

Description

  • Clear DeviceRemoveEvent before spawning I/O threads in QCPNP_SetupIoThreadsAndQueues to prevent worker threads from
    exiting immediately on re-enumeration due to a stale removal signal
  • Add QCDeviceGeneration DWORD registry value incremented on every EvtDevicePrepareHardware, allowing QDS to detect a
    device re-enumeration even when DevDesc/DevName/SerNum are identical across reboots
  • Move QCPNP_ReportDeviceName from EvtDeviceAdd to EvtDeviceD0Entry so the diag device name is re-announced to the
    parent filter driver on every re-enumeration, not just on first add

Fixes #

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Hotfix (urgent fix targeted at a release/x.y branch)
  • Refactor (no functional change)
  • Performance improvement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test-only change
  • CI / build-pipeline change

How has this been tested?

  • Ran 500+ USB restart cycles on a composite device with fast boot time (~61ms re-enumeration)
  • Confirmed QCDeviceGeneration increments in HKLM\SYSTEM\CurrentControlSet\Control\Class{4D36E978-E325-11CE-BFC1-08002BE10318}<####> on each restart
  • Confirmed QUTS logs show departure and re-arrival for the diag port (COM4/COM7) on every cycle
  • Confirmed no regression on sibling ports (ADB, DPL, QDSS)

Checklist

  • All required CI checks are green on the latest commit of this PR
  • Build succeeds following the steps in the README / src/linux/README.md
  • My code follows the Code Style Guidelines of this project
  • My branch follows the naming convention: <branch-prefix>/<area>/<description>
  • PR title follows the Conventional Commits format with our full-word types (feature / bugfix / hotfix / docs)
  • I have performed a self-review of my own code
  • I have added code comments in areas that are complex or hard to understand
  • My changes generate no new compiler warnings
  • I have added tests for my fix or feature (or noted why tests are not feasible)
  • New and existing tests pass locally with my changes
  • My branch is rebased onto the latest develop (or release/x.y for hotfix) - no merge commits
  • Every commit has Signed-off-by: (DCO) - see CONTRIBUTING.md
  • I have linked the relevant issue if any (Fixes #...)
  • Any dependent changes have been merged and published in downstream modules

…, incrementing QCDeviceGeneration, and refreshing ReportDeviceName on D0Entry

Signed-off-by: rohimish <rohimish@qti.qualcomm.com>
@5656hcx

Copy link
Copy Markdown
Contributor

Merged.
But I think DeviceRemoveEvent is used exactly 1 time only during the whole lifetime for each device.

@5656hcx
Chenxi Han (5656hcx) merged commit 280c89a into qualcomm:develop Aug 18, 2026
12 checks passed
// EvtDeviceAdd fires only once; D0Entry fires on each re-enumeration.
if (pDevContext->FdoDeviceType == FILE_DEVICE_SERIAL_PORT)
{
QCPNP_ReportDeviceName(pDevContext);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After this fix, every time a Hawi diag port wakes from idle/selective-suspend, the driver will re-send its device name to the parent filter driver, not just on true re-enumeration. That's extra IOCTL traffic to the filter driver on a cadence that could be quite frequent (every idle-in/idle-out cycle), for zero benefit in the non-re-enum case.

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.

3 participants