diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a0ce1b9e..4a1153a63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ Changes: * Remove support of option `--battery-dir`. We detect a lot of things in `/sys/class/*` and only module `Battery` supports specifying a custom directory for some reason, which is weird. +* Remove `--chassis-use-wmi` which is no longer used. Features: * Add `ENABLE_PROPRIETARY_GPU_DRIVER_API` cmake option to disable using of proprietary GPU driver APIs (GPU) * Add power adapter detection support for Asahi Linux (PowerAdapter, Linux) * Add battery serial number detection (Battery) +* Add host serial number and UUID detection (Host) Bugfixes: * Fix support of macOS Sonoma (Wallpaper, macOS) diff --git a/doc/json_schema.json b/doc/json_schema.json index e86fbc74d..cb48c7e66 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -875,11 +875,6 @@ "const": "chassis", "description": "Print chassis type (desktop, laptop, etc)" }, - "useWmi": { - "description": "Set if WMI query should be used on Windows, which detects more information but slower", - "type": "boolean", - "default": false - }, "key": { "$ref": "#/$defs/key" }, @@ -1224,11 +1219,6 @@ "const": "host", "description": "Print product name of your computer", }, - "useWmi": { - "description": "Set if WMI query should be used on Windows, which detects more information but slower", - "type": "boolean", - "default": false - }, "key": { "$ref": "#/$defs/key" }, diff --git a/src/data/help.json b/src/data/help.json index 2302f6c10..d3da78a82 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -842,26 +842,6 @@ "default": "default" } }, - { - "long": "host-use-wmi", - "desc": "Set if WMI query should be used on Windows when detecting host", - "remark": "WMI query detects more information (UUID and serial number) but is slower. Windows only", - "arg": { - "type": "bool", - "optional": true, - "default": false - } - }, - { - "long": "chassis-use-wmi", - "desc": "Set if WMI query should be used on Windows when detecting chassis", - "remark": "WMI query detects more information (vendor and version) but is slower. Windows only", - "arg": { - "type": "bool", - "optional": true, - "default": false - } - }, { "long": "separator-string", "desc": "Set the string printed by the separator module", diff --git a/src/detection/chassis/chassis.h b/src/detection/chassis/chassis.h index 60befc83e..6990a09e4 100644 --- a/src/detection/chassis/chassis.h +++ b/src/detection/chassis/chassis.h @@ -9,5 +9,5 @@ typedef struct FFChassisResult FFstrbuf version; } FFChassisResult; -const char* ffDetectChassis(FFChassisResult* result, FFChassisOptions* options); +const char* ffDetectChassis(FFChassisResult* result); const char* ffChassisTypeToString(uint32_t type); diff --git a/src/detection/chassis/chassis_bsd.c b/src/detection/chassis/chassis_bsd.c index 54a84c7e9..c38b562c2 100644 --- a/src/detection/chassis/chassis_bsd.c +++ b/src/detection/chassis/chassis_bsd.c @@ -2,7 +2,7 @@ #include "common/settings.h" #include "util/smbiosHelper.h" -const char* ffDetectChassis(FFChassisResult* result, FF_MAYBE_UNUSED FFChassisOptions* options) +const char* ffDetectChassis(FFChassisResult* result) { // Unlike other platforms, `smbios.chassis.type` return display string directly on my machine ffSettingsGetFreeBSDKenv("smbios.chassis.type", &result->type); diff --git a/src/detection/chassis/chassis_linux.c b/src/detection/chassis/chassis_linux.c index 8c050b859..9390169cf 100644 --- a/src/detection/chassis/chassis_linux.c +++ b/src/detection/chassis/chassis_linux.c @@ -4,7 +4,7 @@ #include -const char* ffDetectChassis(FFChassisResult* result, FF_MAYBE_UNUSED FFChassisOptions* options) +const char* ffDetectChassis(FFChassisResult* result) { ffGetSmbiosValue("/sys/devices/virtual/dmi/id/chassis_type", "/sys/class/dmi/id/chassis_type", &result->type); ffGetSmbiosValue("/sys/devices/virtual/dmi/id/chassis_vendor", "/sys/class/dmi/id/chassis_vendor", &result->vendor); diff --git a/src/detection/chassis/chassis_nosupport.c b/src/detection/chassis/chassis_nosupport.c index 6d83b90d1..c2acd7579 100644 --- a/src/detection/chassis/chassis_nosupport.c +++ b/src/detection/chassis/chassis_nosupport.c @@ -1,6 +1,6 @@ #include "chassis.h" -const char* ffDetectChassis(FF_MAYBE_UNUSED FFChassisResult* result, FF_MAYBE_UNUSED FFChassisOptions* options) +const char* ffDetectChassis(FF_MAYBE_UNUSED FFChassisResult* result) { return "Not supported on this platform"; } diff --git a/src/detection/chassis/chassis_windows.c b/src/detection/chassis/chassis_windows.c index 54dbad81f..707f4c3a9 100644 --- a/src/detection/chassis/chassis_windows.c +++ b/src/detection/chassis/chassis_windows.c @@ -18,7 +18,7 @@ typedef struct FFSmbiosSystemEnclosure uint8_t NumberOfPowerCords; } FFSmbiosSystemEnclosure; -const char* ffDetectChassis(FFChassisResult* result, FFChassisOptions* options) +const char* ffDetectChassis(FFChassisResult* result) { const FFRawSmbiosData* data = ffGetSmbiosData(); diff --git a/src/detection/host/host.h b/src/detection/host/host.h index eb236ccf8..1b0c61187 100644 --- a/src/detection/host/host.h +++ b/src/detection/host/host.h @@ -13,4 +13,4 @@ typedef struct FFHostResult FFstrbuf vendor; } FFHostResult; -const char* ffDetectHost(FFHostResult* host, FFHostOptions* options); +const char* ffDetectHost(FFHostResult* host); diff --git a/src/detection/host/host_android.c b/src/detection/host/host_android.c index e37202cb8..b496029a8 100644 --- a/src/detection/host/host_android.c +++ b/src/detection/host/host_android.c @@ -2,7 +2,7 @@ #include "common/settings.h" #include -const char* ffDetectHost(FFHostResult* host, FF_MAYBE_UNUSED FFHostOptions* options) +const char* ffDetectHost(FFHostResult* host) { // http://newandroidbook.com/ddb/ ffSettingsGetAndroidProperty("ro.product.device", &host->family); diff --git a/src/detection/host/host_apple.c b/src/detection/host/host_apple.c index 89f47f626..98910e5e8 100644 --- a/src/detection/host/host_apple.c +++ b/src/detection/host/host_apple.c @@ -201,7 +201,7 @@ const char* getOthersByIokit(FFHostResult* host) return NULL; } -const char* ffDetectHost(FFHostResult* host, FF_MAYBE_UNUSED FFHostOptions* options) +const char* ffDetectHost(FFHostResult* host) { const char* error = ffSysctlGetString("hw.model", &host->family); if (error) return error; diff --git a/src/detection/host/host_bsd.c b/src/detection/host/host_bsd.c index f662a9f28..334b04cab 100644 --- a/src/detection/host/host_bsd.c +++ b/src/detection/host/host_bsd.c @@ -2,7 +2,7 @@ #include "common/settings.h" #include "util/smbiosHelper.h" -const char* ffDetectHost(FFHostResult* host, FF_MAYBE_UNUSED FFHostOptions* options) +const char* ffDetectHost(FFHostResult* host) { ffSettingsGetFreeBSDKenv("smbios.system.product", &host->name); ffCleanUpSmbiosValue(&host->name); diff --git a/src/detection/host/host_linux.c b/src/detection/host/host_linux.c index 4c542f6b9..372557a88 100644 --- a/src/detection/host/host_linux.c +++ b/src/detection/host/host_linux.c @@ -27,7 +27,7 @@ static void getHostProductName(FFstrbuf* name) ffStrbufClear(name); } -const char* ffDetectHost(FFHostResult* host, FF_MAYBE_UNUSED FFHostOptions* options) +const char* ffDetectHost(FFHostResult* host) { ffGetSmbiosValue("/sys/devices/virtual/dmi/id/product_family", "/sys/class/dmi/id/product_family", &host->family); getHostProductName(&host->name); diff --git a/src/detection/host/host_windows.c b/src/detection/host/host_windows.c index 6b217fa99..6d382330d 100644 --- a/src/detection/host/host_windows.c +++ b/src/detection/host/host_windows.c @@ -20,7 +20,7 @@ typedef struct FFSmbiosSystemInfo uint8_t Family; } FFSmbiosSystemInfo; -const char* ffDetectHost(FFHostResult* host, FFHostOptions* options) +const char* ffDetectHost(FFHostResult* host) { const FFRawSmbiosData* fullData = ffGetSmbiosData(); diff --git a/src/modules/chassis/chassis.c b/src/modules/chassis/chassis.c index ad0b19570..1cb414f58 100644 --- a/src/modules/chassis/chassis.c +++ b/src/modules/chassis/chassis.c @@ -13,7 +13,7 @@ void ffPrintChassis(FFChassisOptions* options) ffStrbufInit(&result.vendor); ffStrbufInit(&result.version); - const char* error = ffDetectChassis(&result, options); + const char* error = ffDetectChassis(&result); if(error) { @@ -57,14 +57,6 @@ bool ffParseChassisCommandOptions(FFChassisOptions* options, const char* key, co if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs)) return true; - #ifdef _WIN32 - if (ffStrEqualsIgnCase(subKey, "use-wmi")) - { - options->useWmi = ffOptionParseBoolean(value); - return true; - } - #endif - return false; } @@ -81,14 +73,6 @@ void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module) if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) continue; - #ifdef _WIN32 - if (ffStrEqualsIgnCase(key, "useWmi")) - { - options->useWmi = yyjson_get_bool(val); - continue; - } - #endif - ffPrintError(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key); } } @@ -99,11 +83,6 @@ void ffGenerateChassisJsonConfig(FFChassisOptions* options, yyjson_mut_doc* doc, ffInitChassisOptions(&defaultOptions); ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs); - - #ifdef _WIN32 - if (options->useWmi != defaultOptions.useWmi) - yyjson_mut_obj_add_bool(doc, module, "useWmi", options->useWmi); - #endif } void ffGenerateChassisJsonResult(FF_MAYBE_UNUSED FFChassisOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) @@ -113,7 +92,7 @@ void ffGenerateChassisJsonResult(FF_MAYBE_UNUSED FFChassisOptions* options, yyjs ffStrbufInit(&result.vendor); ffStrbufInit(&result.version); - const char* error = ffDetectChassis(&result, options); + const char* error = ffDetectChassis(&result); if (error) { @@ -161,10 +140,6 @@ void ffInitChassisOptions(FFChassisOptions* options) ffGenerateChassisJsonConfig ); ffOptionInitModuleArg(&options->moduleArgs); - - #ifdef _WIN32 - options->useWmi = false; - #endif } void ffDestroyChassisOptions(FFChassisOptions* options) diff --git a/src/modules/chassis/option.h b/src/modules/chassis/option.h index 25d7cee65..de6338cd5 100644 --- a/src/modules/chassis/option.h +++ b/src/modules/chassis/option.h @@ -8,8 +8,4 @@ typedef struct FFChassisOptions { FFModuleBaseInfo moduleInfo; FFModuleArgs moduleArgs; - - #ifdef _WIN32 - bool useWmi; - #endif } FFChassisOptions; diff --git a/src/modules/host/host.c b/src/modules/host/host.c index 18a146378..5590b5c38 100644 --- a/src/modules/host/host.c +++ b/src/modules/host/host.c @@ -17,7 +17,7 @@ void ffPrintHost(FFHostOptions* options) ffStrbufInit(&host.uuid); ffStrbufInit(&host.vendor); - const char* error = ffDetectHost(&host, options); + const char* error = ffDetectHost(&host); if(error) { ffPrintError(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, "%s", error); @@ -76,14 +76,6 @@ bool ffParseHostCommandOptions(FFHostOptions* options, const char* key, const ch if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs)) return true; - #ifdef _WIN32 - if (ffStrEqualsIgnCase(subKey, "use-wmi")) - { - options->useWmi = ffOptionParseBoolean(value); - return true; - } - #endif - return false; } @@ -100,14 +92,6 @@ void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module) if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) continue; - #ifdef _WIN32 - if (ffStrEqualsIgnCase(key, "useWmi")) - { - options->useWmi = yyjson_get_bool(val); - continue; - } - #endif - ffPrintError(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key); } } @@ -118,11 +102,6 @@ void ffGenerateHostJsonConfig(FFHostOptions* options, yyjson_mut_doc* doc, yyjso ffInitHostOptions(&defaultOptions); ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs); - - #ifdef _WIN32 - if (options->useWmi != defaultOptions.useWmi) - yyjson_mut_obj_add_bool(doc, module, "useWmi", options->useWmi); - #endif } void ffGenerateHostJsonResult(FF_MAYBE_UNUSED FFHostOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) @@ -136,7 +115,7 @@ void ffGenerateHostJsonResult(FF_MAYBE_UNUSED FFHostOptions* options, yyjson_mut ffStrbufInit(&host.uuid); ffStrbufInit(&host.vendor); - const char* error = ffDetectHost(&host, options); + const char* error = ffDetectHost(&host); if (error) { yyjson_mut_obj_add_str(doc, module, "error", error); @@ -195,10 +174,6 @@ void ffInitHostOptions(FFHostOptions* options) ffGenerateHostJsonConfig ); ffOptionInitModuleArg(&options->moduleArgs); - - #ifdef _WIN32 - options->useWmi = false; - #endif } void ffDestroyHostOptions(FFHostOptions* options) diff --git a/src/modules/host/option.h b/src/modules/host/option.h index b305f2a92..1c6bf26f3 100644 --- a/src/modules/host/option.h +++ b/src/modules/host/option.h @@ -8,8 +8,4 @@ typedef struct FFHostOptions { FFModuleBaseInfo moduleInfo; FFModuleArgs moduleArgs; - - #ifdef _WIN32 - bool useWmi; - #endif } FFHostOptions;