From c7f023c4d7e5544002f68583889f4acb0eb91847 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:33:28 -0500 Subject: first attempt at gpib listening - may not be functional --- instr-daemon.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index f1b1a6d..093b2f7 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -8,6 +8,9 @@ #include "nicutils.h" #include "monitor.h" #include "menus.h" +#include "gpib.h" +#include "parser.h" + #include #include #include @@ -222,7 +225,7 @@ int main(int argc, char **argv) LCD_write(2,0,message); g_free (message); - // FIXME - init RS232 + GPIB_initialize(); IO_Setup_RS232( globals.Flash.baud, globals.Flash.parity, @@ -317,5 +320,16 @@ static gboolean periodic_poll (void) Menu_Check_Buttons (); + // FIXME - gpib input - should have it's own thread? + GPIB_check_for_device_clear_signal(); + if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { + if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { + // check_for_ctrl_mode_changes(); /* update rem/loc settings */ + Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); + } + } + GPIB_check_for_device_clear_signal(); + + return TRUE; } -- cgit From 2a93a26822476c1c693d1cbe51c79a66b38cab2f Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Thu, 27 Sep 2012 09:01:32 -0400 Subject: sync before shutdown --- instr-daemon.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 093b2f7..0065ca3 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -14,6 +14,7 @@ #include #include #include +#include #define STDIN_BUF_SIZE 1024 @@ -315,6 +316,10 @@ int main(int argc, char **argv) static gboolean periodic_poll (void) { if (bus_getpin (POWER_FAIL)) { + // tidy up filesystem + sync (); + + // shutdown system ("/usr/bin/systemctl poweroff"); } -- cgit From e8461ff6d2334170ea6247e4f439120bb1097aeb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:02:15 -0500 Subject: minor casting change --- instr-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 0065ca3..0b6bcc7 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -329,7 +329,7 @@ static gboolean periodic_poll (void) GPIB_check_for_device_clear_signal(); if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { - // check_for_ctrl_mode_changes(); /* update rem/loc settings */ + // FIXME check_for_ctrl_mode_changes(); /* update rem/loc settings */ Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); } } -- cgit From f3aa09930cfeabce1811b0e0aed545ea46b32409 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:02:24 -0500 Subject: not sure sync is worthwhile --- instr-daemon.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 0b6bcc7..2b1c110 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -14,7 +14,6 @@ #include #include #include -#include #define STDIN_BUF_SIZE 1024 @@ -316,10 +315,6 @@ int main(int argc, char **argv) static gboolean periodic_poll (void) { if (bus_getpin (POWER_FAIL)) { - // tidy up filesystem - sync (); - - // shutdown system ("/usr/bin/systemctl poweroff"); } -- cgit From aceea96906c3a80d674c63d9d20914421ee0bddc Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:03:28 -0500 Subject: leave gpib off for now --- instr-daemon.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 2b1c110..8d7f2dd 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -225,7 +225,7 @@ int main(int argc, char **argv) LCD_write(2,0,message); g_free (message); - GPIB_initialize(); +// GPIB_initialize(); IO_Setup_RS232( globals.Flash.baud, globals.Flash.parity, @@ -321,14 +321,14 @@ static gboolean periodic_poll (void) Menu_Check_Buttons (); // FIXME - gpib input - should have it's own thread? - GPIB_check_for_device_clear_signal(); - if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { - if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { +// 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(); /* update rem/loc settings */ - Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); - } - } - GPIB_check_for_device_clear_signal(); +// Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); +// } +// } +// GPIB_check_for_device_clear_signal(); return TRUE; -- cgit From e8758b4e4c23a951df4e18c914982306b6b0f461 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:39:51 -0500 Subject: bus tweaks --- instr-daemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 8d7f2dd..9ac77f4 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -195,6 +195,8 @@ int main(int argc, char **argv) g_type_init (); + bus_init(); + LCD_initialize(); LCD_write(0,0,"Starting..."); @@ -247,8 +249,6 @@ int main(int argc, char **argv) } LCD_write(3,27,"OK"); - bus_init(); - I2C_Setup_Monitor(); Main_Rst(); -- cgit From f9b971979596256c2e18fd58d920d60997675cbf Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 19:41:29 -0500 Subject: enable gpib bus --- instr-daemon.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'instr-daemon.c') diff --git a/instr-daemon.c b/instr-daemon.c index 9ac77f4..0dbee09 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -321,14 +321,17 @@ static gboolean periodic_poll (void) Menu_Check_Buttons (); // FIXME - gpib input - should have it's own thread? -// 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(); /* update rem/loc settings */ -// Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); -// } -// } -// GPIB_check_for_device_clear_signal(); + // + // FIXME - comment out everything up to "return TRUE" if this section + // 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(); /* update rem/loc settings */ + Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); + } + } + GPIB_check_for_device_clear_signal(); return TRUE; -- cgit