Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 10124)
+++ trunk/ippTools/src/dettool.c	(revision 10150)
@@ -80,4 +80,5 @@
 static psS32 incrementIteration(pxConfig *config, const char *det_id);
 static bool setDetRunState(pxConfig *config, const char *det_id, const char *state);
+static bool isValidMode(pxConfig *config, const char *mode);
 
 # define MODECASE(caseName, func) \
@@ -232,4 +233,15 @@
 
     // optional
+    psString det_mode = psMetadataLookupStr(&status, config->args, "-det_mode");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_mode");
+        return false;
+    }
+    // check det_mode
+    if (det_mode && !isValidMode(config, det_mode)) {
+        psError(PS_ERR_UNKNOWN, false, "invalud det_mode");
+        return false;
+    }
+
     psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
     if (!status) {
@@ -392,4 +404,5 @@
             0,
             det_type,
+            det_mode,
             "run",
             exp_type,
@@ -601,4 +614,15 @@
 
     // optional
+    psString det_mode = psMetadataLookupStr(&status, config->args, "-det_mode");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_mode");
+        return false;
+    }
+    // check det_mode
+    if (det_mode && !isValidMode(config, det_mode)) {
+        psError(PS_ERR_UNKNOWN, false, "invalud det_mode");
+        return false;
+    }
+
     psString exp_type = psMetadataLookupStr(&status, config->args, "-set_exp_type");
     if (!status) {
@@ -709,4 +733,5 @@
             0,
             det_type,
+            det_mode,
             "run",
             exp_type,
@@ -856,4 +881,29 @@
 
     // walk through the optional values and update the detRun as required
+    psString det_type = psMetadataLookupStr(&status, config->args, "-set_det_type");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_det_type");
+        return false;
+    }
+    if (det_type) {
+        psFree(detRun->det_type);
+        detRun->det_type = psStringCopy(det_type);
+    }
+
+    psString det_mode = psMetadataLookupStr(&status, config->args, "-set_det_mode");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_det_mode");
+        return false;
+    }
+    // check det_mode
+    if (det_mode && !isValidMode(config, det_mode)) {
+        psError(PS_ERR_UNKNOWN, false, "invalud det_mode");
+        return false;
+    }
+    if (det_mode) {
+        psFree(detRun->det_mode);
+        detRun->det_mode = psStringCopy(det_mode);
+    }
+
     psString exp_type = psMetadataLookupStr(&status, config->args, "-set_exp_type");
     if (!status) {
@@ -4973,4 +5023,15 @@
 
     // everything else is optional
+    psString det_mode = psMetadataLookupStr(&status, config->args, "-det_mode");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_mode");
+        return false;
+    }
+    // check det_mode
+    if (det_mode && !isValidMode(config, det_mode)) {
+        psError(PS_ERR_UNKNOWN, false, "invalud det_mode");
+        return false;
+    }
+
     psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
     if (!status) {
@@ -5087,4 +5148,5 @@
             0,  // the iteration is fixed at 0
             det_type,
+            det_mode,
             "reg",
             exp_type,
@@ -5289,2 +5351,21 @@
     return true;
 }
+
+static bool isValidMode(pxConfig *config, const char *mode)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_PTR_NON_NULL(mode, false);
+
+    // check that state is a valid string value
+    if (!(
+            (strncmp(mode, "create", 7) == 0) 
+            || (strncmp(mode, "verify", 7) == 0) 
+        )
+    ) {
+        psError(PS_ERR_UNKNOWN, false,
+                "invalid detRun mode: %s", mode);
+        return false;
+    }
+
+    return true;
+}
