diff options
author | norly <ny-git@enpas.org> | 2022-02-10 21:39:25 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2022-02-10 23:03:43 +0100 |
commit | 4521b320c3c07207f76fe3b6be0d49b404cf717f (patch) | |
tree | 452a599584c65ae69cda9f6fdd2a2bece146ef24 /module | |
parent | c53e1250ec5337f35891f719cf90af324e36b955 (diff) |
Improve error handling in case of stray characters
Diffstat (limited to 'module')
-rw-r--r-- | module/elmcan.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |