libdsme-0.64.1+15.10.20150929/0000755000015300001610000000000012602562613015565 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/rpm/0000755000015300001610000000000012602562613016363 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/rpm/libdsme.changes0000644000015300001610000000221312602561673021337 0ustar pbuserpbgroup00000000000000* Thu Nov 15 2012 Pekka Lundstrom - 0.61.7 - Added default location to dsme socket (/run/dsme.socket) Fixes NEMO#571 : dsme socket should be defined in libdsme properly - Git location moved to https://github.com/nemomobile/libdsme Fixes NEMO#574 : git location for libdsme should be same as for dsme * Wed Nov 02 2011 Marko Saukko - 0.61.6 - Updated to 0.61.6 * Tue Dec 21 2010 Markus Lehtonen - 0.61.4 - Change RPM group tag in .spec according to MeeGo Domain/Subsystem view * Tue Oct 26 2010 Markus Lehtonen - 0.61.4 - LD_AS_NEEDED=0 to fix broken symbol resolving in linker time -> fixes dependencies - Added URL to yaml/spec * Mon Jun 21 2010 Anas Nashif - 0.61.4 - Use spectacle * Sat May 29 2010 Markus Lehtonen - 0.61.4 - Version bump to 0.61.4 * Mon May 17 2010 Sami Sirkia - 0.60.x - Updated to most recent untagged version from gitorious * Tue Mar 30 2010 Sami Sirkia - 0.60.x - Initial release of libdsme for n900. libdsme-0.64.1+15.10.20150929/rpm/libdsme.spec0000644000015300001610000000322712602561673020667 0ustar pbuserpbgroup00000000000000Name: libdsme Summary: DSME dsmesock dynamic library Version: 0.64.1 Release: 0 Group: System/System Control License: LGPL URL: https://github.com/nemomobile/libdsme Source0: %{name}-%{version}.tar.bz2 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(check) %description This package contains dynamic libraries for programs that communicate with the Device State Management Entity. %package devel Summary: Development files for dsme Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel This package contains headers and static libraries needed to develop programs that want to communicate with the Device State Management Entity. %package tests Summary: Test suite for dsme Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description tests This package contains test suite for libdsme. %prep %setup -q -n %{name}-%{version} %build ./verify_version unset LD_AS_NEEDED make %{?jobs:-j%jobs} %install rm -rf %{buildroot} %make_install %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,-) %{_libdir}/libdsme.so.* %{_libdir}/libdsme_dbus_if.so.* %{_libdir}/libthermalmanager_dbus_if.so.* %doc debian/copyright %doc COPYING %files devel %defattr(-,root,root,-) %dir %{_includedir}/dsme %{_includedir}/dsme/* %{_libdir}/libdsme.so %{_libdir}/libdsme_dbus_if.so %{_libdir}/libthermalmanager_dbus_if.so %dir %{_libdir}/pkgconfig %{_libdir}/pkgconfig/* %files tests %defattr(-,root,root,-) %dir /opt %dir /opt/tests %dir /opt/tests/libdsme /opt/tests/libdsme/* libdsme-0.64.1+15.10.20150929/Makefile0000644000015300001610000001130212602561673017227 0ustar pbuserpbgroup00000000000000# Package version VERSION := 0.64.1 # Shared object version SOMAJOR := .0 SOMINOR := .3 SORELEASE := .0 SOLINK := .so SONAME := .so$(SOMAJOR) SOVERS := .so$(SOMAJOR)$(SOMINOR)$(SORELEASE) # Files to build / install TARGETS_LIB += libdsme.a TARGETS_DSO += libdsme$(SOVERS) TARGETS_DSO += libdsme_dbus_if$(SOVERS) TARGETS_DSO += libthermalmanager_dbus_if$(SOVERS) INSTALL_HDR += include/dsme/protocol.h INSTALL_HDR += include/dsme/messages.h INSTALL_HDR += include/dsme/alarm_limit.h INSTALL_HDR += include/dsme/processwd.h INSTALL_HDR += include/dsme/state.h INSTALL_HDR += include/dsme/state_states.h INSTALL_HDR += modules/dsme_dbus_if.h INSTALL_HDR += modules/thermalmanager_dbus_if.h INSTALL_PC += dsme.pc INSTALL_PC += dsme_dbus_if.pc INSTALL_PC += thermalmanager_dbus_if.pc TARGETS_UT_BIN += tests/ut_libdsme INSTALL_UT_XML += tests/tests.xml TARGETS_ALL += $(TARGETS_LIB) $(TARGETS_DSO) $(TARGETS_UT_BIN) # Dummy default install dir - override from packaging scripts DESTDIR ?= /tmp/libdsme-test-install # ---------------------------------------------------------------------------- # Top level targets # ---------------------------------------------------------------------------- .PHONY: build install clean distclean mostlyclean build:: $(TARGETS_ALL) install:: build clean:: mostlyclean $(RM) $(TARGETS_ALL) distclean:: clean mostlyclean:: $(RM) *.o *~ */*.o */*~ install :: install_main install_devel install_tests install_main:: # dynamic libraries install -d -m 755 $(DESTDIR)/usr/lib install -m 644 $(TARGETS_DSO) $(DESTDIR)/usr/lib install_devel:: # headers install -d -m 755 $(DESTDIR)/usr/include/dsme install -m 644 $(INSTALL_HDR) $(DESTDIR)/usr/include/dsme # pkg config install -d -m 755 $(DESTDIR)/usr/lib/pkgconfig install -m 644 $(INSTALL_PC) $(DESTDIR)/usr/lib/pkgconfig # static libraries install -d -m 755 $(DESTDIR)/usr/lib install -m 644 $(TARGETS_LIB) $(DESTDIR)/usr/lib # symlinks for dynamic linking for f in $(TARGETS_DSO); do \ ln -sf $$(basename $$f $(SOVERS))$(SONAME) \ $(DESTDIR)/usr/lib/$$(basename $$f $(SOVERS))$(SOLINK); \ done install_tests:: # xml install -d -m 755 $(DESTDIR)/opt/tests/libdsme install -m644 $(INSTALL_UT_XML) $(DESTDIR)/opt/tests/libdsme # binary install -m755 $(TARGETS_UT_BIN) $(DESTDIR)/opt/tests/libdsme # ---------------------------------------------------------------------------- # Build rules # ---------------------------------------------------------------------------- %.pic.o : %.c ; $(CC) -o $@ -c $< -fPIC $(CPPFLAGS) $(CFLAGS) %.o : %.c ; $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) %$(SOVERS) : ; $(CC) -o $@ -shared -Wl,-soname,$*$(SONAME) $^ $(LDFLAGS) $(LDLIBS) % : %.o ; $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) %.a : ; $(AR) ru $@ $^ # ---------------------------------------------------------------------------- # Common options # ---------------------------------------------------------------------------- CFLAGS += -O2 CFLAGS += -Wall -Wwrite-strings -Wmissing-prototypes -Werror CFLAGS += -g LDFLAGS += -g LDFLAGS += -Wl,--as-needed # ---------------------------------------------------------------------------- # libdsme$(SOVERS) and libdsme.a # ---------------------------------------------------------------------------- libdsme_OBJ += protocol.pic.o message.pic.o alarm_limit.pic.o libdsme_PC += glib-2.0 libdsme$(SOVERS) : CFLAGS += $$(pkg-config --cflags $(libdsme_PC)) libdsme$(SOVERS) : LDLIBS += $$(pkg-config --libs $(libdsme_PC)) libdsme$(SOVERS) : $(libdsme_OBJ) libdsme.a : CFLAGS += $$(pkg-config --cflags $(libdsme_PC)) libdsme.a : $(patsubst %.pic.o, %.o, $(libdsme_OBJ)) # ---------------------------------------------------------------------------- # libdsme_dbus_if$(SOVERS) # ---------------------------------------------------------------------------- libdsme_dbus_if_OBJ += modules/dsme_dbus_if.pic.o libdsme_dbus_if$(SOVERS) : $(libdsme_dbus_if_OBJ) # ---------------------------------------------------------------------------- # libthermalmanager_dbus_if$(SOVERS) # ---------------------------------------------------------------------------- libthermalmanager_dbus_if_OBJ += modules/thermalmanager_dbus_if.pic.o libthermalmanager_dbus_if$(SOVERS) : $(libthermalmanager_dbus_if_OBJ) # ---------------------------------------------------------------------------- # ut_libdsme # ---------------------------------------------------------------------------- ut_libdsme_OBJ += tests/ut_libdsme.o ut_libdsme_PC += glib-2.0 check tests/ut_libdsme : CFLAGS += $$(pkg-config --cflags $(ut_libdsme_PC)) tests/ut_libdsme : LDLIBS += $$(pkg-config --libs $(ut_libdsme_PC)) tests/ut_libdsme : $(ut_libdsme_OBJ) libdsme$(SOVERS) libdsme-0.64.1+15.10.20150929/message.c0000644000015300001610000000227012602561673017363 0ustar pbuserpbgroup00000000000000/** @file message.c Implements DSME message methods.

