AP_HAL_Linux: add option to use vitual CAN in linux

This commit is contained in:
bugobliterator 2023-01-09 10:00:52 +11:00 committed by Andrew Tridgell
parent 10fb5d6b21
commit ee310433e5

View File

@ -462,8 +462,11 @@ void CANIface::_updateDownStatusFromPollResult(const pollfd& pfd)
bool CANIface::init(const uint32_t bitrate, const OperatingMode mode) bool CANIface::init(const uint32_t bitrate, const OperatingMode mode)
{ {
char iface_name[16]; 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); sprintf(iface_name, "can%u", _self_index);
#endif
if (_initialized) { if (_initialized) {
return _initialized; return _initialized;
} }