johnstevenson / pl2303-legacy

Legacy PL2303 drivers for Windows 10 and Windows 11
73 stars 9 forks source link

"Device not connected" on win10 #5

Open Azq2 opened 1 month ago

Azq2 commented 1 month ago

image

image

johnstevenson commented 1 month ago

Internally the app gets the connected device/driver usingpnputil.exe which is a standard Windows component.

So you can mimic what it is doing by running the following in a command prompt:

pnputil.exe /enum-devices /class {4d36e978-e325-11ce-bfc1-08002be10318} /drivers /connected
Azq2 commented 1 month ago

Seems to be /drivers is not supported in my Windows 10 version. I'm not sure if it a bug, because I used win10.iso downloaded 6 years ago....

PS C:\Users\admin> pnputil.exe /enum-devices /class '{4d36e978-e325-11ce-bfc1-08002be10318}' /connected
Microsoft PnP Utility

Instance ID:                USB\VID_067B&PID_2303\5&12c8f4c0&0&2
Device Description:         Prolific USB-to-Serial Comm Port (COM4)
Class Name:                 Ports
Class GUID:                 {4d36e978-e325-11ce-bfc1-08002be10318}
Manufacturer Name:          Prolific
Status:                     Started
Driver Name:                oem6.inf
PS C:\Users\admin> pnputil.exe /enum-devices /class '{4d36e978-e325-11ce-bfc1-08002be10318}' /drivers /connected
Microsoft PnP Utility

PNPUTIL [/add-driver <...> | /delete-driver <...> |
         /export-driver <...> | /enum-drivers |
         /enum-devices [<...>] | /enum-interfaces [<...>] | /?]

Commands:

  /?

    Show usage screen.

  /enum-devices [/connected | /disconnected] [/instanceid <instance ID>]
                [/class <name | GUID>] [/problem [<code>]] [/ids] [/relations]

    Enumerate all devices on the system.
      /connected | /disconnected - filter by connected devices or
                                   filter by disconnected devices.
      /instanceid <instance ID> - filter by device instance ID.
      /class <name | GUID> - filter by device class name or GUID.
      /problem [<code>] - filter by devices with problems or
                          filter by specific problem code.
      /ids - display hardware IDs and compatible IDs.
      /relations - display parent and child device relations.

    Examples:
      Enumerate only connected devices on the system:
        pnputil /enum-devices /connected
      Enumerate device with specific instance ID:
        pnputil /enum-devices /instanceid "ACPI\PNP0A08\1"
      Enumerate all devices with specific class:
        pnputil /enum-devices /class Display
        pnputil /enum-devices /class {4d36e97d-e325-11ce-bfc1-08002be10318}
      Enumerate all devices with specific problem code:
        pnputil /enum-devices /problem 28
        pnputil /enum-devices /problem 0xA
      Enumerate all devices with problems and display hardware/compatible IDs:
        pnputil /enum-devices /problem /ids
PS C:\Users\admin> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      18362  0
johnstevenson commented 1 month ago

Thanks for the helpful insight. Indeed this is not supported on Windows 10 version 1903 (10.0.18362, May 2019 update).

The current documentation now states that /drivers is not available until Windows 10 version 2004 (10.0.19041, May 2020 update): https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil-command-syntax#enum-devices

However the documentation I used at the time of writing this (May 2022) showed /drivers being available in version 1903: https://web.archive.org/web/20221005150513/https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil-command-syntax#enum-devices

We need the /drivers option, because this returns a list of matching drivers for the device, which is difficult to correctly ascertain by other methods (enum-drivers for example). And is presumably why Microsoft added it.

I will update the minimum required Windows version to 2004 (May 2020 update), because unfortunately we cannot fix this.