I have made the following changes intended for :
  CE:MW:Shared / dsme

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/6796

Thank You,
jhnikula

[This message was auto-generated]

---

Request # 6796:

Messages from BOSS:

State: review at 2012-09-26T14:45:35 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:jhnikula:branches:CE:MW:Shared / dsme -> CE:MW:Shared / dsme
  
changes files:
--------------
--- dsme.changes
+++ dsme.changes
@@ -0,0 +1,5 @@
+* Wed Sep 26 2012  Jarkko Nikula <[email protected]> - 0.62.2
+- Sync with a new DMSE repository that is cloned from previous one and
+  integrates 9 patches from here
+- Version bump to 0.62.2
+

old:
----
  0001-no-bmeipc.patch
  0002-Introduce-pwrkeymonitor-plugin.patch
  0003-meego-state-to-runlevel-mapping.patch
  0004-dbus-policy-fix.patch
  0005-Removed-variables-set-but-not-used-unused-but-set-va.patch
  0006-Add-missing-include.patch
  0007-Fix-compilation-of-tests.patch
  0008-HACK-disable-credential-check-for-clients.patch
  0009-NEMO_334-Make-device-poweroff.patch
  boss.conf
  dsme-0.62.1.1.tar.gz

new:
----
  dsme-0.62.2.tar.gz

spec files:
-----------
--- dsme.spec
+++ dsme.spec
@@ -1,32 +1,24 @@
 # 
 # Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.23
+# Generated by: spectacle version 0.25
 # 
+
+Name:       dsme
+
 # >> macros
 # << macros
 
-Name:       dsme
 Summary:    Device State Management Entity
-Version:    0.62.1.1
+Version:    0.62.2
 Release:    0
 Group:      System/System Control
 License:    LGPLv2+
-URL:        http://meego.gitorious.org/meego-middleware/dsme
+URL:        https://github.com/nemomobile/dsme
 Source0:    %{name}-%{version}.tar.gz
 Source1:    dsme.service
 Source2:    dsme-start.sh
 Source3:    dsme-rpmlintrc
-Source4:    boss.conf
 Source100:  dsme.yaml
-Patch0:     0001-no-bmeipc.patch
-Patch1:     0002-Introduce-pwrkeymonitor-plugin.patch
-Patch2:     0003-meego-state-to-runlevel-mapping.patch
-Patch3:     0004-dbus-policy-fix.patch
-Patch4:     0005-Removed-variables-set-but-not-used-unused-but-set-va.patch
-Patch5:     0006-Add-missing-include.patch
-Patch6:     0007-Fix-compilation-of-tests.patch
-Patch7:     0008-HACK-disable-credential-check-for-clients.patch
-Patch8:     0009-NEMO_334-Make-device-poweroff.patch
 Requires:   systemd
 Requires(preun): systemd
 Requires(post): systemd
@@ -39,34 +31,14 @@
 BuildRequires:  python
 BuildRequires:  libcreds2-devel
 
-
 %description
 Device State Management Entity (with debug symbols). This package contains the 
Device State Management Entity which provides state management features such as 
service monitoring, process watchdog and inactivity tracking.
 
 
 
-
 %prep
 %setup -q -n %{name}-%{version}
 
-# 0001-no-bmeipc.patch
-%patch0 -p1
-# 0002-Introduce-pwrkeymonitor-plugin.patch
-%patch1 -p1
-# 0003-meego-state-to-runlevel-mapping.patch
-%patch2 -p1
-# 0004-dbus-policy-fix.patch
-%patch3 -p1
-# 0005-Removed-variables-set-but-not-used-unused-but-set-va.patch
-%patch4 -p1
-# 0006-Add-missing-include.patch
-%patch5 -p1
-# 0007-Fix-compilation-of-tests.patch
-%patch6 -p1
-# 0008-HACK-disable-credential-check-for-clients.patch
-%patch7 -p1
-# 0009-NEMO_334-Make-device-poweroff.patch
-%patch8 -p1
 # >> setup
 # << setup
 
@@ -89,6 +61,7 @@
 
 # >> build post
 # << build post
+
 %install
 rm -rf %{buildroot}
 # >> install pre
@@ -104,15 +77,9 @@
 
 
 %preun
