From deedbfbb55d0cc651e57d5e78598453a87f81d22 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 27 Jul 2020 11:50:08 +0000 Subject: Add thermal zone creation, destruction, enable and disable Signed-off-by: Daniel Lezcano --- thermal-event.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/thermal-event.c b/thermal-event.c index b7c208e..97091da 100644 --- a/thermal-event.c +++ b/thermal-event.c @@ -120,6 +120,42 @@ static int handle_event(struct nl_msg *n, void *arg) nla_get_string(attrs[THERMAL_GENL_ATTR_GOV_NAME])); } + if (genlhdr->cmd == THERMAL_GENL_EVENT_TZ_CREATE) { + printf("THERMAL_GENL_EVENT_TZ_CREATE\n"); + + if (attrs[THERMAL_GENL_ATTR_TZ_ID]) + printf("Thermal zone id %d\n", + nla_get_u32(attrs[THERMAL_GENL_ATTR_TZ_ID])); + + if (attrs[THERMAL_GENL_ATTR_TZ_NAME]) + printf("Thermal zone name %s\n", + nla_get_string(attrs[THERMAL_GENL_ATTR_TZ_NAME])); + } + + if (genlhdr->cmd == THERMAL_GENL_EVENT_TZ_DELETE) { + printf("THERMAL_GENL_EVENT_TZ_DELETE\n"); + + if (attrs[THERMAL_GENL_ATTR_TZ_ID]) + printf("Thermal zone id %d\n", + nla_get_u32(attrs[THERMAL_GENL_ATTR_TZ_ID])); + } + + if (genlhdr->cmd == THERMAL_GENL_EVENT_TZ_DISABLE) { + printf("THERMAL_GENL_EVENT_TZ_DISABLE\n"); + + if (attrs[THERMAL_GENL_ATTR_TZ_ID]) + printf("Thermal zone id %d\n", + nla_get_u32(attrs[THERMAL_GENL_ATTR_TZ_ID])); + } + + if (genlhdr->cmd == THERMAL_GENL_EVENT_TZ_ENABLE) { + printf("THERMAL_GENL_EVENT_TZ_ENABLE\n"); + + if (attrs[THERMAL_GENL_ATTR_TZ_ID]) + printf("Thermal zone id %d\n", + nla_get_u32(attrs[THERMAL_GENL_ATTR_TZ_ID])); + } + if (genlhdr->cmd == THERMAL_GENL_EVENT_TZ_TRIP_CHANGE) { printf("THERMAL_GENL_EVENT_TZ_TRIP_CHANGE\n"); -- cgit v1.2.3