summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-03 12:18:33 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-03 12:18:33 -0500
commit64af0554cb8c60f56bf2c1fa5cd59b9c2c5758ff (patch)
treeee1e4a72450c5c2e592aca40c400e7a259f9f42d
parentfe5f39179f7c85a2924c288149b5ecc8488918b1 (diff)
Print full payload by giving it enough buffer. DOH.
-rw-r--r--src/isotp/isotp.c3
-rw-r--r--tests/common.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/isotp/isotp.c b/src/isotp/isotp.c
index 6522f7aa..67a5df17 100644
--- a/src/isotp/isotp.c
+++ b/src/isotp/isotp.c
@@ -21,8 +21,7 @@ IsoTpShims isotp_init_shims(LogShim log, SendCanMessageShim send_can_message,
void isotp_message_to_string(const IsoTpMessage* message, char* destination,
size_t destination_length) {
- // TODO why is this still not printing the entire payload?
- snprintf(destination, destination_length, "ID: 0x%02x, Payload: 0x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ snprintf(destination, destination_length, "ID: 0x%02x, Payload: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
message->arbitration_id,
message->payload[0],
message->payload[1],
diff --git a/tests/common.c b/tests/common.c
index 5995df74..554293c9 100644
--- a/tests/common.c
+++ b/tests/common.c
@@ -46,7 +46,7 @@ void mock_set_timer(uint16_t time_ms, void (*callback)) {
void message_received(const IsoTpMessage* message) {
debug("Received ISO-TP message:");
message_was_received = true;
- char str_message[24];
+ char str_message[48] = {0};
isotp_message_to_string(message, str_message, sizeof(str_message));
debug("%s", str_message);
last_message_received_arb_id = message->arbitration_id;
@@ -62,7 +62,7 @@ void message_sent(const IsoTpMessage* message, const bool success) {
} else {
debug("Unable to send ISO-TP message:");
}
- char str_message[24] = {0};
+ char str_message[48] = {0};
isotp_message_to_string(message, str_message, sizeof(str_message));
debug("%s", str_message);