AmendHub

Download:

jcs

/

subtext

/

amendments

/

507

serial: Use logger for non-fatal warnings rather than modal warn()


jcs made amendment 507 about 1 year ago
--- serial.c Wed Mar 15 21:14:56 2023 +++ serial.c Thu May 4 10:49:56 2023 @@ -212,7 +212,8 @@ serial_init(void) /* eat echo */ resp = serial_get_line(true); if (!resp || (resp[0] != 'O' || resp[1] != 'K')) - warn("bad response to ATE0: \"%s\"", resp == NULL ? "" : resp); + logger_printf("[modem] Bad response to ATE0: \"%s\"", + resp == NULL ? "" : resp); /* initialize */ serial_printf("%s\r", db->config.modem_init); @@ -333,7 +334,7 @@ maybe_read: if (serial_input_buf_len < sizeof(serial_input_buf)) { error = SerGetBuf(serial_in_refnum, &len); if (error != 0) { - warn("SerGetBuf returned %d", error); + logger_printf("[modem] SerGetBuf returned %d", error); return NULL; } if (len) { @@ -381,7 +382,7 @@ find_line: if (serial_input_buf_len >= sizeof(serial_input_buf)) panic("serial_get_line with wait but input buffer full"); if (Time - started > 5) { - warn("Timed out waiting for modem response"); + logger_printf("[modem] Timed out waiting for modem response"); return NULL; } goto maybe_read; @@ -523,7 +524,7 @@ serial_input(struct session *session) error = SerGetBuf(serial_in_refnum, &len); if (error != 0) { - warn("SerGetBuf returned %d", error); + logger_printf("[modem] SerGetBuf returned %d", error); return 0; } if (!len)