Copyright (C) 2004-2009 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #include "include/dsme/messages.h" #include void* dsmemsg_new(u_int32_t id, size_t size, size_t extra) { dsmemsg_generic_t* msg = (dsmemsg_generic_t*)calloc(1, size + extra); if (msg == NULL) { /* TODO */ exit(EXIT_FAILURE); } msg->line_size_ = size + extra; msg->size_ = size; msg->type_ = id; return msg; } u_int32_t dsmemsg_id(const dsmemsg_generic_t* msg) { return msg->type_; } libdsme-0.64.1+15.10.20150929/include/0000755000015300001610000000000012602562613017210 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/include/dsme/0000755000015300001610000000000012602562613020140 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/include/dsme/state_states.h0000644000015300001610000000225312602561673023023 0ustar pbuserpbgroup00000000000000/** @file state_states.h DSME state definitions

Copyright (C) 2009 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ DSME_STATE(NOT_SET, -1) DSME_STATE(SHUTDOWN, 0) /* runlevel 0 or reboot(POWEROFF) */ DSME_STATE(USER, 2) /* runlevel 2 */ DSME_STATE(ACTDEAD, 5) /* runlevel 5 */ DSME_STATE(REBOOT, 6) /* runlevel 6 or reboot(REBOOT) */ DSME_STATE(TEST, 7) /* runlevel 3: test server is started */ DSME_STATE(MALF, 8) /* state if something goes wrong */ DSME_STATE(BOOT, 9) // TODO: remove DSME_STATE(LOCAL, 10) // TODO: remove libdsme-0.64.1+15.10.20150929/include/dsme/processwd.h0000644000015300001610000000353612602561673022336 0ustar pbuserpbgroup00000000000000/** @file processwd.h SW watchdog messages for DSME

Copyright (C) 2004-2009 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_PROCESSWD_H #define DSME_PROCESSWD_H #include "dsme/messages.h" enum { DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_CREATE, 0x000000500), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_DELETE, 0x000000501), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_CLEAR, 0x000000502), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_SET_INTERVAL, 0x000000503), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_PING, 0x000000504), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_PONG, 0x000000504), DSME_MSG_ENUM(DSM_MSGTYPE_PROCESSWD_MANUAL_PING, 0x000000505), }; /** Specific message type that is used to request sw watchdog @ingroup message_if */ typedef struct { DSMEMSG_PRIVATE_FIELDS pid_t pid; } DSM_MSGTYPE_PROCESSWD_PING; typedef DSM_MSGTYPE_PROCESSWD_PING DSM_MSGTYPE_PROCESSWD_PONG; typedef DSM_MSGTYPE_PROCESSWD_PING DSM_MSGTYPE_PROCESSWD_CREATE; typedef DSM_MSGTYPE_PROCESSWD_PING DSM_MSGTYPE_PROCESSWD_DELETE; typedef dsmemsg_generic_t DSM_MSGTYPE_PROCESSWD_MANUAL_PING; typedef struct { DSMEMSG_PRIVATE_FIELDS u_int32_t timeout; } DSM_MSGTYPE_PROCESSWD_SET_INTERVAL; #endif libdsme-0.64.1+15.10.20150929/include/dsme/state.h0000644000015300001610000000675512602561673021453 0ustar pbuserpbgroup00000000000000/** @file state.h This file has defines for state module in DSME.

