From 10ca7ea8e832f80e144a7a4f67ff2bda310f3bb2 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 9 Jun 2010 09:43:05 +0200 Subject: [PATCH] export reset functionality --- scope.c | 7 ++++++- scope.h | 1 + usbtmc.c | 9 +++++++-- usbtmc.h | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scope.c b/scope.c index d2bae13..d6aff93 100644 --- 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 9eafd91..2f3a61a 100644 --- 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); diff --git a/usbtmc.c b/usbtmc.c index 84df109..b29f4e7 100644 --- 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; } diff --git a/usbtmc.h b/usbtmc.h index 3734ff5..97e7d12 100644 --- 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); -- 2.39.5