]> git.zerfleddert.de Git - rigol/commitdiff
add struct for usbtmc header
authorMichael Gernoth <michael@gernoth.net>
Mon, 7 Jun 2010 07:59:21 +0000 (09:59 +0200)
committerMichael Gernoth <michael@gernoth.net>
Mon, 7 Jun 2010 07:59:21 +0000 (09:59 +0200)
scope.c
usbtmc.c
usbtmc.h

diff --git a/scope.c b/scope.c
index 3152243733ee7f1869ff4f35ebdf388a11c5aa00..806ba3475ca2f417479df1272c6180d29a9e285d 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -36,8 +36,10 @@ struct scope* initscope(void)
 
        usbdev = usbtmc_initscope();
 
 
        usbdev = usbtmc_initscope();
 
-       if (!usbdev)
-               return NULL;
+       if (!usbdev) {
+               printf("No scope found.\n");
+               exit(EXIT_FAILURE);
+       }
 
        sc = calloc(1, sizeof(struct scope));
        if (sc == NULL) {
 
        sc = calloc(1, sizeof(struct scope));
        if (sc == NULL) {
index 622ea8099914c8f26746ef288d4e6483a8b29308..32f83a86d44ce4e0f413df5cc14ca2ef9f77dd1e 100644 (file)
--- a/usbtmc.c
+++ b/usbtmc.c
@@ -126,8 +126,7 @@ usb_dev_handle* usbtmc_initscope(void) {
        //Locate and open the scope
        dev = usbtmc_find_scope();
        if (!dev) {
        //Locate and open the scope
        dev = usbtmc_find_scope();
        if (!dev) {
-               printf("No scope found.\n");
-               exit(1);
+               return NULL;
        }
        usbtmc_claim(dev);
        //The following code isn't really necessary, the program works
        }
        usbtmc_claim(dev);
        //The following code isn't really necessary, the program works
index 1ac3005e233ccaf4d4db277167d64997daf3304f..bae36da5468508feec29615ded18dd04b7c9a29a 100644 (file)
--- a/usbtmc.h
+++ b/usbtmc.h
@@ -1,3 +1,22 @@
+struct usbtmc_header {
+       unsigned char MsgID;
+       unsigned char bTag;
+       unsigned char bTagInverse;
+       unsigned char Reserved3;
+       uint32_t TransferSize;
+       unsigned char bmTransferAttributes;
+       unsigned char TermChar; /* Only in REQUEST_DEV_DEP_MSG_IN */
+       unsigned char Reverved10;
+       unsigned char Reverved11;
+} __attribute__ ((__packed__));
+
+#define USBTMC_DEV_DEP_MSG_OUT         0x1
+#define USBTMC_REQUEST_DEV_DEP_MSG_IN  0x2
+#define USBTMC_DEV_DEP_MSG_IN          0x2
+
+#define USBTMC_TRANSFERATTRIB_EOM      (1<<0)
+#define USBTMC_TRANSFERATTRIB_TERMCHAR (1<<1)
+
 int usbtmc_sendscpi(struct usb_dev_handle *dev, char* cmd, unsigned char *resp, int resplen);
 struct usb_dev_handle* usbtmc_initscope(void);
 void usbtmc_close(struct usb_dev_handle *sc);
 int usbtmc_sendscpi(struct usb_dev_handle *dev, char* cmd, unsigned char *resp, int resplen);
 struct usb_dev_handle* usbtmc_initscope(void);
 void usbtmc_close(struct usb_dev_handle *sc);
Impressum, Datenschutz