serial icon indicating copy to clipboard operation
serial copied to clipboard

error on Windows which has never had an installed COM port

Open captain-error opened this issue 4 months ago • 0 comments

Hi there, thank you for this nice module!

I tried zig serial on a new windows laptop which never had a COM port installed.

This resulted in the following error:

....\AppData\Local\zig\p\serial-0.0.1-PoeRzD61AACY75Xpwn2iX7r3qWKDoYAMP9-4FME2LjDn\src\serial.zig:79:13: 0x7ff7e49beb14 in init (discover_serial.exe.obj)
            return error.WindowsError;
            ^
....\AppData\Local\zig\p\serial-0.0.1-PoeRzD61AACY75Xpwn2iX7r3qWKDoYAMP9-4FME2LjDn\src\serial.zig:7:12: 0x7ff7e49beb85 in list (discover_serial.exe.obj)
    return try PortIterator.init();
           ^
.....

From this it seems that the registry key which is checked in serial.zig on line 78 is not present on the system.

After installing a serial (CH340 chip from an Arduino clone), everything works as expected. I.e. the COM port is correctly discovered and after unplugging the device, no COM port is discovered and no error is produced.

Apparently, the installation of the COM port also created the registry key.

So, instead of returning the error when the registry key is missing, the port iterator should just behave as if no COM port was found.

captain-error avatar Sep 01 '25 19:09 captain-error