serialport/serialport-rs

Cannot list virtual serial ports on Windows 10

golanguage opened this issue ยท 3 comments

com0com mirror Null-modem emulator is a long history kernel-mode virtual serial port driver for Windows.

But these port cannot be detected by this lib;

serialport-rs on ๎‚  main is ๐Ÿ“ฆ v4.3.1-alpha.0 via ๐Ÿฆ€ v1.78.0
โฏ cargo run --example list_ports
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.56s
     Running `target\debug\examples\list_ports.exe`
No ports found.

I can find its port using WIN10 system serial tool:

โฏ [System.IO.Ports.SerialPort]::getportnames()
CNCA0
CNCB0

Or anothere Rust serial port lib serial2.

serial2-rs on ๎‚  main is ๐Ÿ“ฆ v0.2.24 via ๐Ÿฆ€ v1.78.0
โฏ cargo run --example list-ports
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.09s
     Running `target\debug\examples\list-ports.exe`
Found 2 ports
CNCA0
CNCB0

Thank you for bringing up this issue! You are mentioning serial2 which uses different enumeration strategy on Windows. There is #84 in our PR backlog since a while, which switches to the same strategy and it looks like this could resolve your issue as well.

I would like to integrate it with with a slight change as prototyped in https://github.com/sirhcel/serialport-rs/tree/missing-modem-ports (as of 0720d5a). Could you give this branch a spin? Will it make the null-modem ports you are looking for getting listed? And what about regular serial ports: do they show up as before and as you would expect them to?

seem it's a great job.
In fact, there is not a real serial port on the PC, all 4 ports are virtual.

serialport-rs on ๎‚  missing-modem-ports is ๐Ÿ“ฆ v4.3.1-alpha.0 via ๐Ÿฆ€ v1.78.0
โฏ cargo run --example list_ports
   Compiling serialport v4.3.1-alpha.0 (C:\proj\rust\serialport-rs)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.10s
     Running `target\debug\examples\list_ports.exe`
Found 4 ports:
  COM3
    Type: Unknown
  COM4
    Type: Unknown
  CNCA0
    Type: Unknown
  CNCB0
    Type: Unknown

Thank you for bringing up this issue! You are mentioning serial2 which uses different enumeration strategy on Windows. There is #84 in our PR backlog since a while, which switches to the same strategy and it looks like this could resolve your issue as well.

I would like to integrate it with with a slight change as prototyped in https://github.com/sirhcel/serialport-rs/tree/missing-modem-ports (as of 0720d5a). Could you give this branch a spin? Will it make the null-modem ports you are looking for getting listed? And what about regular serial ports: do they show up as before and as you would expect them to?

Solved with integrating #84.