Copyright (C) 2004-2009 Nokia Corporation. @author Ismo Laitinen @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_STATE_H #define DSME_STATE_H #ifndef __cplusplus #define _GNU_SOURCE #endif #include "messages.h" #include /** @ingroup state States in state-module. */ typedef enum { #define DSME_STATE(STATE, VALUE) DSME_STATE_ ## STATE = VALUE, #include "state_states.h" #undef DSME_STATE } dsme_state_t; typedef struct { DSMEMSG_PRIVATE_FIELDS dsme_state_t state; } DSM_MSGTYPE_STATE_CHANGE_IND; typedef struct { DSMEMSG_PRIVATE_FIELDS } DSM_MSGTYPE_SHUTDOWN_REQ; typedef struct { DSMEMSG_PRIVATE_FIELDS dsme_state_t state; } DSM_MSGTYPE_STATE_REQ_DENIED_IND; typedef dsmemsg_generic_t DSM_MSGTYPE_STATE_QUERY; typedef dsmemsg_generic_t DSM_MSGTYPE_SAVE_DATA_IND; typedef dsmemsg_generic_t DSM_MSGTYPE_THERMAL_SHUTDOWN_IND; typedef dsmemsg_generic_t DSM_MSGTYPE_REBOOT_REQ; typedef dsmemsg_generic_t DSM_MSGTYPE_POWERUP_REQ; typedef dsmemsg_generic_t DSM_MSGTYPE_BATTERY_EMPTY_IND; enum { DSME_MSG_ENUM(DSM_MSGTYPE_STATE_CHANGE_IND, 0x00000301), DSME_MSG_ENUM(DSM_MSGTYPE_STATE_QUERY, 0x00000302), DSME_MSG_ENUM(DSM_MSGTYPE_SAVE_DATA_IND, 0x00000304), DSME_MSG_ENUM(DSM_MSGTYPE_POWERUP_REQ, 0x00000305), DSME_MSG_ENUM(DSM_MSGTYPE_SHUTDOWN_REQ, 0x00000306), DSME_MSG_ENUM(DSM_MSGTYPE_REBOOT_REQ, 0x00000308), DSME_MSG_ENUM(DSM_MSGTYPE_STATE_REQ_DENIED_IND, 0x00000309), DSME_MSG_ENUM(DSM_MSGTYPE_THERMAL_SHUTDOWN_IND, 0x00000310), DSME_MSG_ENUM(DSM_MSGTYPE_BATTERY_EMPTY_IND, 0x00000315), }; typedef struct { DSMEMSG_PRIVATE_FIELDS bool alarm_set; } DSM_MSGTYPE_SET_ALARM_STATE; typedef struct { DSMEMSG_PRIVATE_FIELDS bool connected; } DSM_MSGTYPE_SET_CHARGER_STATE; typedef struct { DSMEMSG_PRIVATE_FIELDS bool ongoing; } DSM_MSGTYPE_SET_EMERGENCY_CALL_STATE; typedef struct { DSMEMSG_PRIVATE_FIELDS bool empty; } DSM_MSGTYPE_SET_BATTERY_STATE; typedef enum { DSM_THERMAL_STATUS_NORMAL = 0, DSM_THERMAL_STATUS_LOWTEMP = 1, DSM_THERMAL_STATUS_OVERHEATED = 2 } dsme_thermal_status_t; #define DSM_TEMP_SENSOR_MAX_NAME_LEN 32 typedef struct { DSMEMSG_PRIVATE_FIELDS dsme_thermal_status_t status; int temperature; char sensor_name[DSM_TEMP_SENSOR_MAX_NAME_LEN]; } DSM_MSGTYPE_SET_THERMAL_STATUS; enum { DSME_MSG_ENUM(DSM_MSGTYPE_SET_ALARM_STATE, 0x00000307), DSME_MSG_ENUM(DSM_MSGTYPE_SET_CHARGER_STATE, 0x00000311), /* DSME_MSG_ENUM(DSM_MSGTYPE_SET_THERMAL_STATE, 0x00000312), not used anymore */ DSME_MSG_ENUM(DSM_MSGTYPE_SET_EMERGENCY_CALL_STATE, 0x00000313), /* D. Duck */ DSME_MSG_ENUM(DSM_MSGTYPE_SET_BATTERY_STATE, 0x00000314), DSME_MSG_ENUM(DSM_MSGTYPE_SET_THERMAL_STATUS, 0x00000315), }; #endif libdsme-0.64.1+15.10.20150929/include/dsme/protocol.h0000644000015300001610000001036512602561673022164 0ustar pbuserpbgroup00000000000000/** @file protocol.h This file defines needed structures and prototypes of needed function for using dsme socket.

