diff options
author | daniel <danieruru@gmail.com> | 2012-10-07 19:46:17 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2012-10-07 19:46:17 +0900 |
commit | 3870833ae365162eccd5e1416682de02c498467b (patch) | |
tree | 7eb21d1aab245e094d7e51b9ad252115094e050e /instr-daemon.c | |
parent | db682a18e8c7b1711f101d655a4f12e53c71b73d (diff) | |
parent | b2c2c72d381ab1b32fa5b5fc4e890fef6c2bf1e0 (diff) |
Merge branch 'master' of grenfell.avtechpulse.com:Instrument
Conflicts:
instr-daemon.c
Diffstat (limited to 'instr-daemon.c')
-rw-r--r-- | instr-daemon.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/instr-daemon.c b/instr-daemon.c index 40a65b2..ee77e82 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -14,7 +14,10 @@ #include <stdlib.h> #include <ctype.h> #include <glib.h> +<<<<<<< HEAD #include <unistd.h> +======= +>>>>>>> b2c2c72d381ab1b32fa5b5fc4e890fef6c2bf1e0 #include <fcntl.h> #define STDIN_BUF_SIZE 1024 @@ -317,7 +320,19 @@ int main(int argc, char **argv) static gboolean periodic_poll (void) { if (bus_getpin (POWER_FAIL)) { +<<<<<<< HEAD //system ("/usr/bin/systemctl poweroff"); +======= + + globals.Flags.shutdown_started = TRUE; + + while (globals.Flags.flash_write_in_progress) { + g_usleep(1000); + } + + LCD_clear(); + LCD_write(0,0,"Power failed. Shutdown."); +>>>>>>> b2c2c72d381ab1b32fa5b5fc4e890fef6c2bf1e0 // use plain old open to avoid any buffering etc int enablefd = open("/proc/sys/kernel/sysrq", O_SYNC, O_RDWR); @@ -332,6 +347,11 @@ static gboolean periodic_poll (void) // sync disks write(trgfd, "s\n", 2); +<<<<<<< HEAD +======= + // poweroff + system ("/usr/bin/systemctl poweroff -f"); +>>>>>>> b2c2c72d381ab1b32fa5b5fc4e890fef6c2bf1e0 } Menu_Check_Buttons (); @@ -342,12 +362,12 @@ static gboolean periodic_poll (void) // is crashing due to non-functional bus GPIB_check_for_device_clear_signal(); if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { - if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { - // FIXME check_for_ctrl_mode_changes(); - Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); - } - } - GPIB_check_for_device_clear_signal(); + if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { + // FIXME check_for_ctrl_mode_changes(); + Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); + } + } + GPIB_check_for_device_clear_signal(); return TRUE; } |