From ee310433e590d95a25264e88f55a41d520da22c5 Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Mon, 9 Jan 2023 10:00:52 +1100 Subject: [PATCH] AP_HAL_Linux: add option to use vitual CAN in linux --- libraries/AP_HAL_Linux/CANSocketIface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_Linux/CANSocketIface.cpp b/libraries/AP_HAL_Linux/CANSocketIface.cpp index c2203afa39..3c5cbae954 100644 --- a/libraries/AP_HAL_Linux/CANSocketIface.cpp +++ b/libraries/AP_HAL_Linux/CANSocketIface.cpp @@ -462,8 +462,11 @@ void CANIface::_updateDownStatusFromPollResult(const pollfd& pfd) bool CANIface::init(const uint32_t bitrate, const OperatingMode mode) { char iface_name[16]; +#if HAL_LINUX_USE_VIRTUAL_CAN + sprintf(iface_name, "vcan%u", _self_index); +#else sprintf(iface_name, "can%u", _self_index); - +#endif if (_initialized) { return _initialized; }