committed by
GitHub
parent
c18d387887
commit
0b7848559a
@@ -98,7 +98,7 @@ const (
|
|||||||
spdrpUpperFilters = 0x00000011 // UpperFilters = R/W
|
spdrpUpperFilters = 0x00000011 // UpperFilters = R/W
|
||||||
spdrpLowerFilters = 0x00000012 // LowerFilters = R/W
|
spdrpLowerFilters = 0x00000012 // LowerFilters = R/W
|
||||||
spdrpBusTypeGUID = 0x00000013 // BusTypeGUID = R
|
spdrpBusTypeGUID = 0x00000013 // BusTypeGUID = R
|
||||||
spdrpLegactBusType = 0x00000014 // LegacyBusType = R
|
spdrpLegacyBusType = 0x00000014 // LegacyBusType = R
|
||||||
spdrpBusNumber = 0x00000015 // BusNumber = R
|
spdrpBusNumber = 0x00000015 // BusNumber = R
|
||||||
spdrpEnumeratorName = 0x00000016 // Enumerator Name = R
|
spdrpEnumeratorName = 0x00000016 // Enumerator Name = R
|
||||||
spdrpSecurity = 0x00000017 // Security = R/W, binary form
|
spdrpSecurity = 0x00000017 // Security = R/W, binary form
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ const (
|
|||||||
PortNotFound
|
PortNotFound
|
||||||
// InvalidSerialPort the requested port is not a serial port
|
// InvalidSerialPort the requested port is not a serial port
|
||||||
InvalidSerialPort
|
InvalidSerialPort
|
||||||
// PermissionDenied the user doesn't have enough priviledges
|
// PermissionDenied the user doesn't have enough privileges
|
||||||
PermissionDenied
|
PermissionDenied
|
||||||
// InvalidSpeed the requested speed is not valid or not supported
|
// InvalidSpeed the requested speed is not valid or not supported
|
||||||
InvalidSpeed
|
InvalidSpeed
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ const (
|
|||||||
dcbInX = 0x00000200
|
dcbInX = 0x00000200
|
||||||
dcbErrorChar = 0x00000400
|
dcbErrorChar = 0x00000400
|
||||||
dcbNull = 0x00000800
|
dcbNull = 0x00000800
|
||||||
dcbRTSControlDisbaleMask = ^uint32(0x00003000)
|
dcbRTSControlDisableMask = ^uint32(0x00003000)
|
||||||
dcbRTSControlEnable = 0x00001000
|
dcbRTSControlEnable = 0x00001000
|
||||||
dcbRTSControlHandshake = 0x00002000
|
dcbRTSControlHandshake = 0x00002000
|
||||||
dcbRTSControlToggle = 0x00003000
|
dcbRTSControlToggle = 0x00003000
|
||||||
@@ -282,8 +282,8 @@ func (port *windowsPort) SetDTR(dtr bool) error {
|
|||||||
// observed behaviour was that DTR is set from false -> true
|
// observed behaviour was that DTR is set from false -> true
|
||||||
// when setting RTS from true -> false
|
// when setting RTS from true -> false
|
||||||
// 1) Connect -> RTS = true (low) DTR = true (low) OKAY
|
// 1) Connect -> RTS = true (low) DTR = true (low) OKAY
|
||||||
// 2) SetDTR(false) -> RTS = true (low) DTR = false (heigh) OKAY
|
// 2) SetDTR(false) -> RTS = true (low) DTR = false (high) OKAY
|
||||||
// 3) SetRTS(false) -> RTS = false (heigh) DTR = true (low) ERROR: DTR toggled
|
// 3) SetRTS(false) -> RTS = false (high) DTR = true (low) ERROR: DTR toggled
|
||||||
//
|
//
|
||||||
// In addition this way the CommState Flags are not updated
|
// In addition this way the CommState Flags are not updated
|
||||||
/*
|
/*
|
||||||
@@ -343,7 +343,7 @@ func (port *windowsPort) SetRTS(rts bool) error {
|
|||||||
if err := getCommState(port.handle, params); err != nil {
|
if err := getCommState(port.handle, params); err != nil {
|
||||||
return &PortError{causedBy: err}
|
return &PortError{causedBy: err}
|
||||||
}
|
}
|
||||||
params.Flags &= dcbRTSControlDisbaleMask
|
params.Flags &= dcbRTSControlDisableMask
|
||||||
if rts {
|
if rts {
|
||||||
params.Flags |= dcbRTSControlEnable
|
params.Flags |= dcbRTSControlEnable
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ func nativeOpen(portName string, mode *Mode) (*windowsPort, error) {
|
|||||||
}
|
}
|
||||||
port.setModeParams(mode, params)
|
port.setModeParams(mode, params)
|
||||||
params.Flags &= dcbDTRControlDisableMask
|
params.Flags &= dcbDTRControlDisableMask
|
||||||
params.Flags &= dcbRTSControlDisbaleMask
|
params.Flags &= dcbRTSControlDisableMask
|
||||||
if mode.InitialStatusBits == nil {
|
if mode.InitialStatusBits == nil {
|
||||||
params.Flags |= dcbDTRControlEnable
|
params.Flags |= dcbDTRControlEnable
|
||||||
params.Flags |= dcbRTSControlEnable
|
params.Flags |= dcbRTSControlEnable
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (p *Pipe) ReadFD() int {
|
|||||||
return p.rd
|
return p.rd
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteFD returns the flie handle for the write side of the pipe.
|
// WriteFD returns the file handle for the write side of the pipe.
|
||||||
func (p *Pipe) WriteFD() int {
|
func (p *Pipe) WriteFD() int {
|
||||||
if !p.opened {
|
if !p.opened {
|
||||||
return -1
|
return -1
|
||||||
@@ -48,7 +48,7 @@ func (p *Pipe) WriteFD() int {
|
|||||||
return p.wr
|
return p.wr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write to the pipe the content of data. Returns the numbre of bytes written.
|
// Write to the pipe the content of data. Returns the number of bytes written.
|
||||||
func (p *Pipe) Write(data []byte) (int, error) {
|
func (p *Pipe) Write(data []byte) (int, error) {
|
||||||
if !p.opened {
|
if !p.opened {
|
||||||
return 0, fmt.Errorf("Pipe not opened")
|
return 0, fmt.Errorf("Pipe not opened")
|
||||||
|
|||||||
Reference in New Issue
Block a user