mirror of
https://github.com/UzixLS/picocom.git
synced 2025-07-19 07:21:18 +03:00
Re-read terminal attributes after applying them.
After applying settings to a terminal device, in functions term_reset(), term_replace(), and term_apply(), re-read the setting from the device in order to update "currtermios", "nexttermios", and "origtermios" as required. Do not assume that the settings applied are the ones effectively set to the device (some of them may be ignored, or changed by the kernel or the driver).
This commit is contained in:
23
term.c
23
term.c
@ -513,6 +513,12 @@ term_replace (int oldfd, int newfd)
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
r = tcgetattr(newfd, &term.currtermios[i]);
|
||||
if ( r < 0 ) {
|
||||
term_errno = TERM_EGETATTR;
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
term.fd[i] = newfd;
|
||||
|
||||
@ -550,9 +556,14 @@ term_reset (int fd)
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
r = tcgetattr(term.fd[i], &term.currtermios[i]);
|
||||
if ( r < 0 ) {
|
||||
term_errno = TERM_EGETATTR;
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
term.currtermios[i] = term.origtermios[i];
|
||||
term.nexttermios[i] = term.origtermios[i];
|
||||
term.nexttermios[i] = term.currtermios[i];
|
||||
} while (0);
|
||||
|
||||
return rval;
|
||||
@ -634,7 +645,13 @@ term_apply (int fd)
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
r = tcgetattr(term.fd[i], &term.nexttermios[i]);
|
||||
if ( r < 0 ) {
|
||||
term_errno = TERM_EGETATTR;
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
term.currtermios[i] = term.nexttermios[i];
|
||||
|
||||
} while (0);
|
||||
|
Reference in New Issue
Block a user