Skip to content

feat(win32/networks): native parent resolution and USB/PCI ID correlation for Bluetooth adapters#1188

Open
eduardomozart wants to merge 11 commits into
glpi-project:developfrom
eduardomozart:fix-usb-internal
Open

feat(win32/networks): native parent resolution and USB/PCI ID correlation for Bluetooth adapters#1188
eduardomozart wants to merge 11 commits into
glpi-project:developfrom
eduardomozart:fix-usb-internal

Conversation

@eduardomozart

@eduardomozart eduardomozart commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

What does this PR do?
This PR enhances the Windows Network Inventory module (Networks.pm) to accurately resolve the manufacturer and model of virtual Bluetooth network interfaces by natively querying their physical parent hardware components.

By accurately extracting the physical parent's identifiers and injecting them into the NETWORKS payload, this PR ensures that the GLPI server (specifically utilizing the duplicate-matching logic in GLPI PR #24494) can natively match the network card asset with the corresponding physical USB device. This allows the server to seamlessly remove the redundant standalone USB peripheral from the Computer assets!

    <NETWORKS>
      <DESCRIPTION>Bluetooth Device (Personal Area Network)</DESCRIPTION>
      <MACADDR>3C:0A:F3:8B:09:B8</MACADDR>
-     <MANUFACTURER>Microsoft</MANUFACTURER>
-     <MODEL>Bluetooth Device (Personal Area Network)</MODEL>
+     <MANUFACTURER>Realtek Semiconductor Corp.</MANUFACTURER>
+     <MODEL>Realtek Bluetooth Adapter</MODEL>
      <PNPDEVICEID>BTH\MS_BTHPAN\6&amp;1aac2cac&amp;0&amp;2</PNPDEVICEID>
      <SPEED>3</SPEED>
      <STATUS>Down</STATUS>
      <TYPE>ethernet</TYPE>
      <VIRTUALDEV>0</VIRTUALDEV>
    </NETWORKS>

Implementation Details:

  • Native SetupAPI Integration: Parent device resolution is cleanly performed in memory via Win32::API wrapping cfgmgr32.dll (CM_Locate_DevNodeW, CM_Get_Parent, and CM_Get_Device_IDW).
  • Unified ID Database Lookups: We universally parse the retrieved parentDeviceId (extracting VENDORID/PRODUCTID) and proactively query the agent's ID databases directly (usb.ids or pci.ids) via GLPI::Agent::Tools::Generic.
  • WMI Supplemental Fallback: If the local ID databases return a partial match (e.g., they provide the Manufacturer but lack the specific Model/PID), the module automatically supplements the missing attributes by querying Win32_PnPEntity over WMI.
  • Unit Testing: Updated networks.t with memory-safe Win32::API method mocks to fully validate the parent detection and resolution mechanisms.

Why is this beneficial?

  1. Unifies property resolution by prioritizing rich local ID databases (usb.ids/pci.ids) over raw WMI properties for all underlying peripheral components, guaranteeing the most accurate hardware branding possible.
  2. Correctly enriches virtual Bluetooth network interfaces with their underlying physical hardware vendor and model, ensuring network adapters are fully identified.

@g-bougard

Copy link
Copy Markdown
Member

Hi @eduardomozart

please, can you limit you in count of opened PR ? I don't have anymore time to review them anyway before the next release.

@eduardomozart

Copy link
Copy Markdown
Contributor Author

No problem, I’m working on GLPI-Agent until this Friday when I should be assigned to other projects, after that I’ll have little to no time to work into it.

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.

2 participants