diff --git a/libraries/AP_HAL_SITL/Util.cpp b/libraries/AP_HAL_SITL/Util.cpp index 00c34de66e..be0bade419 100644 --- a/libraries/AP_HAL_SITL/Util.cpp +++ b/libraries/AP_HAL_SITL/Util.cpp @@ -8,3 +8,51 @@ uint64_t HALSITL::Util::get_hw_rtc() const const uint64_t nanoseconds = ts.tv_nsec; return (seconds * 1000000ULL + nanoseconds/1000ULL); } + +/* + get a (hopefully unique) machine ID + */ +bool HALSITL::Util::get_system_id_unformatted(uint8_t buf[], uint8_t &len) +{ + char *cbuf = (char *)buf; + + // try first to use machine-id file. Most systems will have this + const char *paths[] = { "/etc/machine-id", "/var/lib/dbus/machine-id" }; + for (uint8_t i=0; i