Skip to content

Possibly incorrect masks for modem input status bits on Windows #204

@WarningImHack3r

Description

@WarningImHack3r

Since #187, the values of at least 4 pin status are computed with the wrong mask values:
https://github.com/bugst/go-serial/pull/187/files#diff-47ee85faa4e0440b94978b6193177ae093540d712fcea25742e36b3546357af8L244-L249

-const (
-	msCTSOn  = 0x0010
-	msDSROn  = 0x0020
-	msRingOn = 0x0040
-	msRLSDOn = 0x0080
-)

They have been replaced by variables from the go source of x/sys/windows, but these masks represent the value change event for the pin, not their actual values. The bug is at least here: https://github.com/bugst/go-serial/blob/master/serial_windows.go#L288-L293

Following the Microsoft docs, the correct masks to read the values are the following:

-CTS = 0x0008
+CTS = 0x0010
-DSR = 0x0010
+DSR = 0x0020
-RING = 0x0100
+RING = 0x0040
-RLSD = 0x0020
+RLSD = 0x0080

@twpayne implemented the events using these docs, which are not for the same purpose.

Values were in fact correct pre-1.6.3, and have been broken since this version.

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