unix: Fixed race condition while closing serial port. Added PortClosed error

This commit is contained in:
Cristian Maglie
2016-11-14 00:31:01 +01:00
parent 6eedab17b4
commit d50de5cbaf
2 changed files with 14 additions and 1 deletions

View File

@@ -100,6 +100,8 @@ const (
InvalidStopBits
// ErrorEnumeratingPorts an error occurred while listing serial port
ErrorEnumeratingPorts
// PortClosed the port has been closed while the operation is in progress
PortClosed
)
// EncodedErrorString returns a string explaining the error code
@@ -123,6 +125,8 @@ func (e PortError) EncodedErrorString() string {
return "Port stop bits invalid or not supported"
case ErrorEnumeratingPorts:
return "Could not enumerate serial ports"
case PortClosed:
return "Port has been closed"
default:
return "Other error"
}