thermal-hal: Add support to monitor TZ_CREATE netlink notification
There are some thermal zones those can be created post thermal
hal initialization. It leads to a case where thermal zone
sensor init is failing due to configured sensor is not present
in available thermal zones. To avoid this issue, earlier added
a workaround to restart thermal-hal later.
thermal netlink protocol supports one event notification for
thermal zone creation. Add support to monitor thermal zone
creation event and re-initialize hal sensors.
Remove earlier workaround to restart hal service.
Change-Id: Id1aa6c3b08ada05f4c276d5b749e2c452a3fe2c6
diff --git a/thermalMonitorNetlink.h b/thermalMonitorNetlink.h
index 7ad87dd..7e42690 100644
--- a/thermalMonitorNetlink.h
+++ b/thermalMonitorNetlink.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -46,11 +47,13 @@
namespace implementation {
using eventMonitorCB = std::function<void(int, int)>;
+using eventCreateMonitorCB = std::function<void(int, const char *)>;
class ThermalMonitor {
public:
ThermalMonitor(const eventMonitorCB &inp_event_cb,
- const eventMonitorCB &inp_sample_cb);
+ const eventMonitorCB &inp_sample_cb,
+ const eventCreateMonitorCB &inp_event_create_cb);
~ThermalMonitor();
void parse_and_notify(char *inp_buf, ssize_t len);
@@ -68,6 +71,7 @@
int event_group, sample_group;
bool monitor_shutdown;
eventMonitorCB event_cb, sample_cb;
+ eventCreateMonitorCB event_create_cb;
int fetch_group_id();
int send_nl_msg(struct nl_msg *msg);