find-voice-call-profile: don't skip profiles with "unknown" availability

While testing this script I've found out that all profiles on my device
have "unknown" availablility rather than "yes", so they were skipped.
Fix by changing the check to not-"no".

While here, add more debug logging that would've helped debug this,
and fix the indentation on one line where it was off.
This commit is contained in:
Val Packett 2026-05-14 04:55:01 -03:00
parent 0e8a6706e6
commit 1282903e0d

View file

@ -61,10 +61,13 @@ SimpleEventHook {
for p in device:iterate_params ("EnumProfile") do
local profile = cutils.parseParam (p, "EnumProfile")
log:debug (device, string.format (
"Checking profile '%s': available == %s, priority == %d",
profile.name, profile.available, profile.priority))
local found = string.find (profile.name, "^Voice Call")
if profile.available == "yes" and found ~= nil then
if profile.available ~= "no" and found ~= nil then
if (not selected_profile) or selected_profile.priority < profile.priority then
selected_profile = profile
selected_profile = profile
end
end
end