On Sun, Nov 24, 2019 at 3:11 AM Jeffrey Walton <noloa...@gmail.com> wrote:
> I am struggling to get a USB modem and terminal configured properly > under OpenBSD. The same code on Linux is fine. The symptom I am seeing > is a hung read() after issuing ATZ\r to the modem. > > I'm guessing there's an uninitialized field in my struct termios tty. > I'm not sure what you mean by that. Do you mean you're concerned that you're you making a tcsetattr(3) call on an incompletely initialized structure? Or do you mean you're concerned that the initial configuration of the tty provided by the kernel is in a "not good" state? > The latest Posix provides O_TTY_INIT to ensure a terminal is in a good > configuration, but OpenBSD does not recognize it. > What is the equivalent under OpenBSD? OpenBSD, like all BSDs, does not require anything special to be done to initialize a tty on first open. We can (and I guess we should at this point) define O_TTY_INIT to be zero. How do I achieve O_TTY_INIT when > using a struct termios tty? > Before calling tcsetattr(3) you should call tcgetattr(3) to get the tty device's current settings and only alter the setting you care about. Philip Guenther