+ case TDEV_TCGETATTR: {
+ struct _termios* tios = va_arg(args, struct _termios*);
+ *tios = (struct _termios){.c_oflag = term->oflags,
+ .c_iflag = term->iflags,
+ .c_lflag = term->lflags};
+ memcpy(tios->c_cc, term->cc, _NCCS * sizeof(cc_t));
+ tios->c_baud = term->iospeed;
+ } break;
+ case TDEV_TCSETATTR: {
+ struct _termios* tios = va_arg(args, struct _termios*);
+ term->iflags = tios->c_iflag;
+ term->oflags = tios->c_oflag;
+ term->lflags = tios->c_lflag;
+ memcpy(term->cc, tios->c_cc, _NCCS * sizeof(cc_t));
+
+ if (tios->c_baud != term->iospeed) {
+ term->iospeed = tios->c_baud;
+ if (!term->chdev_ops.set_speed) {
+ goto done;
+ }
+
+ term->chdev_ops.set_speed(term->chdev, tios->c_baud);
+ }
+ } break;