diff -rU 2 org/conf.c patchREV548/conf.c
--- org/conf.c	2011-12-05 00:49:49.000000000 +0100
+++ patchREV548/conf.c	2011-12-04 22:47:59.000000000 +0100
@@ -1113,5 +1113,5 @@
     "# Tracking (Pan/Tilt)\n"
     "############################################################\n\n"
-    "# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo)\n"
+    "# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo, 7=FI8918W)\n"
     "# The generic type enables the definition of motion center and motion size to\n"
     "# be used with the conversion specifiers for options like on_motion_detected",
@@ -1256,5 +1256,7 @@
     {
     "track_speed",
-    "# Speed to set the motor to (stepper motor option) (default: 255)",
+    "# Speed to set the motor to (stepper motor option) (default: 255)\n"
+    "# or FI8918W cam PAN speed (default: 700)\n"
+    "# meaning 700 px/sec. when FI8918W external own PTz speed is set to 0.",
     0,
     TRACK_OFFSET(speed),
diff -rU 2 org/motion-dist.conf.in patchREV548/motion-dist.conf.in
--- org/motion-dist.conf.in	2011-12-05 00:49:35.000000000 +0100
+++ patchREV548/motion-dist.conf.in	2011-12-02 23:13:11.000000000 +0100
@@ -514,5 +514,5 @@
 #############################################################
 
-# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo)
+# Type of tracker (0=none (default), 1=stepper, 2=iomojo, 3=pwc, 4=generic, 5=uvcvideo, 6=servo, 7=FI8918W)
 # The generic type enables the definition of motion center and motion size to
 # be used with the conversion specifiers for options like on_motion_detected
@@ -572,6 +572,8 @@
 track_move_wait 10
 
-# Speed to set the motor to (stepper motor option) (default: 255)
-track_speed 255
+# Speed to set the motor to (stepper motor option 255)
+# or FI8918W cam step speed (default: 700)
+# meaning 700 px/sec when FI8918W external PTz speed is set to 0.
+track_speed 700
 
 # Number of steps to make (stepper motor option) (default: 40)
diff -rU 2 org/track.c patchREV548/track.c
--- org/track.c	2011-12-05 00:49:22.000000000 +0100
+++ patchREV548/track.c	2011-12-02 22:26:34.000000000 +0100
@@ -47,4 +47,5 @@
 static unsigned int stepper_center(struct context *cnt, int xoff, int yoff ATTRIBUTE_UNUSED);
 static unsigned int iomojo_center(struct context *cnt, int xoff, int yoff);
+static unsigned int fi8918w_center(struct context *cnt, int xoff, int yoff ATTRIBUTE_UNUSED);
 
 static unsigned int stepper_move(struct context *cnt, struct coord *cent, struct images *imgs);
@@ -52,4 +53,5 @@
                                      struct images *imgs, unsigned int manual);
 static unsigned int iomojo_move(struct context *cnt, int dev, struct coord *cent, struct images *imgs);
+static unsigned int fi8918w_move(struct context *cnt, struct coord *cent, struct images *imgs);
 
 #if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
@@ -92,6 +94,8 @@
     else if (cnt->track.type == TRACK_TYPE_IOMOJO)
         return iomojo_center(cnt, xoff, yoff);
+    else if (cnt->track.type == TRACK_TYPE_FI8918W)
+        return fi8918w_center(cnt, xoff, yoff);
     else if (cnt->track.type == TRACK_TYPE_GENERIC)
