Skip to content

Commit

Permalink
SetMode for unix
Browse files Browse the repository at this point in the history
  • Loading branch information
abakum committed Feb 3, 2025
1 parent 013802a commit 135b74d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions serial_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,13 @@ func (port *unixPort) SetMode(mode *Mode) error {
mode.BaudRate = int(settings.Ospeed)
}
if mode.BaudRate == 0 {
allBR := baudrateMap[0]
baud := baudrateMap[0]
for _, rate := range baudrateMap {
allBR |= rate
baud |= rate
}
baud &= settings.Cflag
for k, rate := range baudrateMap {
if settings.Cflag&allBR == rate {
if baud == rate {
mode.BaudRate = k
break
}
Expand Down

0 comments on commit 135b74d

Please sign in to comment.