Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/thunder/ctrlm_thunder_plugin_powermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() {

sem_wait(&this->semaphore);
if(this->call_plugin("getLastWakeupReason", (void *)&params, (void *)&response)) {
wakeup_reason_voice = (0 == strncmp(response["result"].String().c_str(), "VOICE", 5));
XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE");
XLOGD_INFO("result received <%s>", response["result"].String().c_str());
XLOGD_INFO("wakeupReason received <%s>", response["wakeupReason"].String().c_str());
wakeup_reason_voice = (std::string(response["result"].String()) == "VOICE");
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getLastWakeupReason response handling should validate expected labels before indexing. The inline curl example above shows the response contains only result (e.g., "COLDBOOT"), so unconditionally reading/logging response["wakeupReason"] risks logging misleading data (or returning an empty string) when that label isn’t present. Consider checking response.HasLabel("result") (and "wakeupReason" only if the plugin actually returns it) and treating a missing/unknown payload as a malformed response like get_power_state() does.

Copilot uses AI. Check for mistakes.
XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE");
} else {
XLOGD_ERROR("getLastWakeupReason call failed");
}
Expand Down
Loading