Index: trunk/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 9290)
+++ trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 9437)
@@ -247,4 +247,5 @@
             formatName = words->data[1];
             file->camera = pmConfigCameraByName(config, words->data[0]);
+            // XXX do we need to save the camera name?
             if (!file->camera) {
                 psError(PS_ERR_IO, false, "camera %s not found\n", (char *)words->data[0]);
@@ -611,4 +612,8 @@
         return NULL;
     }
+    // a camera config is needed (as source of file rule)
+    if (config->cameraName == NULL) {
+        psAbort ("pmFPAfileDefine", "camera defined but not cameraName!");
+    }
 
     // find or define a pmFPAfile with this name
@@ -633,20 +638,14 @@
     // detselect -camera (camera) -time (time) -type (type) [others]
     // camera and time are functions of (pmFPA *input)
-
-    // XXX does this do something NASTY to the stack??
+    // XXX we need to get the time, but we don't have the CELL.TIME yet set (no CELL yet read)
+    // add other options here f(pmFPA *input, type)
     psTime *time = psTimeGetNow (PS_TIME_TAI);
-
-    psString camera = psStringCopy ("megacam");
-    pmDetrendSelectOptions *options = pmDetrendSelectOptionsAlloc(camera, *time, type);
-    psFree (camera);
+    pmDetrendSelectOptions *options = pmDetrendSelectOptionsAlloc(config->cameraName, *time, type);
     psFree (time);
-
-    // add other options here f(pmFPA *input, type)
 
     // search for existing detrend data (detID)
     pmDetrendSelectResults *results = pmDetrendSelect (options);
     if (!results) {
-        psLogMsg ("pmFPAfile", 2, "no matching detrend data");
-        psError (PS_ERR_IO, true, "no matching detrend data");
+        psError (PS_ERR_IO, false, "no matching detrend data");
         return NULL;
     }
