Add support for error, RTR, and EFF frames
Error frames, remote transmission request, and extended format frames
require some changes to the way that we set up our sockets.
Bug: 142655821
Bug: 144774939
Test: manual
Change-Id: I06212cb852d480c1c7093e8c509ca8aa9f85f81f
diff --git a/automotive/can/1.0/tools/canhaldump.cpp b/automotive/can/1.0/tools/canhaldump.cpp
index 99fd14a..55b2a34 100644
--- a/automotive/can/1.0/tools/canhaldump.cpp
+++ b/automotive/can/1.0/tools/canhaldump.cpp
@@ -20,6 +20,7 @@
#include <android/hidl/manager/1.2/IServiceManager.h>
#include <hidl-utils/hidl-utils.h>
+#include <linux/can.h>
#include <chrono>
#include <iomanip>
#include <iostream>
@@ -42,12 +43,14 @@
CanMessageListener(std::string name) : name(name) {}
virtual Return<void> onReceive(const V1_0::CanMessage& message) {
- std::cout << " " << name << " " << std::hex << std::uppercase << std::setw(3)
+ int msgIdWidth = 3;
+ if (message.isExtendedId) msgIdWidth = 8;
+ std::cout << " " << name << " " << std::hex << std::uppercase << std::setw(msgIdWidth)
<< std::setfill('0') << message.id << std::setw(0);
+ std::cout << " [" << message.payload.size() << "] ";
if (message.remoteTransmissionRequest) {
- std::cout << " RTR";
+ std::cout << "remote request";
} else {
- std::cout << " [" << message.payload.size() << "] ";
for (const auto byte : message.payload) {
std::cout << " " << std::setfill('0') << std::setw(2) << unsigned(byte);
}