Copyright (C) 2004-2009 Nokia Corporation. @author Ari Saastamoinen @author Tuukka Tikkanen @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_PROTOCOL_H #define DSME_PROTOCOL_H /* * some glibc versions seems to mistakenly define ucred behind __USE_GNU; * work around by #defining _GNU_SOURCE */ #ifndef __cplusplus #define _GNU_SOURCE #endif #include #include #ifndef EXTERN_C #ifdef __cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C #endif #endif /** * @defgroup dsmesock DSMEsock library */ /** * @defgroup dsmesock_client DSMEsock client interface * @ingroup dsmesock */ // TODO: ugly forward declaration due to broken glib.h; // remove it when dsmesock_connection_t is made opaque // (see arch ticket #230: // https://maemo.research.nokia.com/archtool/ticket/230) struct _GIOChannel; /** DSME socket internal information. @ingroup dsmesock_client */ typedef struct dsmesock_connection_t { int is_open; int fd; unsigned char* buf; unsigned long bufsize; unsigned long bufused; struct ucred ucred; struct _GIOChannel* channel; } dsmesock_connection_t; /* * Function prototypes */ /** Creates connection to DSME. The client opening a socket must be ready to receive messages from the socket e.g. using a select() and then dsmesock_receive() when data is available. The received message must be also free()'ed after use. @ingroup dsmesock_client @return pointer to connection structure. */ EXTERN_C dsmesock_connection_t* dsmesock_connect(void); /** Creates connection structure for an existing socket. The socket is put to nonblocking mode. @ingroup dsmesock_client @param fd File handle for the socket. @return connection structure. */ EXTERN_C dsmesock_connection_t* dsmesock_init(int fd); /** Receives data from connection. @ingroup dsmesock_client @param conn Connection to be read. @return pointer to received message. */ EXTERN_C void* dsmesock_receive(dsmesock_connection_t* conn); /** Sends message to an other end of the dsmesock connection. Does not free the message. @ingroup dsmesock_client @param conn Destination connection. @param msg Pointer to message to be sent. @return Number of bytes sent, or -1 on error. */ EXTERN_C int dsmesock_send(dsmesock_connection_t* conn, const void* msg); EXTERN_C int dsmesock_send_with_extra(dsmesock_connection_t* conn, const void* msg, size_t extra_size, const void* extra); /** Sends message to all dsmesock client connections. @ingroup message_if @param msg Pointer to message to be sent. */ EXTERN_C void dsmesock_broadcast(const void* msg); EXTERN_C void dsmesock_broadcast_with_extra(const void* msg, size_t extra_size, const void* extra); /** Closes connection @ingroup dsmesock_client @param conn Connection to be closed. */ EXTERN_C void dsmesock_close(dsmesock_connection_t* conn); /** Retrieves peer credentials of the connection. @ingroup dsmesock_client @param conn Connection @return pointer to @c ucred structure. */ EXTERN_C const struct ucred* dsmesock_getucred(dsmesock_connection_t* conn); /** Holds path to dsme socket default location */ EXTERN_C const char* dsmesock_default_location; #endif libdsme-0.64.1+15.10.20150929/include/dsme/messages.h0000644000015300001610000001003712602561673022126 0ustar pbuserpbgroup00000000000000/** @file messages.h Message type definitions for DSME.

Copyright (C) 2004-2009 Nokia Corporation. @author Ari Saastamoinen @author Ismo Laitinen @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_MESSAGES_H #define DSME_MESSAGES_H #include #include #ifdef __cplusplus extern "C" { #endif #define DSME_MSG_NEW(T) \ (T*)dsmemsg_new(DSME_MSG_ID_(T), sizeof(T), 0) #define DSME_MSG_NEW_WITH_EXTRA(T, E) \ (T*)dsmemsg_new(DSME_MSG_ID_(T), sizeof(T), (E)) #ifdef __cplusplus #define DSME_MSG_INIT(T) \ (T){ \ /* line_size_ = */ sizeof(T), \ /* size_ = */ sizeof(T), \ /* type_ = */ DSME_MSG_ID_(T) \ } #else #define DSME_MSG_INIT(T) \ (T){ \ .line_size_ = sizeof(T), \ .size_ = sizeof(T), \ .type_ = DSME_MSG_ID_(T) \ } #endif #define DSME_MSG_ID_(T) T ## _ID_ #define DSME_MSG_ENUM(T, ID) DSME_MSG_ID_(T) = ID /* TODO: either rename DSMEMSG->DSME_MSG or DSME_MSG->DSMEMSG */ #define DSMEMSG_EXTRA(M) \ (((const dsmemsg_generic_t*)(M))->line_size_ - \ ((const dsmemsg_generic_t*)(M))->size_ > 0 ? \ (void*)(((char*)(M)) + ((const dsmemsg_generic_t*)(M))->size_) : \ (void*)0) #define DSMEMSG_EXTRA_SIZE(M) \ (((const dsmemsg_generic_t*)(M))->line_size_ - \ ((const dsmemsg_generic_t*)(M))->size_ > 0 ? \ ((const dsmemsg_generic_t*)(M))->line_size_ - \ ((const dsmemsg_generic_t*)(M))->size_ : \ 0) #define DSMEMSG_CAST(T, M) \ ((((const dsmemsg_generic_t*)(M))->size_ == sizeof(T)) ? \ (((const dsmemsg_generic_t*)(M))->type_ == DSME_MSG_ID_(T) ? \ (T*)(M) : 0) : 0) /** * @defgroup message_if Message passing interface for modules * In addition to these functions, dsmesock_send() can be used from modules. */ #define DSMEMSG_PRIVATE_FIELDS \ u_int32_t line_size_; \ u_int32_t size_; \ u_int32_t type_; /** Generic message type @ingroup message_if */ typedef struct dsmemsg_generic_t { DSMEMSG_PRIVATE_FIELDS } dsmemsg_generic_t; /** Specific message type that is sent when socket is closed @ingroup message_if */ typedef struct { DSMEMSG_PRIVATE_FIELDS u_int8_t reason; } DSM_MSGTYPE_CLOSE; /** Close reasons @ingroup dsmesock_client */ enum { TSMSG_CLOSE_REASON_OOS = 0, /* Protocol out of sync (local) */ TSMSG_CLOSE_REASON_EOF = 1, /* EOF read from socket (local) */ TSMSG_CLOSE_REASON_REQ = 2, /* Peer requests close */ TSMSG_CLOSE_REASON_ERR = 3 /* Undefined error conditions or read after close */ }; typedef dsmemsg_generic_t DSM_MSGTYPE_GET_VERSION; typedef dsmemsg_generic_t DSM_MSGTYPE_DSME_VERSION; /* TA stands for Type Approval: */ typedef dsmemsg_generic_t DSM_MSGTYPE_SET_TA_TEST_MODE; enum { /* DSME Protocol messages 000000xx */ DSME_MSG_ENUM(DSM_MSGTYPE_CLOSE, 0x00000001), /* misc */ DSME_MSG_ENUM(DSM_MSGTYPE_GET_VERSION, 0x00001100), DSME_MSG_ENUM(DSM_MSGTYPE_DSME_VERSION, 0x00001101), DSME_MSG_ENUM(DSM_MSGTYPE_SET_TA_TEST_MODE, 0x00001102), }; void* dsmemsg_new(u_int32_t id, size_t size, size_t extra); u_int32_t dsmemsg_id(const dsmemsg_generic_t* msg); #ifdef __cplusplus } #endif #endif libdsme-0.64.1+15.10.20150929/include/dsme/alarm_limit.h0000644000015300001610000000215312602561673022611 0ustar pbuserpbgroup00000000000000/** @file alarm_limit.h Alarm limit definitions for DSME.

