Add support for registering existing interfaces
This adds support for native and slcan interfaces which are already
configured up to be registered in the CAN bus HAL.
Bug: 142655647
Test: manual
Change-Id: Ifd129db14dbf473bb627ebc9b9d13f5cb945b611
diff --git a/automotive/can/1.0/default/CanBusNative.cpp b/automotive/can/1.0/default/CanBusNative.cpp
index 88f9175..047b090 100644
--- a/automotive/can/1.0/default/CanBusNative.cpp
+++ b/automotive/can/1.0/default/CanBusNative.cpp
@@ -31,6 +31,11 @@
return ICanController::Result::BAD_ADDRESS;
}
+ if (mBaudrate == 0) {
+ // interface is already up and we just want to register it
+ return ICanController::Result::OK;
+ }
+
if (!netdevice::down(mIfname)) {
LOG(ERROR) << "Can't bring " << mIfname << " down (to configure it)";
return ICanController::Result::UNKNOWN_ERROR;