-        return 10; // FIX ME. I chose to return something reasonable.
+        return cnt->track.move_wait; // FIX ME. I chose to return something reasonable.
 
     MOTION_LOG(ERR, TYPE_TRACK, SHOW_ERRNO, "%s: internal error, %hu is not a known track-type",
@@ -123,4 +127,6 @@
     else if (cnt->track.type == TRACK_TYPE_IOMOJO)
         return iomojo_move(cnt, dev, cent, imgs);
+    else if (cnt->track.type == TRACK_TYPE_FI8918W)
+        return fi8918w_move(cnt, cent, imgs);
     else if (cnt->track.type == TRACK_TYPE_GENERIC)
         return cnt->track.move_wait; // FIX ME. I chose to return something reasonable.
@@ -909,4 +915,168 @@
 /******************************************************************************
 
+ *   Foscam FI8918W network camera tracking code by Inzebaba
+ *   http://www.lavrsen.dk/twiki/bin/view/Motion/MotionTracking
+ *   Experimental 1rst approach with external ksh driver
+******************************************************************************/
+/**
+ * FI8918W_command
+ *      Execute 'command' with 'arg' as its argument.
+ *      if !arg command is started with no arguments
+ *      Before we call execl we need to close all the file handles
+ *      that the fork inherited from the parent in order not to pass
+ *      the open handles on to the shell
+ */
+static void FI8918W_command(char *command)
+{
+    if (!fork()) {
+        int i;
+
+        /* Detach from parent */
+        setsid();
+
+        /*
+         * Close any file descriptor except console because we will
+         * like to see error messages
+         */
+        for (i = getdtablesize(); i > 2; --i)
+            close(i);
+
+        execl("/bin/sh", "sh", "-c", command, " &", NULL);
+
+        /* if above function succeeds the program never reach here */
+        MOTION_LOG(ALR, TYPE_TRACK, SHOW_ERRNO, "%s: Unable to start external FI8918W driver '%s'",
+                   command);
+
+        exit(1);
+    }
+
+    MOTION_LOG(DBG, TYPE_TRACK, NO_ERRNO, "%s: external FI8918W driver runs '%s'",
+               command);
+}
+
+    // Goto to predefined position number 0 rather than center which is unusefull.
+static unsigned int fi8918w_center(struct context *cnt, int x_offset, int y_offset)
+{
+    MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Reseting FI8918W camera to starting position");
+    FI8918W_command("/usr/local/bin/FI8918W-PTz.ksh -goto 0");
+    return cnt->track.move_wait * 3;
+}
+
+static unsigned int fi8918w_move(struct context *cnt, struct coord *cent, struct images *imgs)
+{
+    int area_minx[9], area_miny[9], area_maxx[9], area_maxy[9];
+    int i;
+    int delta_x = abs(cent->x - (imgs->width / 2));
+    int delta_y = abs(cent->y - (imgs->height / 2));
+    char mv_cmd [PATH_MAX];
+    int step_size;
+
+
+    /* Initialize area detection */
+    area_minx[0] = area_minx[3] = area_minx[6] = 0;
+    area_miny[0] = area_miny[1] = area_miny[2] = 0;
+
+    area_minx[1] = area_minx[4] = area_minx[7] = imgs->width / 8 * 3;
+    area_maxx[0] = area_maxx[3] = area_maxx[6] = imgs->width / 8 * 3;
+
+    area_minx[2] = area_minx[5] = area_minx[8] = imgs->width / 8 * 5;
+    area_maxx[1] = area_maxx[4] = area_maxx[7] = imgs->width / 8 * 5;
+
+    area_miny[3] = area_miny[4] = area_miny[5] = imgs->height / 4;
+    area_maxy[0] = area_maxy[1] = area_maxy[2] = imgs->height / 4;
+
+    area_miny[6] = area_miny[7] = area_miny[8] = imgs->height / 4 * 3;
+    area_maxy[3] = area_maxy[4] = area_maxy[5] = imgs->height / 4 * 3;
+
+    area_maxx[2] = area_maxx[5] = area_maxx[8] = imgs->width;
+    area_maxy[6] = area_maxy[7] = area_maxy[8] = imgs->height;
+
+    // TO DO : optimisation shoould not waste time with center area
+    for (i = 0; i < 9; i++) {
+      if (cent->x > area_minx[i] && cent->x < area_maxx[i] &&
+          cent->y > area_miny[i] && cent->y < area_maxy[i]) {
+          MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Motion in Sharp area %d detected.",
+                                     i + 1);
+          break;
+       }
+    }
+
+    switch (i) {
+    case 0:
+		if (delta_y < delta_x) {
+			step_size = delta_y;
+		} else {
+			step_size = delta_x;
+		}
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving LEFT_UP %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv LEFT_UP %d", step_size);
+        break;
+    case 1:
+        step_size = delta_y;
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving UP %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv UP %d", step_size);
+        break;
+    case 2:
+        if (delta_y < delta_x) {
+			step_size = delta_y;
+		} else {
+			step_size = delta_x;
+		}
+		MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving RIGHT_UP %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv RIGHT_UP %d", step_size);
+        break;
+    case 3:
+        step_size = delta_x;
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving LEFT %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv LEFT %d", step_size);
+        break;
+    case 4:
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Cam is CENTERED");
+        return 0;
+    case 5:
+        step_size = delta_x;
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving RIGHT %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv RIGHT %d", delta_x);
+        break;
+    case 6:
+        if (delta_y < delta_x) {
+			step_size = delta_y;
+		} else {
+			step_size = delta_x;
+		}
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving LEFT_DOWN %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv LEFT_DOWN %d", step_size);
+        break;
+    case 7:
+        step_size = delta_y;
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: moving DOWN %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv DOWN %d", step_size);
+        break;
+    case 8:
+        if (delta_y < delta_x) {
+			step_size = delta_y;
+		} else {
+			step_size = delta_x;
+		}
+        MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: Moving RIGHT_DOWN %d", step_size);
+        sprintf(mv_cmd, "/usr/local/bin/FI8918W-PTz.ksh -mv RIGHT_DOWN %d", step_size);
+        break;
+    default:
+        MOTION_LOG(ALR, TYPE_TRACK, SHOW_ERRNO, "%s: (FI8918W) Wrong area detection.");
+        return 0;
+    }
+  
+    FI8918W_command(mv_cmd);
+    /* Number of frames to skip while moving :
+    The number of frames to skeep depends on cam fps and Driver speed depends 
+	on FI8918W PTz external setted speed. Thus lets assume that track.move_wait
+	is set equal to nb fps and cnt->track.speed is set to speed in 
+	nb pixels move per secondes*/
+    MOTION_LOG(NTC, TYPE_TRACK, NO_ERRNO, "%s: DBG : Skipping %d detection frames",
+             (int)(cnt->track.move_wait * step_size / cnt->track.speed));
+    return cnt->track.move_wait * step_size / cnt->track.speed;
+}
+/******************************************************************************
+
     Logitech QuickCam Sphere camera tracking code by oBi
 
diff -rU 2 org/track.h patchREV548/track.h
--- org/track.h	2011-12-05 00:49:22.000000000 +0100
+++ patchREV548/track.h	2011-12-02 16:57:20.000000000 +0100
@@ -43,4 +43,5 @@
 extern struct trackoptions track_template;
 
+
 unsigned int track_center(struct context *, int, unsigned int, int, int);
 unsigned int track_move(struct context *, int, struct coord *, struct images *, unsigned int);
@@ -58,4 +59,5 @@
 #define TRACK_TYPE_UVC          5
 #define TRACK_TYPE_SERVO        6
+#define TRACK_TYPE_FI8918W      7
 
 /*