Copyright (C) 2011 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_ALARM_LIMIT_H #define DSME_ALARM_LIMIT_H #ifndef EXTERN_C #ifdef __cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C #endif #endif /** Function returns the maximum time to next alarm that will make dsme convert a shutdown to actdead. @return SNOOZE_TIMEOUT */ EXTERN_C int dsme_snooze_timeout_in_seconds(void); #endif libdsme-0.64.1+15.10.20150929/verify_version0000755000015300001610000000324512602561673020575 0ustar pbuserpbgroup00000000000000#!/bin/sh # Check that all files that should have the current version agree on it # Makefile has the version that other sources must match MASTER_PATH=Makefile MASTER_VERS=$(grep '^VERSION.*:=' $MASTER_PATH |sed -e 's/^.*:=[[:space:]]*//') # Assume success RES=0 # Check debian/changelog (only warn on mismatch) DEB_PATH=debian/changelog DEB_VERS=$(head -1 $DEB_PATH | sed -e 's/^.*(//' -e 's/).*$//') if [ "$DEB_VERS" != "$MASTER_VERS" ]; then echo >&2 "$MASTER_PATH $MASTER_VERS vs $DEB_PATH $DEB_VERS (ignored)" fi # Check rpm/libdsme.rpm RPM_PATH=${RPM_SOURCE_DIR:-rpm}/${RPM_PACKAGE_NAME:-libdsme}.spec RPM_VERS=$(grep '^Version:' $RPM_PATH |sed -e 's/^.*:[[:space:]]*//') # Remove initial part of rpm version that equals with version from Makefile RPM_XTRA=${RPM_VERS#$MASTER_VERS} # From that remove initial part that equals with version from spec-file RPM_XTRA=${RPM_XTRA#$RPM_VERS} # If the result is non-empty string, then OBS is doing # delta-after-matching-tag kind of build, which is ok. # But empty string means that spec and Makefile are completely # out of sync, which is bad. if [ "$RPM_VERS" != "$MASTER_VERS" ]; then if [ -z "$RPM_XTRA" ]; then echo >&2 "$MASTER_PATH $MASTER_VERS vs $RPM_PATH $RPM_VERS" RES=1 else echo "(ignoring patch level in spec file: $RPM_XTRA)" fi fi # Check pkgconfig files for PC_PATH in dsme.pc dsme_dbus_if.pc thermalmanager_dbus_if.pc; do PC_VERS=$(grep '^Version:' $PC_PATH |sed -e 's/^.*:[[:space:]]*//') if [ "$PC_VERS" != "$MASTER_VERS" ]; then echo >&2 "$MASTER_PATH $MASTER_VERS vs $PC_PATH $PC_VERS" RES=1 fi done # Done if [ $RES -ne 0 ]; then echo >&2 "Conflicting package versions" fi exit $RES libdsme-0.64.1+15.10.20150929/thermalmanager_dbus_if.pc0000644000015300001610000000036612602561673022605 0ustar pbuserpbgroup00000000000000prefix=/usr includedir=${prefix}/include libdir=${prefix}/lib Name: thermalmanager_dbus_if Description: Thermal Manager D-Bus interface dynamic library Version: 0.64.1 Requires: Libs: -L${libdir} -lthermalmanager_dbus_if Cflags: -I${includedir} libdsme-0.64.1+15.10.20150929/protocol.c0000644000015300001610000002117412602561673017604 0ustar pbuserpbgroup00000000000000/** @file protocol.c Implementation of DSME socket communication.

