1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Added TERM_EDEVINIT error

Device initialization failed
This commit is contained in:
Nick Patavalis
2018-02-28 10:12:21 +02:00
parent 6062aec171
commit 0c464859c3
2 changed files with 6 additions and 2 deletions

5
term.c
View File

@ -252,7 +252,8 @@ static const char * const term_err_str[] = {
[TERM_EDRAIN] = "Cannot drain the device",
[TERM_EBREAK] = "Cannot send break sequence",
[TERM_ERTSDOWN] = "Cannot lower RTS",
[TERM_ERTSUP] = "Cannot raise RTS"
[TERM_ERTSUP] = "Cannot raise RTS",
[TERM_EDEVINIT] = "Cannot initialize device"
};
static char term_err_buff[1024];
@ -270,6 +271,7 @@ term_strerror (int terrnum, int errnum)
case TERM_ESETISPEED:
case TERM_EDRAIN:
case TERM_EBREAK:
case TERM_EDEVINIT:
snprintf(term_err_buff, sizeof(term_err_buff),
"%s: %s", term_err_str[terrnum], strerror(errnum));
rval = term_err_buff;
@ -534,6 +536,7 @@ term_new (int fd, const char *name, const struct term_ops *ops)
if (ops->init) {
int r = ops->init(rval);
if ( r < 0 ) {
term_errno = TERM_EDEVINIT;
/* Failed to init, abandon allocation */
rval->fd = -1;
if ( rval->name ) {

3
term.h
View File

@ -153,7 +153,8 @@ enum term_errno_e {
TERM_EDRAIN, /* see errno */
TERM_EBREAK,
TERM_ERTSDOWN,
TERM_ERTSUP
TERM_ERTSUP,
TERM_EDEVINIT, /* see errno */
};
/* E parity_e