summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--globals.h1
-rw-r--r--libvxi11client/libvxi11client.c8
-rw-r--r--menus.c19
-rw-r--r--vxi11_server.c2
4 files changed, 17 insertions, 13 deletions
diff --git a/globals.h b/globals.h
index 6840edb..135b915 100644
--- a/globals.h
+++ b/globals.h
@@ -783,6 +783,7 @@ typedef struct {
int vxi_service_request;
int gpib_remote;
int gpib_lock;
+ int vxi_panel_lock;
} RemoteStruct;
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index 219a17f..7b23c43 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -153,7 +153,8 @@ int vxi11_open(VXI11Context* context, char* address, char* device) {
/**
* read the status byte of the connected server
- * returns -1
+ * returns the status byte or'ed with 0x100 on success
+ * so that you can tell a zero status byte from an error
*/
int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) {
@@ -234,6 +235,7 @@ int vxi11_read(VXI11Context* context, char* buffer, unsigned int bufferlen, bool
/**
* call docmd with the specified command
+ * datainlen will be calculated with strlen if less than 0
*/
int vxi11_docmd(VXI11Context* context, char* datain, int datainlen, char* dataout, int outbufferlen, int* dataoutlen,
@@ -247,8 +249,8 @@ int vxi11_docmd(VXI11Context* context, char* datain, int datainlen, char* dataou
if (datain == NULL)
datainlen = 0;
- else if (datainlen == -1)
- datainlen = strlen(datain);
+ else if (datainlen < 0)
+ datainlen = strlen(datain) + 1;
params.data_in.data_in_len = datainlen;
params.data_in.data_in_val = datain;
diff --git a/menus.c b/menus.c
index 105b78d..0602a34 100644
--- a/menus.c
+++ b/menus.c
@@ -213,8 +213,7 @@ static void Nonstd_menu_network(void);
static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower_encoder_val);
-#define GPIB_REMOTE_AND_UNLOCKED (globals.Remote.gpib_remote && !globals.Remote.gpib_lock)
-#define GPIB_REMOTE_AND_LOCKED (globals.Remote.gpib_remote && globals.Remote.gpib_lock)
+#define VXI_OR_GPIB_LOCK_ACTIVE ((globals.Remote.gpib_remote && globals.Remote.gpib_lock) || globals.Remote.vxi_panel_lock)
static void update_remote_mode ()
@@ -882,7 +881,7 @@ void Show_Main_Menu(void)
GString *raw_str = g_string_new ("");
- if (!GPIB_REMOTE_AND_LOCKED) {
+ if (!VXI_OR_GPIB_LOCK_ACTIVE) {
raw_str = g_string_append (raw_str, "LOCAL+");
}
@@ -1472,7 +1471,7 @@ static void Submenu_Display(int change_selection)
case Submenu1_rem_loc:
- if (GPIB_REMOTE_AND_UNLOCKED) {
+ if (globals.Remote.gpib_remote && !VXI_OR_GPIB_LOCK_ACTIVE) {
Submenu_max_entry=1;
title = g_strdup ("GPIB Remote:");
Submenu_Structure[0]=mode_go_to_local;
@@ -2201,7 +2200,7 @@ static void Submenu_Service_Encoder(int encoder_change)
/* quit if RWLS mode */
update_remote_mode ();
- if (GPIB_REMOTE_AND_LOCKED) {
+ if (VXI_OR_GPIB_LOCK_ACTIVE) {
return;
}
@@ -2830,7 +2829,7 @@ void Menu_Check_Buttons(void)
update_remote_mode();
if (!(button_port_val & Change_Button)) { /* ----- CHANGE BUTTON --------- */
- if (GPIB_REMOTE_AND_LOCKED) {
+ if (VXI_OR_GPIB_LOCK_ACTIVE) {
// front panel is locked out
Show_Main_Menu();
} else {
@@ -2855,28 +2854,28 @@ void Menu_Check_Buttons(void)
Submenu_Move_Pointer();
}
} else if (!(button_port_val & Mult10_Button)) { /* ----- X10 BUTTON ------------ */
- if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !GPIB_REMOTE_AND_LOCKED) {
+ if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !VXI_OR_GPIB_LOCK_ACTIVE) {
if (globals.MenuStatus.Error_Screen==YES) {
Submenu_Display(NO);
}
queue_error_and_display_on_LCD(Submenu_Mult_Value(10.0));
}
} else if (!(button_port_val & Div10_Button)) { /* ----- /10 BUTTON ------------ */
- if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !GPIB_REMOTE_AND_LOCKED) {
+ if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !VXI_OR_GPIB_LOCK_ACTIVE) {
if (globals.MenuStatus.Error_Screen==YES) {
Submenu_Display(NO);
}
queue_error_and_display_on_LCD(Submenu_Mult_Value(0.1));
}
} else if (!(button_port_val & Plus_Minus_Button)) { /* ----- +/- BUTTON ------------ */
- if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !GPIB_REMOTE_AND_LOCKED) {
+ if (globals.MenuStatus.Type_Of_Menu==Submenu_On && !VXI_OR_GPIB_LOCK_ACTIVE) {
if (globals.MenuStatus.Error_Screen==YES) {
Submenu_Display(NO);
}
queue_error_and_display_on_LCD(Submenu_Mult_Value(-1.0));
}
} else if (!(button_port_val & Extra_Fine_Button)) { /* ----- EXTRA FINE BUTTON ----- */
- if (globals.MenuStatus.Type_Of_Menu==Submenu_On && globals.MenuStatus.Nonstd_Display==NO && globals.MenuStatus.Error_Screen==NO && !GPIB_REMOTE_AND_LOCKED) {
+ if (globals.MenuStatus.Type_Of_Menu==Submenu_On && globals.MenuStatus.Nonstd_Display==NO && globals.MenuStatus.Error_Screen==NO && !VXI_OR_GPIB_LOCK_ACTIVE) {
if (Submenu_extra_fine==YES) {
g_usleep (250e3);
Submenu_extra_fine=NO;
diff --git a/vxi11_server.c b/vxi11_server.c
index d02073e..9c697d9 100644
--- a/vxi11_server.c
+++ b/vxi11_server.c
@@ -376,6 +376,7 @@ device_remote_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
else {
touchlink(argp->lid);
result.error = 0;
+ globals.Remote.vxi_panel_lock = 1;
}
}
return &result;
@@ -397,6 +398,7 @@ device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
else {
touchlink(argp->lid);
result.error = 0;
+ globals.Remote.vxi_panel_lock = 0;
}
}
return &result;