Skip to content

Commit

Permalink
fix: update modem baud rate to 19200
Browse files Browse the repository at this point in the history
  • Loading branch information
damonto committed Jun 18, 2024
1 parent 842a134 commit 46fd87f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/pkg/modem/modem.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ func (m *Modem) RunATCommand(command string) (string, error) {

t := unix.Termios{
Iflag: unix.IGNPAR,
Cflag: unix.CREAD | unix.CLOCAL | unix.CS8 | unix.B9600,
Ispeed: unix.B9600,
Ospeed: unix.B9600,
Cflag: unix.CREAD | unix.CLOCAL | unix.CS8 | unix.B19200,
Ispeed: unix.B19200,
Ospeed: unix.B19200,
}
t.Cc[unix.VMIN] = 0
t.Cc[unix.VTIME] = 10 // 1 second
t.Cc[unix.VMIN] = 1
t.Cc[unix.VTIME] = 0
if _, _, errno := unix.Syscall6(unix.SYS_IOCTL, uintptr(port.Fd()), unix.TCSETS, uintptr(unsafe.Pointer(&t)), 0, 0, 0); errno != 0 {
return "", errors.New("failed to set termios: " + errno.Error())
}

if err := unix.SetNonblock(int(port.Fd()), false); err != nil {
return "", errors.New("failed to set nonblock: " + err.Error())
}
Expand Down

0 comments on commit 46fd87f

Please sign in to comment.