export reset functionality
authorMichael Gernoth <michael@gernoth.net>
Wed, 9 Jun 2010 07:43:05 +0000 (09:43 +0200)
committerMichael Gernoth <michael@gernoth.net>
Wed, 9 Jun 2010 07:43:05 +0000 (09:43 +0200)
scope.c
scope.h
usbtmc.c
usbtmc.h

diff --git a/scope.c b/scope.c
index d2bae1324d3bfe42a67d46f491febc0c07ec0e49..d6aff93bf9a81a71a383cbdd9703ce3674085920 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -25,11 +25,16 @@ void claimscope(struct scope* 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);
 }
 
+void resetscope(struct scope* sc)
+{
+       return usbtmc_reset(sc);
+}
+
 struct scope* initscope(void)
 {
        struct scope *sc;
diff --git a/scope.h b/scope.h
index 9eafd91e7a658de72387bc7cce861f574df0bad1..2f3a61ab3d21c3ff3856f1b4e71033303f469460 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -16,4 +16,5 @@ struct scope* initscope(void);
 void closescope(struct scope* sc);
 void claimscope(struct scope* sc);
 void releasescope(struct scope* sc);
+void resetscope(struct scope* sc);
 char *scope_idn(struct scope *sc);
index 84df109b6778a82dcd15396878bbf40c16466abc..b29f4e77919a4a69ddef7430e1d4d84f9b36fd6d 100644 (file)
--- a/usbtmc.c
+++ b/usbtmc.c
@@ -134,6 +134,12 @@ static struct usbtmc_capabilities* usbtmc_get_capabilities(struct scope *sc)
        return &res;
 }
 
+void usbtmc_reset(struct scope *sc)
+{
+       usb_reset(sc->usb.dev);
+       usbtmc_claim(sc);
+}
+
 static void usbtmc_clear(struct scope *sc)
 {
        int r;
@@ -147,8 +153,7 @@ static void usbtmc_clear(struct scope *sc)
        
        if ((r != 1) || status[0] != USBTMC_STATUS_SUCCESS) {
                printf("INITIATE_CLEAR failed (0x%x): %s\n", status[0], usb_strerror());
-               usb_reset(sc->usb.dev);
-               usbtmc_claim(sc);
+               usbtmc_reset(sc);
                return;
        }
 
index 3734ff5d3aa0a4d11517f39d9e31c422e8cdbcbf..97e7d12b48d91a845539b71ff874e4d969634f11 100644 (file)
--- a/usbtmc.h
+++ b/usbtmc.h
@@ -72,3 +72,4 @@ struct scope * usbtmc_initscope(void);
 void usbtmc_close(struct scope *sc);
 void usbtmc_claim(struct scope *sc);
 void usbtmc_release(struct scope *sc);
+void usbtmc_reset(struct scope *sc);
Impressum, Datenschutz