Copyright (C) 2004-2009 Nokia Corporation. @author Ari Saastamoinen @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef __cplusplus #define _GNU_SOURCE #endif #include "include/dsme/protocol.h" #include "include/dsme/messages.h" #include #include #include #include #include #include #include #include #include #include static GSList* connections = 0; const char* dsmesock_default_location = "/run/dsme.socket"; dsmesock_connection_t* dsmesock_connect(void) { dsmesock_connection_t* ret = 0; int fd; struct sockaddr_un c_addr; const char* dsmesock_filename = NULL; dsmesock_filename = getenv("DSME_SOCKFILE"); if (dsmesock_filename == 0 || *dsmesock_filename == '\0') { dsmesock_filename = dsmesock_default_location; } if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) != -1) { memset(&c_addr, 0, sizeof(c_addr)); c_addr.sun_family = AF_UNIX; strcpy(c_addr.sun_path, dsmesock_filename); if (connect(fd, (struct sockaddr *)&c_addr, sizeof(c_addr)) == -1 || (ret = dsmesock_init(fd)) == 0) { close(fd); fd = -1; } } if (fd != -1) { struct linger linger; linger.l_onoff = 1; linger.l_linger = 2; setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); } return ret; } dsmesock_connection_t* dsmesock_init(int fd) { dsmesock_connection_t* newconn; if (fd == -1) return 0; if(-1 == fcntl(fd, F_SETFL, O_NONBLOCK)) return 0; newconn = (dsmesock_connection_t*)malloc(sizeof(dsmesock_connection_t)); if (newconn == 0) return 0; memset(newconn, 0, sizeof(dsmesock_connection_t)); newconn->fd = fd; newconn->is_open = 1; newconn->channel = 0; connections = g_slist_prepend(connections, newconn); return newconn; } void* dsmesock_receive(dsmesock_connection_t* conn) { #define DSMESOCK_BUF_SIZE_DEFAULT 1024 #define DSMESOCK_BUF_SIZE_MAX 65536 socklen_t optlen; ssize_t ret = 1; int read_size; DSM_MSGTYPE_CLOSE* ret_close; unsigned close_reason; void* result; GSList* node; /* Is this connection valid? */ node = g_slist_find(connections, conn); if (node == 0 || conn->is_open == 0) { close_reason = TSMSG_CLOSE_REASON_ERR; goto return_close_reason; } optlen = sizeof(conn->ucred); if(getsockopt(conn->fd, SOL_SOCKET, SO_PEERCRED, &conn->ucred, &optlen) == -1) { /* that fails, fill some bogus values */ conn->ucred.pid = 0; conn->ucred.uid = -1; conn->ucred.gid = -1; } /* Allocate buffer if necessary */ if (conn->bufsize == 0 || conn->buf == 0) { /* Begin with 1k buffer (more than enough for most purposes) */ conn->buf = (unsigned char*)malloc(DSMESOCK_BUF_SIZE_DEFAULT); if (conn->buf == 0) return 0; conn->bufused = 0; conn->bufsize = DSMESOCK_BUF_SIZE_DEFAULT; } /* read message header */ while (conn->bufused < sizeof(dsmemsg_generic_t)) { read_size = sizeof(dsmemsg_generic_t) - conn->bufused; if ((ret = read(conn->fd, conn->buf+conn->bufused, read_size)) <= 0) { break; } conn->bufused += ret; } /* read message body (if any) */ if (conn->bufused >= sizeof(dsmemsg_generic_t)) { dsmemsg_generic_t* msg = (dsmemsg_generic_t*)conn->buf; if (msg->line_size_ <= DSMESOCK_BUF_SIZE_MAX) { /* increase buffer if necessary */ if (conn->bufsize < msg->line_size_) { unsigned char* newbuf = (unsigned char*)realloc(conn->buf, msg->line_size_); if (newbuf == 0) return 0; /* Try again later */ conn->buf = newbuf; conn->bufsize = msg->line_size_; } while (conn->bufused < msg->line_size_) { read_size = msg->line_size_ - conn->bufused; if ((ret = read(conn->fd, conn->buf+conn->bufused, read_size)) <= 0) { break; } conn->bufused += ret; } } } /* deal with errors */ if (ret == 0) { /* Connection closed by remote */ close_reason = TSMSG_CLOSE_REASON_EOF; goto discard_and_return_close_reason; } else if (ret < 0) { /* TODO: IS IT OK TO LEAVE RETRY TO THE CALLER? */ if (errno == EWOULDBLOCK) return 0; /* Ok, no data available */ if (errno == EINTR) return 0; /* Got signal. retry (later) */ /* Error encountered. Free up resources and report close. */ close_reason = TSMSG_CLOSE_REASON_ERR; goto discard_and_return_close_reason; } else if (conn->bufused < sizeof(dsmemsg_generic_t) || ((dsmemsg_generic_t*)conn->buf)->line_size_ > DSMESOCK_BUF_SIZE_MAX) { /* too short or long message; assume out-of-sync situation */ close_reason = TSMSG_CLOSE_REASON_OOS; goto discard_and_return_close_reason; } /* success; detach the buffer from connection context and return it */ result = conn->buf; conn->buf = 0; conn->bufsize = 0; conn->bufused = 0; return result; /* error cases */ discard_and_return_close_reason: conn->is_open = 0; free(conn->buf); conn->buf = 0; close(conn->fd); conn->fd = -1; return_close_reason: ret_close = DSME_MSG_NEW(DSM_MSGTYPE_CLOSE); ret_close->reason = close_reason; return ret_close; } void dsmesock_close(dsmesock_connection_t* conn) { GSList* node; node = g_slist_find(connections, conn); if (node != 0) { if (conn->buf != 0) free(conn->buf); if (conn->fd != -1) close(conn->fd); free(conn); connections = g_slist_delete_link(connections, node); return; } } int dsmesock_send(dsmesock_connection_t* conn, const void* msg) { return dsmesock_send_with_extra(conn, msg, 0, 0); } int dsmesock_send_with_extra(dsmesock_connection_t* conn, const void* msg, size_t extra_size, const void* extra) { GSList* node; const dsmemsg_generic_t* m = (dsmemsg_generic_t*)msg; dsmemsg_generic_t header; struct iovec buffers[3]; int count = 0; /* Is this connection valid? */ node = g_slist_find(connections, conn); if (node == 0 || conn->is_open == 0) { return -1; } /* set up message header for sending */ memcpy(&header, msg, sizeof(header)); header.line_size_ += extra_size; buffers[count].iov_base = &header; buffers[count].iov_len = sizeof(header); ++count; /* set up message body (if any) for sending */ if (m->line_size_ > sizeof(header)) { buffers[count].iov_base = (void*)(((const char*)msg) + sizeof(header)); buffers[count].iov_len = m->line_size_ - sizeof(header); ++count; } /* set up extra part of the message (if any) for sending */ if (extra_size > 0) { buffers[count].iov_base = (void*)extra; buffers[count].iov_len = extra_size; ++count; } /* send the message */ return writev(conn->fd, buffers, count); } void dsmesock_broadcast(const void* msg) { dsmesock_broadcast_with_extra(msg, 0, 0); } void dsmesock_broadcast_with_extra(const void* msg, size_t extra_size, const void* extra) { GSList* node; for (node = connections; node != 0; node = g_slist_next(node)) { dsmesock_send_with_extra((dsmesock_connection_t *)(node->data), msg, extra_size, extra); } } const struct ucred* dsmesock_getucred(dsmesock_connection_t* conn) { GSList* node; node = g_slist_find(connections, conn); if (node != 0) { return &conn->ucred; } return 0; } libdsme-0.64.1+15.10.20150929/dsme.pc0000644000015300001610000000030012602561673017037 0ustar pbuserpbgroup00000000000000prefix=/usr includedir=${prefix}/include libdir=${prefix}/lib Name: dsme Description: DSME dsmesock dynamic library Version: 0.64.1 Requires: Libs: -L${libdir} -ldsme Cflags: -I${includedir} libdsme-0.64.1+15.10.20150929/COPYING0000644000015300001610000006363712602561673016644 0ustar pbuserpbgroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libdsme-0.64.1+15.10.20150929/tests/0000755000015300001610000000000012602562613016727 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/tests/ut_libdsme.c0000644000015300001610000001355012602561673021233 0ustar pbuserpbgroup00000000000000/** @file ut_libdsme.c Unit tests for libdsme.

