Skip to content

error on Windows which has never had an installed COM port #50

@captain-error

Description

@captain-error

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions