WindowsDevice: Silence missing property log spam

Don't log a warning in GetPropertyHelper when the property isn't
present. The function returns an optional, so any callers that want to
log a warning when nullopt is returned can do so themselves.

This prevents plugged-in devices (an Xbox One controller in my case)
from spamming the message "W[COMMON]: CM_Get_DevNode_Property returned:
37" twice per second (that value being CR_NO_SUCH_VALUE).
This commit is contained in:
Dentomologist 2025-10-13 11:55:12 -07:00
commit 4e359cf1c5

View file

@ -47,7 +47,8 @@ std::optional<std::wstring> GetPropertyHelper(auto function, auto dev,
if (const auto result = function(dev, requested_property, &type, nullptr, &buffer_size, 0);
result != CR_SUCCESS && result != CR_BUFFER_SMALL)
{
WARN_LOG_FMT(COMMON, "CM_Get_DevNode_Property returned: {}", result);
if (result != CR_NO_SUCH_VALUE)
WARN_LOG_FMT(COMMON, "CM_Get_DevNode_Property returned: {}", result);
return std::nullopt;
}
if (type != expected_type)