summaryrefslogtreecommitdiff
path: root/libvxi11client/libvxi11client.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r--libvxi11client/libvxi11client.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index 5d09786..66bb020 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -16,7 +16,6 @@
/**
* This is a thin wrapper around the rpcgen generated code to give it a simpler interface.
- * Only one server with a single link is supported.
*/
#define FLAG_TERMCHRSET (1 << 7)
@@ -154,6 +153,7 @@ int vxi11_open(VXI11Context* context, char* address, char* device) {
/**
* read the status byte of the connected server
+ * returns -1
*/
int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) {
@@ -165,11 +165,12 @@ int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) {
Device_ReadStbResp* resp = device_readstb_1(&params, context->clnt);
if (resp != NULL && resp->error == 0)
- return resp->stb;
+ return resp->stb | (1 << 8); // this sets a bit above the byte so that we can tell whether there was a state issue
+ // or if the instrument returned 0
else if (resp == NULL)
return 0;
else
- return -1;
+ return -(resp->error);
}
/**
@@ -192,7 +193,7 @@ int vxi11_write(VXI11Context* context, char* data, int len, bool waitlock, bool
else if (resp == NULL)
return 0;
else
- return -1;
+ return -(resp->error);
}
/**
@@ -226,11 +227,11 @@ int vxi11_read(VXI11Context* context, char* buffer, unsigned int bufferlen, bool
else if (resp == NULL)
return 0;
else
- return -1;
+ return -(resp->error);
}
/**
- *
+ * call docmd with the specified command
*/
int vxi11_docmd(VXI11Context* context, unsigned long cmd, bool waitforlock) {