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/6808 Thank You, jhnikula [This message was auto-generated] --- Request # 6808: Messages from BOSS: State: review at 2012-09-27T12:53:34 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 @@ +* Thu Sep 27 2012 Jarkko Nikula <[email protected]> - 0.62.2.1 +- New git release with partial fix to power off and support for + watchdog core drivers +- Version bump to 0.62.2.1 + old: ---- dsme-0.62.2.tar.gz new: ---- dsme-0.62.2.1.tar.gz spec files: ----------- --- dsme.spec +++ dsme.spec @@ -9,7 +9,7 @@ # << macros Summary: Device State Management Entity -Version: 0.62.2 +Version: 0.62.2.1 Release: 0 Group: System/System Control License: LGPLv2+ other changes: -------------- ++++++ dsme-0.62.2.tar.gz -> dsme-0.62.2.1.tar.gz --- configure.ac +++ configure.ac @@ -1,5 +1,5 @@ # Package name and version -AC_INIT(dsme, 0.62.1) +AC_INIT(dsme, 0.62.2) AM_INIT_AUTOMAKE --- dsme/dsme-wdd-wd.c +++ dsme/dsme-wdd-wd.c @@ -52,8 +52,8 @@ #define SHORTEST DSME_SHORTEST_WD_PERIOD static const wd_t wd[] = { /* path, timeout (s), disabling R&D flag */ + { "/dev/watchdog", SHORTEST, "no-omap-wd" }, /* omap wd */ { "/dev/twl4030_wdt", 30, "no-ext-wd" }, /* twl (ext) wd */ - { "/dev/watchdog", SHORTEST, "no-omap-wd" } /* omap wd */ }; #define WD_COUNT (sizeof(wd) / sizeof(wd[0])) @@ -146,6 +146,7 @@ int opened_wd_count = 0; bool wd_enabled[WD_COUNT]; int i; + char tmp[16]; for (i = 0; i < WD_COUNT; ++i) { wd_enabled[i] = true; /* enable all watchdogs by default */ @@ -157,37 +158,45 @@ /* open enabled watchdog devices */ for (i = 0; i < WD_COUNT; ++i) { - if (wd_enabled[i]) { + if (wd_enabled[i] == false) + continue; + + /* try to open watchdog core compatible device node */ + snprintf(tmp, sizeof(tmp), "/dev/watchdog%d", i); + wd_fd[i] = open(tmp, O_RDWR); + if (wd_fd[i] == -1) { + /* fallback to legacy Nokia specific device nodes */ wd_fd[i] = open(wd[i].file, O_RDWR); if (wd_fd[i] == -1) { fprintf(stderr, ME "Error opening WD %s: %s\n", wd[i].file, strerror(errno)); - } else { - ++opened_wd_count; + continue; + } + } + + ++opened_wd_count; - if (wd[i].period != 0) { + if (wd[i].period != 0) { #if 0 - fprintf(stderr, - ME "Setting WD period to %d s for %s\n", - wd[i].period, - wd[i].file); + fprintf(stderr, + ME "Setting WD period to %d s for %s\n", + wd[i].period, + wd[i].file); #endif - /* set the wd period */ - /* ioctl() will overwrite tmp with the time left */ - int tmp = wd[i].period; - if (ioctl(wd_fd[i], WDIOC_SETTIMEOUT, &tmp) != 0) { - fprintf(stderr, - ME "Error setting WD period for %s\n", - wd[i].file); - } - } else { - fprintf(stderr, - ME "Keeping default WD period for %s\n", - wd[i].file); - } + /* set the wd period */ + /* ioctl() will overwrite tmp with the time left */ + int tmp = wd[i].period; + if (ioctl(wd_fd[i], WDIOC_SETTIMEOUT, &tmp) != 0) { + fprintf(stderr, + ME "Error setting WD period for %s\n", + wd[i].file); } + } else { + fprintf(stderr, + ME "Keeping default WD period for %s\n", + wd[i].file); } } --- modules/runlevel.c +++ modules/runlevel.c @@ -52,8 +52,14 @@ { char command[32]; - snprintf(command, sizeof(command), "telinit %i", runlevel); - dsme_log(LOG_NOTICE, "Issuing telinit %i", runlevel); + if (access("/sbin/telinit", X_OK) == 0) { + snprintf(command, sizeof(command), "/sbin/telinit %i", runlevel); + } else if (access("/usr/sbin/telinit", X_OK) == 0) { + snprintf(command, sizeof(command), "/usr/sbin/telinit %i", runlevel); + } else { + return false; + } + dsme_log(LOG_NOTICE, "Issuing %s", command); if (system(command) != 0) { dsme_log(LOG_CRIT, "failed to change runlevel, trying again in 2s"); @@ -87,8 +93,9 @@ "Malf"); /* If runlevel change fails, handle the shutdown/reboot by DSME */ - if (access("/sbin/telinit", X_OK) != 0 || !change_runlevel(runlevel)) + if (!change_runlevel(runlevel)) { + char command[32]; dsme_log(LOG_CRIT, "Doing forced shutdown/reboot"); sync(); @@ -97,22 +104,32 @@ if (runlevel == DSME_RUNLEVEL_SHUTDOWN || runlevel == DSME_RUNLEVEL_MALF) { - dsme_log(LOG_CRIT, "Issuing poweroff"); - if (system("/sbin/poweroff") != 0) { - dsme_log(LOG_ERR, "/sbin/poweroff failed, trying again in 3s"); + if (access("/sbin/poweroff", X_OK) == 0) { + snprintf(command, sizeof(command), "/sbin/poweroff"); + } else { + snprintf(command, sizeof(command), "/usr/sbin/poweroff"); + } + dsme_log(LOG_CRIT, "Issuing %s", command); + if (system(command) != 0) { + dsme_log(LOG_ERR, "%s failed, trying again in 3s", command); sleep(3); - if (system("/sbin/poweroff") != 0) { - dsme_log(LOG_ERR, "/sbin/poweroff failed again"); + if (system(command) != 0) { + dsme_log(LOG_ERR, "%s failed again", command); goto fail_and_exit; } } } else { - dsme_log(LOG_CRIT, "Issuing reboot"); - if (system("/sbin/reboot") != 0) { - dsme_log(LOG_ERR, "/sbin/reboot failed, trying again in 3s"); + if (access("/sbin/reboot", X_OK) == 0) { + snprintf(command, sizeof(command), "/sbin/reboot"); + } else { + snprintf(command, sizeof(command), "/usr/sbin/reboot"); + } + dsme_log(LOG_CRIT, "Issuing %s", command); + if (system(command) != 0) { + dsme_log(LOG_ERR, "%s failed, trying again in 3s", command); sleep(3); - if (system("/sbin/reboot") != 0) { - dsme_log(LOG_ERR, "/sbin/reboot failed again"); + if (system(command) != 0) { + dsme_log(LOG_ERR, "%s failed again", command); goto fail_and_exit; } } ++++++ dsme.yaml --- dsme.yaml +++ dsme.yaml @@ -1,6 +1,6 @@ Name: dsme Summary: Device State Management Entity -Version: 0.62.2 +Version: 0.62.2.1 Release: 0 Group: System/System Control License: LGPLv2+
