remove unneeded include for usb.h
[rigol] / scope.c
diff --git a/scope.c b/scope.c
index 806ba3475ca2f417479df1272c6180d29a9e285d..c316ee527e3f021eb52c6130d958fe6f6b8b85e8 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -1,54 +1,50 @@
-#include <usb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <stdint.h>
 
-#include "usbtmc.h"
 #include "scope.h"
+#include "usbtmc.h"
 
 /* Just USB for now... */
 int sendscpi(struct scope* sc, char* cmd, unsigned char *resp, int resplen)
 {
-       return usbtmc_sendscpi(sc->usbdev, cmd, resp, resplen);
+       return usbtmc_sendscpi(sc, cmd, resp, resplen);
 }
 
 void closescope(struct scope* sc)
 {
-       return usbtmc_close(sc->usbdev);
+       return usbtmc_close(sc);
 }
 
 void claimscope(struct scope* sc)
 {
-       return usbtmc_claim(sc->usbdev);
+       return usbtmc_claim(sc);
 }
 
 void releasescope(struct scope* sc)
 {
-       //Disable keylock, so the user doesn't have to press the 'force'-button
+       /* Disable keylock, so the user doesn't have to press the 'force'-button */
        sendscpi(sc, ":KEY:LOCK DISABLE",NULL,0); 
-       return usbtmc_release(sc->usbdev);
+       return usbtmc_release(sc);
+}
+
+void resetscope(struct scope* sc)
+{
+       return usbtmc_reset(sc);
 }
 
 struct scope* initscope(void)
 {
-       struct usb_dev_handle *usbdev;
        struct scope *sc;
 
-       usbdev = usbtmc_initscope();
+       sc = usbtmc_initscope();
 
-       if (!usbdev) {
+       if (!sc) {
                printf("No scope found.\n");
                exit(EXIT_FAILURE);
        }
 
-       sc = calloc(1, sizeof(struct scope));
-       if (sc == NULL) {
-               perror("malloc");
-               exit(EXIT_FAILURE);
-       }
-
-       sc->usbdev = usbdev;
-
        claimscope(sc);
        sendscpi(sc, "*IDN?", (unsigned char*)sc->idn, sizeof(sc->idn)); 
        releasescope(sc);
Impressum, Datenschutz