From: norly Date: Thu, 10 Feb 2022 20:39:25 +0000 (+0100) Subject: Improve error handling in case of stray characters X-Git-Url: https://git.enpas.org/?p=elmcan.git;a=commitdiff_plain;h=4521b320c3c07207f76fe3b6be0d49b404cf717f Improve error handling in case of stray characters --- diff --git a/module/elmcan.c b/module/elmcan.c index c1e665e..49df7c1 100644 --- a/module/elmcan.c +++ b/module/elmcan.c @@ -396,8 +396,11 @@ static void elm327_parse_error(struct elmcan *elm, int len) } break; default: - /* Don't emit an error frame if we're unsure */ - return; + /* Something else has happened. + * Maybe garbage on the UART line. + * Emit a generic error frame. + */ + break; } elm327_feed_frame_to_netdev(elm, &frame); @@ -451,7 +454,6 @@ static int elm327_parse_frame(struct elmcan *elm, int len) /* The line is likely garbled anyway, so bail. * The main code will restart listening. */ - elm327_kick_into_cmd_mode(elm); return -ENODATA; }