-# >> preun
-#
-# NOTE: YOU NEED TO REMOVE THE SPECTACLE GENERATED
-#       'systemctl stop' SCRIPT ABOVE (IF PRESENT)!!!
-#
-if [ $1 = 0 ]; then
+if [ "$1" -eq 0 ]; then
 systemctl stop %{name}.service
 fi
-# << preun
 
 %post
 systemctl daemon-reload
@@ -121,7 +88,6 @@
 %postun
 systemctl daemon-reload
 
-
 %files
 %defattr(-,root,root,-)
 %{_libdir}/dsme/*
@@ -133,5 +99,3 @@
 /lib/systemd/system/multi-user.target.wants/%{name}.service
 # >> files
 # << files
-
-

other changes:
--------------

++++++ dsme-0.62.1.1.tar.gz -> dsme-0.62.2.tar.gz
--- configure.ac
+++ configure.ac
@@ -78,6 +78,19 @@
   [AC_DEFINE([DSME_MEMORY_THERMAL_MGMT], [1])])
 AM_CONDITIONAL([WANT_MEMORY_THERMAL_MGMT], [test x$enable_memory_thermal_mgmt 
!= xno])
 
+#
+# pwrkeymonitor
+#
+AC_ARG_ENABLE([pwrkeymonitor],
+  [AS_HELP_STRING([--enable-pwrkeymonitor],
+    [enable pwrkeymonitor plugin (pwrkeymonitor)])],
+  [],
+  [enable_pwrkeymonitor=no])
+
+AS_IF([test "x$enable_pwrkeymonitor" != xno],
+  [AC_DEFINE([DSME_PWRKEY_MONITOR], [1], [Enable pwrkeymonitor plugin])])
+AM_CONDITIONAL([WANT_PWRKEY_MONITOR], [test x$enable_pwrkeymonitor != xno])
+
 
 #
 # Compiler and linker flags
--- dsme/dsme-wdd-wd.c
+++ dsme/dsme-wdd-wd.c
@@ -84,6 +84,9 @@
               dummy = write(STDERR_FILENO, msg, DSME_STATIC_STRLEN(msg));
               dummy = write(STDERR_FILENO, wd[i].file, strlen(wd[i].file));
               dummy = write(STDERR_FILENO, "\n", 1);
+              if (dummy < 0) {
+                  break;
+              }
 
               /* must not kick later wd's if an earlier one fails */
               break;
--- dsme/dsme.conf
+++ dsme/dsme.conf
@@ -14,11 +14,6 @@
     <deny send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_reboot"/>
     <deny send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_powerup"/>
   </policy>
-  <policy creds="dsme::DeviceStateControl">
-    <allow send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_shutdown"/>
-    <allow send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_reboot"/>
-    <allow send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_powerup"/>
-  </policy>
   <policy user="root">
     <allow send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_shutdown"/>
     <allow send_destination="com.nokia.dsme" 