Copyright (C) 2013 Jolla Ltd. @author Martin Kampas This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ /* * some glibc versions seems to mistakenly define ucred behind __USE_GNU; * work around by #defining _GNU_SOURCE */ #ifndef __cplusplus #define _GNU_SOURCE #endif #include #include #include #include #include #include #include #include #include "../include/dsme/messages.h" #include "../include/dsme/protocol.h" #include "../include/dsme/state.h" static const char* const TMP_SOCKFILE = "/tmp/ut_libdsme.sock"; static int mock_ready_semid = 0; static int mock_ready_semop(int op); static int mock(void) { int fd; int client_fd; struct sockaddr_un laddr; memset(&laddr, 0, sizeof(laddr)); laddr.sun_family = AF_UNIX; strncpy(laddr.sun_path, TMP_SOCKFILE, sizeof(laddr.sun_path) - 1); laddr.sun_path[sizeof(laddr.sun_path) - 1] = 0; fd = socket(PF_UNIX, SOCK_STREAM, 0); if (fd == -1) { perror("MOCK: socket() failed"); return EXIT_FAILURE; } unlink(TMP_SOCKFILE); if (bind(fd, (struct sockaddr*)&laddr, sizeof(laddr)) == -1) { perror("MOCK: bind() failed"); return EXIT_FAILURE; } chmod(TMP_SOCKFILE, 0666); if (listen(fd, 1) == -1) { perror("MOCK: listen() failed"); return EXIT_FAILURE; } if (mock_ready_semop(1) == -1) { perror("MOCK: semop() failed"); return EXIT_FAILURE; } if ((client_fd = accept(fd, NULL, 0)) == -1) { perror("MOCK: accept() failed"); return EXIT_FAILURE; } dsmesock_connection_t* connection = dsmesock_init(client_fd); if (connection == NULL) { puts("MOCK: dsmesock_init() failed"); return EXIT_FAILURE; } // Flags set (exactly) to O_NONBLOCK by dsmesock_init() - we do not want this during testing if (fcntl(connection->fd, F_SETFL, 0) == -1) { perror("fcntl failed"); } // Allow to exit immediately struct linger linger; linger.l_onoff = 1; linger.l_linger = 2; setsockopt(client_fd, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); dsmemsg_generic_t* msg = (dsmemsg_generic_t*)dsmesock_receive(connection); if (msg == NULL) { puts("MOCK: dsmesock_receive() failed"); return EXIT_FAILURE; } DSM_MSGTYPE_STATE_QUERY* state_query_msg = DSMEMSG_CAST(DSM_MSGTYPE_STATE_QUERY, msg); if (state_query_msg == NULL) { puts("MOCK: DSMEMSG_CAST() failed"); return EXIT_FAILURE; } DSM_MSGTYPE_STATE_REQ_DENIED_IND reply = DSME_MSG_INIT(DSM_MSGTYPE_STATE_REQ_DENIED_IND); reply.state = DSME_STATE_TEST; dsmesock_send_with_extra(connection, &reply, strlen("a-reason"), "a-reason"); return EXIT_SUCCESS; } START_TEST(test_message) { const u_int32_t id = 42; dsmemsg_generic_t* msg = dsmemsg_new(id, sizeof(dsmemsg_generic_t), sizeof(int)); ck_assert(msg != NULL); ck_assert_int_eq(id, dsmemsg_id(msg)); free(msg); } END_TEST START_TEST(test_send_receive) { dsmesock_connection_t* connection = dsmesock_connect(); ck_assert(connection != NULL); // Flags set (exactly) to O_NONBLOCK by dsmesock_init() - we do not want this during testing if (fcntl(connection->fd, F_SETFL, 0) == -1) { ck_abort_msg("fcntl failed"); } DSM_MSGTYPE_STATE_QUERY msg = DSME_MSG_INIT(DSM_MSGTYPE_STATE_QUERY); dsmesock_broadcast(&msg); dsmemsg_generic_t* reply = (dsmemsg_generic_t*)dsmesock_receive(connection); ck_assert(reply != NULL); DSM_MSGTYPE_STATE_REQ_DENIED_IND* state_reply = DSMEMSG_CAST(DSM_MSGTYPE_STATE_REQ_DENIED_IND, reply); ck_assert(state_reply != NULL); ck_assert(state_reply->state == DSME_STATE_TEST); const char* reason = DSMEMSG_EXTRA(state_reply); ck_assert(reason != NULL); ck_assert(strcmp(reason, "a-reason") == 0); free(reply); dsmesock_close(connection); } END_TEST static Suite* libdsme_suite(void) { Suite* s = suite_create ("libdsme"); TCase* tc = tcase_create("libdsme"); tcase_add_test (tc, test_message); tcase_add_test (tc, test_send_receive); suite_add_tcase (s, tc); return s; } int main(void) { setenv("DSME_SOCKFILE", TMP_SOCKFILE, 1); if ((mock_ready_semid = semget(IPC_PRIVATE, 1, 0666|IPC_CREAT)) == -1) { perror("semget() failed"); return EXIT_FAILURE; } pid_t pid = fork(); if (pid == 0) { _exit(mock()); } else if (pid < 0) { return EXIT_FAILURE; } if (mock_ready_semop(-1) == -1) { perror("semop() failed"); return EXIT_FAILURE; } int number_failed; Suite* s = libdsme_suite(); SRunner* sr = srunner_create(s); srunner_set_xml(sr, "/tmp/result.xml"); srunner_run_all(sr, CK_NORMAL); number_failed = srunner_ntests_failed(sr); srunner_free (sr); waitpid(pid, NULL, 0); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } static int mock_ready_semop(int op) { struct sembuf sops; sops.sem_num = 0; sops.sem_op = op; sops.sem_flg = 0; struct timespec timeout; timeout.tv_sec = 10; timeout.tv_nsec = 0; return semtimedop(mock_ready_semid, &sops, 1, &timeout); } libdsme-0.64.1+15.10.20150929/tests/tests.xml0000644000015300001610000000063412602561673020623 0ustar pbuserpbgroup00000000000000 libdsme unit tests Tests libdsme /opt/tests/libdsme/ut_libdsme libdsme-0.64.1+15.10.20150929/dsme_dbus_if.pc0000644000015300001610000000032712602561673020543 0ustar pbuserpbgroup00000000000000prefix=/usr includedir=${prefix}/include libdir=${prefix}/lib Name: dsme_dbus_if Description: DSME D-Bus interface dynamic library Version: 0.64.1 Requires: Libs: -L${libdir} -ldsme_dbus_if Cflags: -I${includedir} libdsme-0.64.1+15.10.20150929/alarm_limit.c0000644000015300001610000000165212602561673020234 0ustar pbuserpbgroup00000000000000/** @file alarm_limit.c Implements method to provide timeout info.

