Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 9159)
+++ /trunk/ippTools/src/dettool.c	(revision 9160)
@@ -64,4 +64,5 @@
 static psArray *searchRawImfiles(pxConfig *config, psMetadata *where);
 static psS32 incrementIteration(pxConfig *config, const char *det_id);
+static bool setDetRunState(pxConfig *config, const char *det_id, const char *state);
 
 # define MODECASE(caseName, func) \
@@ -273,5 +274,5 @@
     // the first iteration is always 0
     // XXX the camera name is set from the first inputExp
-    detRunInsert(config->dbh, 0, det_type);
+    detRunInsert(config->dbh, 0, det_type, "run");
     long det_id = psDBLastInsertID(config->dbh);
 
@@ -478,5 +479,5 @@
     // the first iteration is always 0
     // XXX the camera name is set from the first inputExp
-    detRunInsert(config->dbh, 0, det_type);
+    detRunInsert(config->dbh, 0, det_type, "run");
     long det_id = psDBLastInsertID(config->dbh);
 
@@ -4389,7 +4390,7 @@
     }
 
-    // XXX stop deson't actually do anything at this point
     if (stop) {
-        return true;
+        // set detRun.state to stop
+        return setDetRunState(config, det_id, "stop");
     }
 
@@ -4846,2 +4847,16 @@
 }
 
+static bool setDetRunState(pxConfig *config, const char *det_id, const char *state)
+{
+    PS_ASSERT_PTR_NON_NULL(det_id, false);
+    PS_ASSERT_PTR_NON_NULL(state, false);
+
+    char *query = "UPDATE detRun SET state = '%s' WHERE position = '%s'";
+    if (!p_psDBRunQuery(config->dbh, query, state, det_id)) {
+        psError(PS_ERR_UNKNOWN, false,
+                "failed to change state for det_id %s", det_id);
+        return false;
+    }
+
+    return true;
+}