send_interface="com.nokia.dsme.request" send_member="req_reboot"/>
--- dsme/dsmesock.c
+++ dsme/dsmesock.c
@@ -130,13 +130,13 @@
 static bool check_client_credentials(int socketfd)
 {
   bool          success = true;
-  creds_value_t value;
-  creds_type_t  type    = creds_str2creds("dsme::DeviceStateControl", &value);
+/*  creds_value_t value;
+  creds_type_t  type    = creds_str2creds("dsme::DeviceStateControl", 
&value);*/
   creds_t       creds   = creds_getpeer(socketfd);
 
-  if (!creds_have_p(creds, type, value)) {
+/*  if (!creds_have_p(creds, type, value)) {
     success = false;
-  }
+  }*/
 
   creds_free(creds);
   return success;
--- dsme/logging.c
+++ dsme/logging.c
@@ -502,8 +502,8 @@
         return strdup("<internal>");
     if (logopt.verbosity == LOG_DEBUG)
     {
-        char* path;
-        if (asprintf(&path, "/proc/%ld/cmdline", (long)pid))
+        char* path = 0;
+        if (asprintf(&path, "/proc/%ld/cmdline", (long)pid) != -1)
         {
             FILE* file = fopen(path, "r");
             if (file != NULL)
--- dsme/oom.c
+++ dsme/oom.c
@@ -42,9 +42,7 @@
   }
 
   if (fprintf(file, "%i", i) < 0) {
-      int tmp = errno;
       (void)fclose(file);
-      tmp = errno;
       return false;
   }
 
--- modules/Makefile.am
+++ modules/Makefile.am
@@ -56,6 +56,10 @@
 pkglib_LTLIBRARIES += upstart.la
 endif
 
+if WANT_PWRKEY_MONITOR
+pkglib_LTLIBRARIES += pwrkeymonitor.la
+endif
+
 startup_la_SOURCES = startup.c
 
 # TODO: remove this
@@ -101,7 +105,7 @@
 iphb_la_SOURCES = iphb.c
 iphb_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
 iphb_la_CPPFLAGS = $(AM_CPPFLAGS)
-iphb_la_LIBADD = -lbmeipc $(GLIB_LIBS)
+iphb_la_LIBADD = $(GLIB_LIBS)
 
 thermalflagger_la_SOURCES = thermalflagger.c
 
@@ -114,7 +118,7 @@
                                       thermalsensor_battery.c \
                                       thermalsensor_battery.h
 thermalobject_surface_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
-thermalobject_surface_la_LIBADD = -lbmeipc $(GLIB_LIBS)
+thermalobject_surface_la_LIBADD = $(GLIB_LIBS)
 endif
 
 if WANT_MEMORY_THERMAL_MGMT
@@ -144,3 +148,9 @@
 dbusautoconnector_la_SOURCES = dbusautoconnector.c
 dbusautoconnector_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
 dbusautoconnector_la_LIBADD = $(GLIB_LIBS)
+
+if WANT_PWRKEY_MONITOR
+pwrkeymonitor_la_SOURCES = pwrkeymonitor.c
+pwrkeymonitor_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
+pwrkeymonitor_la_LIBADD = $(GLIB_LIBS)
+endif
--- modules/pwrkeymonitor.c
+++ modules/pwrkeymonitor.c
@@ -0,0 +1,351 @@
+/**
+   @file pwrkeymonitor.c
+
+   @brief Power key monitor plugin for forced poweroff.
+
+   Pwrkeymonitor is intended for "fallback poweroff", in case the UI (or other
+   component) responsible for handling powerkey events has died or become
+   unresponsible. In reading powerkey status, it currently only supports
+   evdev interface of the kernel. The plugin is written for Nokia N900 but it
+   could relatively easily be modified to support other platforms as well, name
+   by adding run-time configurability. Currently, the plugin searches for evdev
+   driver whose name includes substring "pwrbutton". It sends a shutdown event 
+   powerkey has been continously pressed for 5 seconds.
+   <p>
+   Copyright (C) 2010 Nokia Corporation.
+
+   @author Markus Lehtonen <[email protected]>
+
+   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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "dsme/modules.h"
+#include "dsme/logging.h"
+#include "dsme/mainloop.h"
+#include "dsme/timers.h"
+#include "runlevel.h"
+#include "state-internal.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <glib/gprintf.h>
+#include <glib/gstdio.h>
+
+#include <linux/input.h>
+
+#define EVDEV_DEV_DIR_PATH "/dev/input/"
+#define EVDEV_NAME_MATCH "pwrbutton"
+#define EVDEV_FALLBACK_DEV_PATH "/dev/input/event3"
+#define PWRKEY_TIMER_SECONDS 5
+
+/* Use nonblock read. This is safer as it ensures that the read of event data
+ * will newer block and, thus, the execution of dsme-server is newer stalled 
+ * there.
+ */
+#define PWRKEY_READ_NONBLOCK 1
+
+/* TODO: Run-time configurability (configuration file?) for pwrkeymonitor.
+ *       Options to configure: device name, device path, timer timeout
+ * TODO: Fallback device path is not used for anything
+ */
+
+static dsme_timer_t pwrkey_timer = 0;
+static GIOChannel *evdev_chan = NULL;
+static guint evdev_watch = 0;
+
+static int
+match_device(const gchar * devdir, const gchar * namematch)
+{
+    GDir *dir = NULL;
+    const gchar *filename = NULL;
+    GError *error = NULL;
+    gchar devname[256] = "";
+
+    dir = g_dir_open(devdir, 0, &error);
+    if (dir == NULL)
+    {
+        dsme_log(LOG_WARNING, "pwrkeymonitor: Unable to open device dir");
+        goto err;
+    }
+
+    while ((filename = g_dir_read_name(dir)))
+    {
+        if (!g_file_test
+            (filename, G_FILE_TEST_IS_SYMLINK | G_FILE_TEST_IS_DIR))
+        {
+            int fd;
+            int ret;
+            gchar *abspath;
+
+            abspath = g_strjoin("/", devdir, filename, NULL);
+
+            dsme_log(LOG_DEBUG,
+                     "pwrkeymonitor: Trying dev \"%s\"...", abspath);
+            fd = g_open(abspath, O_RDONLY);
+
+            if (fd <= 0)
+            {
+                dsme_log(LOG_DEBUG,
+                         "pwrkeymonitor: Unable to open file (\"%s\")",
+                         abspath);
+                g_free(abspath);
+                continue;
+            }
+
+            ret = ioctl(fd, EVIOCGNAME(sizeof(devname)), devname);
+            if (ret == -1)
+            {
+                dsme_log(LOG_DEBUG,
+                         "pwrkeymonitor: Unable to read device name of %s",
+                         abspath);
+            }
+            else if (g_strstr_len(devname, sizeof(devname), namematch))
+            {
+                dsme_log(LOG_INFO,
+                         "pwrkeymonitor: Matched device name \"%s\" (\"%s\"in 
%s)",
+                         namematch, devname, abspath);
+                g_dir_close(dir);
+                g_free(abspath);
+                return fd;
+            }
+            dsme_log(LOG_DEBUG,
+                     "pwrkeymonitor: No match, devname was \"%s\"...",
+                     devname);
+            g_free(abspath);
+            close(fd);
+        }
+    }
+    dsme_log(LOG_INFO,
+             "pwrkeymonitor: Unable to find device that matches \"%s\"",
+             namematch);
+
+    g_dir_close(dir);
+
+  err:
+    return 0;
+}
+
+static int
+pwrkey_trigger(void* foo)
+{
+/* Use telinit message */
+#ifdef PWRKEY_SHUTDOWN_MSG_TELINIT
+    const char runlevel[] = "SHUTDOWN";
+    char* buf = NULL;
+    DSM_MSGTYPE_TELINIT* msg = NULL;
+
+    msg = DSME_MSG_NEW_WITH_EXTRA(DSM_MSGTYPE_TELINIT, sizeof(runlevel));
+    buf = ((char *)msg) + sizeof(DSM_MSGTYPE_TELINIT);
+    strcpy(buf, runlevel);
+    broadcast_internally(msg);
+    free(msg);
+/* Use the "normal" shutdown request */
+#else
+    DSM_MSGTYPE_SHUTDOWN_REQ msg = DSME_MSG_INIT(DSM_MSGTYPE_SHUTDOWN_REQ);
+    broadcast_internally(&msg);
+#endif
+
+    return 0;
+}
+
+static gboolean
+start_pwrkey_timer()
+{
+    if (!pwrkey_timer)
+    {
+        if (!(pwrkey_timer = dsme_create_timer(PWRKEY_TIMER_SECONDS,
+                                               pwrkey_trigger, NULL)))
+        {
+            dsme_log(LOG_CRIT, "pwrkeymonitor: Timer creation failed!");
+            return false;
+        }
+        dsme_log(LOG_DEBUG,
+                 "pwrkeymonitor: Timer started (%d sec to shutdown)",
+                 PWRKEY_TIMER_SECONDS);
+    }
+    else
+    {
+        dsme_log(LOG_DEBUG, "pwrkeymonitor: Timer already running");
+    }
+    return true;
+}
+
+static void
+stop_pwrkey_timer()
+{
+    if (pwrkey_timer)
+    {
+        dsme_destroy_timer(pwrkey_timer);
+        pwrkey_timer = 0;
+        dsme_log(LOG_DEBUG, "pwrkeymonitor: Timer stopped");
+    }
+}
+
+static gboolean
+process_kbevent(GIOChannel* source, GIOCondition condition, gpointer data)
+{
+    /* Handle errors */
+    if (condition & ~(G_IO_IN | G_IO_PRI))
+    {
+        dsme_log(LOG_DEBUG, "pwrkeymonitor: I/O error");
+        return false;
+    }
+    //dsme_log(LOG_DEBUG, "pwrkeymonitor: Event handler called...");
+
+    /* first read the byte that woke us up */
+    GIOStatus ret;
+    struct input_event ev;
+    gsize bytes = 0;
+    GError *error = NULL;
+
+    do
+    {
+        ret = g_io_channel_read_chars(source,
+                                      (gchar *) &ev,
+                                      sizeof(struct input_event),
+                                      (gsize *) &bytes,
+                                      &error);
+        //dsme_log(LOG_DEBUG, "pwrkeymonitor: read %d bytes", bytes);
+        if (ret != G_IO_STATUS_NORMAL && ret != G_IO_STATUS_AGAIN)
+        {
+            /* We get G_IO_STATUS_AGAIN when there is no more data to read.
+             * So that is kind of normal condition
+             */
+            dsme_log(LOG_WARNING,
+                    "pwrkeymonitor: error reading evdev data");
+        }
+        if (bytes == sizeof(struct input_event))
+        {
+            dsme_log(LOG_DEBUG,
+                    "pwrkeymonitor: Got event, type: %d code: %d value: %d",
+                    ev.type, ev.code, ev.value);
+
+            if (ev.type == EV_KEY && ev.code == KEY_POWER)
+            {
+                if (ev.value == 1)
+                    start_pwrkey_timer();
+                else
+                    stop_pwrkey_timer();
+            }
+        }
+        else if (bytes != 0)
+        {
+            dsme_log(LOG_WARNING,
+                     "pwrkeymonitor: evdev data alignment mismatch \
+                     (got %d bytes of %d expected)",
+                     bytes, sizeof(struct input_event));
+        }
+    }
+/* In nonblocking mode, read as long as there is data to read */
+#ifdef PWRKEY_READ_NONBLOCK
+    while (bytes > 0);
+/* In blocking mode, read only one ev */
+#else
+    while (0);
+#endif
+
+    /* Don't ever remove, Watch is only removed in stop_pwrkey_monitor() */
+    return true;
+}
+
+static bool
+start_pwrkey_monitor(void)
+{
+    GIOChannel *chan = NULL;
+    GError *error = NULL;
+    guint watch = 0;
+    int fd = 0;
+
+    /* Find and open device */
+    fd = match_device(EVDEV_DEV_DIR_PATH, EVDEV_NAME_MATCH);
+    if (fd <= 0)
+    {
+        goto err2;
+    }
+    if (!(chan = g_io_channel_unix_new(fd)))
+    {
+        dsme_log(LOG_ERR, "pwrkeymonitor: unable to set up io channel");
+        goto err1;
+    }
+    if (g_io_channel_set_encoding(chan, NULL, &error) != G_IO_STATUS_NORMAL)
+    {
+        dsme_log(LOG_ERR,
+                 "pwrkeymonitor: unable to set I/O channel to raw mode");
+        g_io_channel_unref(chan);
+        goto err1;
+    }
+    g_io_channel_set_buffered(chan, false);
+#ifdef PWRKEY_READ_NONBLOCK
+    if (g_io_channel_set_flags(chan, G_IO_FLAG_NONBLOCK, &error) !=
+        G_IO_STATUS_NORMAL)
+    {
+        dsme_log(LOG_ERR,
+                 "pwrkeymonitor: unable to set I/O channel non-blocking mode");
+        g_io_channel_unref(chan);
+        goto err1;
+    }
+#endif
+
+    /* Set up an I/O watch for the device */
+    if (!(watch = g_io_add_watch(chan,
+                                 (G_IO_PRI | G_IO_IN | G_IO_ERR),
+                                 process_kbevent, 0)))
+    {
+        dsme_log(LOG_ERR, "pwrkeymonitor: unable to set up io watch");
+        g_io_channel_unref(chan);
+        goto err1;
+    }
+    evdev_chan = chan;
+    evdev_watch = watch;
+
+    dsme_log(LOG_DEBUG, "pwrkeymonitor: I/O channel set up successfully");
+    return true;
+
+  err1:
+    close(fd);
+  err2:
+    return false;
+}
+
+static void
+stop_pwrkey_monitor(void)
+{
+    g_source_remove(evdev_watch);
+    g_io_channel_unref(evdev_chan);
+    stop_pwrkey_timer();
+}
+
+
+void
+module_init(module_t * handle)
+{
+    start_pwrkey_monitor();
+
+    dsme_log(LOG_DEBUG, "libpwrkeymonitor.so loaded");
+}
+
+void
+module_fini(void)
+{
+    stop_pwrkey_monitor();
+    dsme_log(LOG_DEBUG, "libpwrkeymonitor.so unloaded");
+}
--- modules/runlevel.c
+++ modules/runlevel.c
@@ -29,6 +29,7 @@
 #include "runlevel.h"
 #include "dsme/modules.h"
 #include "dsme/logging.h"
+#include "dsme/modulebase.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -51,7 +52,7 @@
 {
   char command[32];
 
-  snprintf(command, sizeof(command), "telinit -t 0 %i", runlevel);
+  snprintf(command, sizeof(command), "telinit %i", runlevel);
   dsme_log(LOG_NOTICE, "Issuing telinit %i", runlevel);
 
   if (system(command) != 0) {
--- modules/runlevel.h
+++ modules/runlevel.h
@@ -29,12 +29,12 @@
 
 typedef enum {
   DSME_RUNLEVEL_SHUTDOWN = 0,
-  DSME_RUNLEVEL_TEST     = 1,
-  DSME_RUNLEVEL_USER     = 2,
-  DSME_RUNLEVEL_LOCAL    = 3,
-  DSME_RUNLEVEL_ACTDEAD  = 5,
+  DSME_RUNLEVEL_LOCAL    = 0, /* MeeGo -> map to 'halt'      */
+  DSME_RUNLEVEL_ACTDEAD  = 0, /* MeeGo -> map to 'halt'      */
+  DSME_RUNLEVEL_MALF     = 0, /* MeeGo -> map to 'halt'      */
+  DSME_RUNLEVEL_TEST     = 3, /* MeeGo -> map to 'multiuser' */
+  DSME_RUNLEVEL_USER     = 5, /* MeeGo -> map to 'X11'       */
   DSME_RUNLEVEL_REBOOT   = 6,
-  DSME_RUNLEVEL_MALF     = 8,
 } dsme_runlevel_t;
 
 typedef struct {
--- modules/startup.c
+++ modules/startup.c
@@ -99,6 +99,9 @@
     "diskmonitor.so",
     "tempreaper.so",
     "dbusautoconnector.so",
+#ifdef DSME_PWRKEY_MONITOR
+    "pwrkeymonitor.so",
+#endif
     NULL
 };
 
--- modules/thermalsensor_battery.c
+++ modules/thermalsensor_battery.c
@@ -41,10 +41,119 @@
 /* these need to be #defined in order to pick up thermal stuff from bme */
 #define TESTSERVER
 
+#ifdef GOT_BMEIPC_HEADERS
+
 #include <bme/bmeipc.h>
 #include <bme/bmemsg.h>
 #include <bme/em_isi.h>
 
+#else /* GOT_BMEIPC_HEADERS */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#define BME_SRV_SOCK_PATH       "/tmp/.bmesrv"
+#define BME_SRV_COOKIE          "BMentity"
+
+#define EM_BATTERY_INFO_REQ                      0x06
+#define EM_BATTERY_TEMP                          0x0004  /* -------------1-- */
+
+struct emsg_battery_info_req {
+    uint16      type, subtype;
+    uint32      flags;
+};
+
+/* Battery info reply */
+struct emsg_battery_info_reply {
+    uint32      a;
+    uint32      flags;
+    uint16      c;
+    uint16      d;
+    uint16      temp;
+    uint16      f;
+    uint16      g;
+    uint16      h;
+    uint16      i;
+    uint16      j;
+    uint16      k;
+    uint16      l;
+};
+
+union emsg_battery_info {
+    struct emsg_battery_info_req   request;
+    struct emsg_battery_info_reply reply;
+};
+
+static int bme_socket = -1;
+
+static int32_t bme_read(void *msg, int32_t bytes);
+static int32_t bme_write(const void *msg, int32_t bytes);
+static void bme_disconnect(void);
+static int32_t bme_connect(void);
+
+int32_t bme_read(void *msg, int32_t bytes)
+{
+  if (bme_socket == -1)
+  {
+    return -1;
+  }
+  return recv(bme_socket, msg, bytes, 0);
+}
+
+int32_t bme_write(const void *msg, int32_t bytes)
+{
+  if (bme_socket == -1)
+  {
+   return -1;
+  }
+  return send(bme_socket, msg, bytes, 0);
+}
+
+void bme_disconnect(void)
+{
+  if (bme_socket >= 0)
+    close(bme_socket);
+  bme_socket = -1;
+}
+
+int32_t bme_connect(void)
+{
+  struct sockaddr_un sa;
+  char ch;
+
+  memset(&sa, 0, sizeof(sa));
+  sa.sun_family = PF_UNIX;
+
+  strcpy(sa.sun_path, BME_SRV_SOCK_PATH);
+  if ((bme_socket = socket(PF_UNIX,SOCK_STREAM, 0)) < 0)
+    return bme_socket;
+
+  if (connect(bme_socket, (struct sockaddr *) &sa, sizeof(struct sockaddr_un)) 
< 0)
+  {
+    bme_disconnect();
+    return bme_socket;
+  }
+
+  /* Send cookie */
+  if (bme_write(BME_SRV_COOKIE, strlen(BME_SRV_COOKIE)) < 
strlen(BME_SRV_COOKIE))
+  {
+    bme_disconnect();
+    return bme_socket;
+  }
+
+  if (bme_read(&ch, 1) < 1 || ch != '\n')
+  {
+    bme_disconnect();
+    return bme_socket;
+  }
+  return bme_socket;
+}
+#endif /* GOT_BMEIPC_HEADERS */
 
 static gboolean handle_battery_temperature_response(GIOChannel*  source,
                                                     GIOCondition condition,
--- test/testmod_alarmtracker.c
+++ test/testmod_alarmtracker.c
@@ -381,8 +381,7 @@
   free(alarm_setup_msg);
 
   assert(!message_queue_is_empty());
-  DSM_MSGTYPE_WAIT *waitreq;
-  assert(waitreq = queued(DSM_MSGTYPE_WAIT));
+  assert(queued(DSM_MSGTYPE_WAIT));
   assert(message_queue_is_empty());
 
   DSM_MSGTYPE_WAKEUP wakeupmsg =
--- test/utils_misc.h
+++ test/utils_misc.h
@@ -69,13 +69,15 @@
           message_queue = g_slist_delete_link(message_queue, node);
           break;
       } else {
+          int dummy_ret;
           if (other_messages == 0) {
-              asprintf(&other_messages, "%x", m->data->type_);
+              dummy_ret = asprintf(&other_messages, "%x", m->data->type_);
           } else {
               char* s = 0;
-              asprintf(&s, "%s, %x", other_messages, m->data->type_);
+              dummy_ret = asprintf(&s, "%s, %x", other_messages, 
m->data->type_);
               free(other_messages), other_messages = s;
           }
+          (void)dummy_ret; /* We don't really care about the return value */
       }
   }
 

++++++ dsme.yaml
--- dsme.yaml
+++ dsme.yaml
@@ -1,10 +1,10 @@
 Name: dsme
 Summary: Device State Management Entity
-Version: 0.62.1.1
+Version: 0.62.2
 Release: 0
 Group: System/System Control
 License: LGPLv2+
-URL: http://meego.gitorious.org/meego-middleware/dsme
+URL: https://github.com/nemomobile/dsme
 Description: |
     Device State Management Entity (with debug symbols). This package contains 
the Device State Management Entity which provides state management features 
such as service monitoring, process watchdog and inactivity tracking.
 
@@ -21,17 +21,7 @@
     - "dsme.service"
     - "dsme-start.sh"
     - "dsme-rpmlintrc"
-    - boss.conf
 Patches:
-    - 0001-no-bmeipc.patch
-    - 0002-Introduce-pwrkeymonitor-plugin.patch
-    - 0003-meego-state-to-runlevel-mapping.patch
-    - 0004-dbus-policy-fix.patch
-    - 0005-Removed-variables-set-but-not-used-unused-but-set-va.patch
-    - 0006-Add-missing-include.patch
-    - 0007-Fix-compilation-of-tests.patch
-    - 0008-HACK-disable-credential-check-for-clients.patch
-    - 0009-NEMO_334-Make-device-poweroff.patch
 
 PkgConfigBR:
     - glib-2.0

++++++ deleted files:
--- 0001-no-bmeipc.patch
--- 0002-Introduce-pwrkeymonitor-plugin.patch
--- 0003-meego-state-to-runlevel-mapping.patch
--- 0004-dbus-policy-fix.patch
--- 0005-Removed-variables-set-but-not-used-unused-but-set-va.patch
--- 0006-Add-missing-include.patch
--- 0007-Fix-compilation-of-tests.patch
--- 0008-HACK-disable-credential-check-for-clients.patch
--- 0009-NEMO_334-Make-device-poweroff.patch
--- boss.conf



Reply via email to