Copyright (C) 2011 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #include "include/dsme/alarm_limit.h" #define SNOOZE_TIMEOUT 120 /* 2 minutes */ int dsme_snooze_timeout_in_seconds(void) { return SNOOZE_TIMEOUT; } libdsme-0.64.1+15.10.20150929/modules/0000755000015300001610000000000012602562613017235 5ustar pbuserpbgroup00000000000000libdsme-0.64.1+15.10.20150929/modules/thermalmanager_dbus_if.h0000644000015300001610000000320612602561673024076 0ustar pbuserpbgroup00000000000000/** @file thermalmanager_dbus_if.h D-Bus names for Thermal Manager

Copyright (C) 2010 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef THERMALMANAGER_DBUS_IF_H #define THERMALMANAGER_DBUS_IF_H extern const char thermalmanager_service[]; extern const char thermalmanager_interface[]; extern const char thermalmanager_path[]; // Signals extern const char thermalmanager_state_change_ind[]; // Methods extern const char thermalmanager_get_thermal_state[]; extern const char thermalmanager_estimate_surface_temperature[]; extern const char thermalmanager_core_temperature[]; extern const char thermalmanager_battery_temperature[]; extern const char thermalmanager_sensor_temperature[]; // Possible values for the status extern const char thermalmanager_thermal_status_low[]; extern const char thermalmanager_thermal_status_normal[]; extern const char thermalmanager_thermal_status_warning[]; extern const char thermalmanager_thermal_status_alert[]; extern const char thermalmanager_thermal_status_fatal[]; #endif libdsme-0.64.1+15.10.20150929/modules/dsme_dbus_if.h0000644000015300001610000000266412602561673022046 0ustar pbuserpbgroup00000000000000/** @file dsme_dbus_if.h D-Bus names for DSME

Copyright (C) 2009 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #ifndef DSME_DBUS_IF_H #define DSME_DBUS_IF_H extern const char dsme_service[]; extern const char dsme_req_interface[]; extern const char dsme_sig_interface[]; extern const char dsme_req_path[]; extern const char dsme_sig_path[]; extern const char dsme_get_version[]; extern const char dsme_get_state[]; extern const char dsme_req_powerup[]; extern const char dsme_req_reboot[]; extern const char dsme_req_shutdown[]; extern const char dsme_state_req_denied_ind[]; extern const char dsme_shutdown_ind[]; extern const char dsme_thermal_shutdown_ind[]; extern const char dsme_battery_empty_ind[]; extern const char dsme_save_unsaved_data_ind[]; extern const char dsme_state_change_ind[]; #endif libdsme-0.64.1+15.10.20150929/modules/dsme_dbus_if.c0000644000015300001610000000337412602561673022040 0ustar pbuserpbgroup00000000000000/** @file dsme_dbus_if.c D-Bus names for DSME

Copyright (C) 2008-2009 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #include "dsme_dbus_if.h" const char dsme_service[] = "com.nokia.dsme"; const char dsme_req_interface[] = "com.nokia.dsme.request"; const char dsme_sig_interface[] = "com.nokia.dsme.signal"; const char dsme_req_path[] = "/com/nokia/dsme/request"; const char dsme_sig_path[] = "/com/nokia/dsme/signal"; const char dsme_get_version[] = "get_version"; const char dsme_get_state[] = "get_state"; const char dsme_req_powerup[] = "req_powerup"; const char dsme_req_reboot[] = "req_reboot"; const char dsme_req_shutdown[] = "req_shutdown"; const char dsme_state_req_denied_ind[] = "denied_req_ind"; const char dsme_shutdown_ind[] = "shutdown_ind"; const char dsme_thermal_shutdown_ind[] = "thermal_shutdown_ind"; const char dsme_battery_empty_ind[] = "battery_empty_ind"; const char dsme_save_unsaved_data_ind[] = "save_unsaved_data_ind"; const char dsme_state_change_ind[] = "state_change_ind"; libdsme-0.64.1+15.10.20150929/modules/thermalmanager_dbus_if.c0000644000015300001610000000351212602561673024071 0ustar pbuserpbgroup00000000000000/** @file thermalmanager_dbus_if.c D-Bus names for Thermal Manager

Copyright (C) 2010 Nokia Corporation. @author Semi Malinen This file is part of Dsme. Dsme is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Dsme is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Dsme. If not, see . */ #include "thermalmanager_dbus_if.h" const char thermalmanager_service[] = "com.nokia.thermalmanager"; const char thermalmanager_interface[] = "com.nokia.thermalmanager"; const char thermalmanager_path[] = "/com/nokia/thermalmanager"; const char thermalmanager_state_change_ind[] = "thermal_state_change_ind"; const char thermalmanager_get_thermal_state[] = "get_thermal_state"; const char thermalmanager_estimate_surface_temperature[] = "estimate_surface_temperature"; const char thermalmanager_core_temperature[] = "core_temperature"; const char thermalmanager_battery_temperature[] = "battery_temperature"; const char thermalmanager_sensor_temperature[] = "sensor_temperature"; const char thermalmanager_thermal_status_low[] = "low-temp-warning"; const char thermalmanager_thermal_status_normal[] = "normal"; const char thermalmanager_thermal_status_warning[] = "warning"; const char thermalmanager_thermal_status_alert[] = "alert"; const char thermalmanager_thermal_status_fatal[] = "fatal";