summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2022-02-10 23:09:35 +0100
committernorly <ny-git@enpas.org>2022-02-10 23:09:35 +0100
commit8b5dee0e36334412500b1ba41dca51fd10cbb56e (patch)
tree17139f7eb3f6d5cae2ef88116fd4347018bf0a77
parentba6991254fbe7e3e650542b6280353b9532c51f5 (diff)
Remove accept_flaky_uart module option.
Maybe we really shouldn't *too* lenient - the hexdump parsing code bails on the first strange character anyway.
-rw-r--r--module/elmcan.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/module/elmcan.c b/module/elmcan.c
index ac7036e..3d35821 100644
--- a/module/elmcan.c
+++ b/module/elmcan.c
@@ -42,15 +42,6 @@ MODULE_DESCRIPTION("ELM327 based CAN interface");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Max Staudt <max-linux@enpas.org>");
-/* If this is enabled, we'll try to make the best of the situation
- * even if we receive unexpected characters on the line.
- * No guarantees.
- * Handle with care, it's likely your hardware is unreliable!
- */
-static bool accept_flaky_uart;
-module_param_named(accept_flaky_uart, accept_flaky_uart, bool, 0444);
-MODULE_PARM_DESC(accept_flaky_uart, "Don't bail at the first invalid character. Behavior undefined.");
-
/* Line discipline ID number */
#ifndef N_ELMCAN
#define N_ELMCAN 29
@@ -448,12 +439,10 @@ static int elm327_parse_frame(struct elmcan *elm, int len)
}
}
- /* If we accept stray characters coming in:
- * Check for stray characters on a payload line.
- * No idea what causes this.
+ /* Sanity check whether the line is really a clean hexdump,
+ * or terminated by an error message, or contains garbage.
*/
- if (accept_flaky_uart &&
- hexlen < len &&
+ if (hexlen < len &&
!isdigit(elm->rxbuf[hexlen]) &&
!isupper(elm->rxbuf[hexlen]) &&
'<' != elm->rxbuf[hexlen] &&
@@ -938,8 +927,7 @@ static void put_elm(struct elmcan *elm)
static bool elmcan_is_valid_rx_char(char c)
{
- return (accept_flaky_uart ||
- isdigit(c) ||
+ return (isdigit(c) ||
isupper(c) ||
c == ELM327_MAGIC_CHAR ||
c == ELM327_READY_CHAR ||