summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-08 17:27:54 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-08 17:29:34 -0500
commit6e08c6f35254273aa9750600be0effe6e7cf276e (patch)
tree8591d0fb6e1be8378d43c656a4211af898888a4d
parentfe38d0d4925be0e0182ec5b511b8f7fe715ffee5 (diff)
Don't log incorrect negative response mode, just cap it at 0.
-rw-r--r--src/obd2/obd2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/obd2/obd2.c b/src/obd2/obd2.c
index c000aa3..25b00e7 100644
--- a/src/obd2/obd2.c
+++ b/src/obd2/obd2.c
@@ -205,8 +205,9 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims,
handle->completed = true;
} else {
shims->log("Response was for a mode 0x%x request (pid 0x%x), not our mode 0x%x request (pid 0x%x)",
- response.mode - MODE_RESPONSE_OFFSET, response.pid,
- handle->request.mode, handle->request.pid);
+ MAX(0, response.mode - MODE_RESPONSE_OFFSET),
+ response.pid, handle->request.mode,
+ handle->request.pid);
setup_receive_handle(handle);
}
} else {