2024-10-04 15:58:17 +08:00
|
|
|
#include "host.h"
|
2026-01-06 09:48:38 +08:00
|
|
|
#include "common/sysctl.h"
|
2026-03-31 20:01:25 +08:00
|
|
|
#include "common/smbios.h"
|
2024-10-04 15:58:17 +08:00
|
|
|
|
2026-03-29 09:28:49 +08:00
|
|
|
const char* ffDetectHost(FFHostResult* host) {
|
2026-07-10 18:08:04 +08:00
|
|
|
const char* error = nullptr;
|
2026-03-29 09:28:49 +08:00
|
|
|
if ((error = ffSysctlGetString(CTL_HW, HW_PRODUCT, &host->name))) {
|
2024-10-04 15:58:17 +08:00
|
|
|
return error;
|
2026-03-29 09:28:49 +08:00
|
|
|
}
|
2024-10-04 15:58:17 +08:00
|
|
|
ffCleanUpSmbiosValue(&host->name);
|
2026-07-10 18:08:04 +08:00
|
|
|
if (ffSysctlGetString(CTL_HW, HW_VENDOR, &host->vendor) == nullptr) {
|
2024-10-04 15:58:17 +08:00
|
|
|
ffCleanUpSmbiosValue(&host->vendor);
|
2026-03-29 09:28:49 +08:00
|
|
|
}
|
2026-07-10 18:08:04 +08:00
|
|
|
if (ffSysctlGetString(CTL_HW, HW_VERSION, &host->version) == nullptr) {
|
2024-10-04 15:58:17 +08:00
|
|
|
ffCleanUpSmbiosValue(&host->version);
|
2026-03-29 09:28:49 +08:00
|
|
|
}
|
2026-07-10 18:08:04 +08:00
|
|
|
if (ffSysctlGetString(CTL_HW, HW_SERIALNO, &host->serial) == nullptr) {
|
2024-10-04 15:58:17 +08:00
|
|
|
ffCleanUpSmbiosValue(&host->serial);
|
2026-03-29 09:28:49 +08:00
|
|
|
}
|
2024-10-04 15:58:17 +08:00
|
|
|
|
2026-07-10 18:08:04 +08:00
|
|
|
return nullptr;
|
2024-10-04 15:58:17 +08:00
|
|
|
}
|