From 54329a7c7f740171d1594c6c6195277c2924f31f Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 10 Jan 2013 17:29:54 +0900 Subject: Interrupt channel work --- libvxi11client/client.c | 18 ++++++++++++------ libvxi11client/libvxi11client.c | 10 +++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'libvxi11client') diff --git a/libvxi11client/client.c b/libvxi11client/client.c index 2d050aa..9656e4d 100644 --- a/libvxi11client/client.c +++ b/libvxi11client/client.c @@ -1,4 +1,5 @@ #include +#include #include "libvxi11client.h" #define IDENTIFY "*IDN?" @@ -124,13 +125,18 @@ int main(int argc, char *argv[]) { printf("\n"); // create interrupt channel - err = vxi11_create_intr_chan(); - - // destroy interrupt channel - if ((err = vxi11_destroy_intr_chan()) > 0) - printf("destroyed interrupt channel\n"); + printf("-- Testing interrupt channel --\n"); + if ((err = vxi11_create_intr_chan() > 0)) { + printf("Created interrupt channel\n"); + // destroy interrupt channel + if ((err = vxi11_destroy_intr_chan()) > 0) + printf("Destroyed interrupt channel\n"); + else + printf("Error destroying interrupt channel; %s\n", geterrorstring(err)); + } else - printf("Error destroying interrupt channel; %s\n", geterrorstring(err)); + printf("Error creating interrupt channel; %s\n", geterrorstring(err)); + printf("\n"); // docmd if ((err = vxi11_docmd(0x00, false)) > 0) diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index f19f81c..7b69fc5 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -66,7 +66,7 @@ int vxi11_open(char* address, char* device) { if (clnt_control(clnt, CLGET_SERVER_ADDR, (char*) &serveraddr)) { #ifdef DEBUG char addressstring[INET_ADDRSTRLEN]; - *inet_ntop(AF_INET, &serveraddr.sin_addr, addressstring, sizeof(addressstring)); + inet_ntop(AF_INET, &serveraddr.sin_addr, addressstring, sizeof(addressstring)); printf("Remote is %s\n", addressstring); #endif serveraddr.sin_port = linkresp->abortPort; @@ -288,8 +288,12 @@ int vxi11_unlock() { int vxi11_create_intr_chan() { if (clnt == NULL) return 0; - Device_RemoteFunc remotefunc = { .hostAddr = 0x0, .hostPort = 0x0, .progNum = 0x0, .progVers = 0x0, .progFamily = - DEVICE_TCP }; + + struct sockaddr_in myaddress; + get_myaddress(&myaddress); + + Device_RemoteFunc remotefunc = { .hostAddr = myaddress.sin_addr.s_addr, .hostPort = 0x0, .progNum = DEVICE_INTR, + .progVers = DEVICE_INTR_VERSION, .progFamily = DEVICE_TCP }; Device_Error* error = create_intr_chan_1(&remotefunc, clnt); if (error != NULL && error->error == 0) return 1; -- cgit