Index: src/corelib/global/qglobal.cpp
===================================================================
--- src/corelib/global/qglobal.cpp	(revision 1107)
+++ src/corelib/global/qglobal.cpp	(working copy)
@@ -1271,6 +1271,8 @@
     \value OV_ECS_1_1           eComStation 1.1
     \value OV_ECS_1_2           eComStation 1.2
     \value OV_ECS_2_0           eComStation 2.0 (either any of RCs or GA)
+    \value OV_ECS_2_1           eComStation 2.1 (either any of RCs or GA)
+    \value OV_ECS_2_2           eComStation 2.2 (either any of RCs or GA)
 
     The following masks can be used for detecting properties common to a group
     of versions:
@@ -1971,16 +1973,35 @@
 // Returns a version number of the component taken directly from its SYSLEVEL
 // file (see http://www.edm2.com/index.php/Using_SYSLEVEL_Files_in_Your_Applications
 // for more information about SYSLEVEL file internals)
-static bool getSyslevelVersion(const QByteArray &fileName, char (*version)[2])
+// beginning from ecs 2.1 they changed the detection scheme once more
+// the information is now in the ecs_inst.flg file as plain text
+// the below function deals with both
+ enum fileType {
+    SysLevel,
+    eCSFlg };
+
+static bool getSyslevelVersion(const QByteArray &fileName, char *version, fileType ft)
 {
     bool success = false;
+    int offSet;
+    size_t bytesToR;
+
+    if (ft == SysLevel)
+    {
+        offSet = 0x28;
+        bytesToR = 2;
+    } else {
+        offSet = 0x0C;
+        bytesToR = 3;
+    }
+
     FILE *f = fopen(fileName, "rb");
     if (!f)
         return success;
-    // go to the char d_version[2] field of the SYSLEVEL data structure
-    if ((success = fseek(f, 0x28, SEEK_SET) == 0)) {
+    // go to the offset of the data structure
+    if ((success = fseek(f, offSet, SEEK_SET) == 0)) {
         // read in two bytes
-        success = fread(*version, 1, 2, f) == 2;
+        success = fread(version, 1, bytesToR, f) == bytesToR;
     }
     fclose(f);
     return success;
@@ -2025,14 +2046,14 @@
     QByteArray fn = QByteArray("A:\\OS2\\INSTALL\\SYSLEVEL.OS2");
     fn.data()[0] += buf[0] - 1;
     char sys_os2_ver[2];
-    if (!getSyslevelVersion(fn, &sys_os2_ver))
+    if (!getSyslevelVersion(fn, sys_os2_ver, SysLevel))
         return os2ver;
 
     // read SYSLEVEL.ECS
     fn = QByteArray("A:\\OS2\\INSTALL\\SYSLEVEL.ECS");
     fn.data()[0] += buf[0] - 1;
     char sys_ecs_ver[2];
-    if (!getSyslevelVersion(fn, &sys_ecs_ver)) {
+    if (!getSyslevelVersion(fn, sys_ecs_ver, SysLevel)) {
         // no or broken SYSLEVEL.ECS, it's either eCS 1.1 or below or non-eCS
         bool have_ecsreg = false;
         bool have_ecsreg11 = false;
@@ -2049,7 +2070,7 @@
         if (have_ecsreg)
             return os2ver = OV_ECS_1_0;
         // detect WSeB (4.52)
-        if (sys_os2_ver[0] == 0x45 &&sys_os2_ver[1] == 0x02)
+        if (sys_os2_ver[0] == 0x45 && sys_os2_ver[1] == 0x02)
             return os2ver = OV_4_52;
         // fallback to Aurora (QSV_VERSION_MINOR is 45 here)
         return os2ver = OV_4_5;
@@ -2058,8 +2079,21 @@
     // detect eCS >= 1.2
     if (sys_ecs_ver[0] == 0x12 && sys_ecs_ver[1] == 0x00)
         return os2ver = OV_ECS_1_2;
-    if (sys_ecs_ver[0] == 0x20 && sys_ecs_ver[1] == 0x00)
-        return os2ver = OV_ECS_2_0;
+    if (sys_ecs_ver[0] >= 0x20 && sys_ecs_ver[1] == 0x00)
+    {
+        os2ver = OV_ECS_2_0;
+        // read ecs_inst.flg
+        char flg_ecs_ver[3];
+        fn = QByteArray("A:\\ECS\\ECS_INST.FLG");
+        fn.data()[0] += buf[0] - 1;
+        if (getSyslevelVersion(fn, flg_ecs_ver, eCSFlg)) {
+           if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '1')
+               os2ver = OV_ECS_2_1;
+           if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '2')
+               os2ver = OV_ECS_2_2;
+        }
+        return os2ver;
+    }
 
     return os2ver = OV_ECS_Unknown;
 }
Index: src/corelib/global/qglobal.h
===================================================================
--- src/corelib/global/qglobal.h	(revision 1107)
+++ src/corelib/global/qglobal.h	(working copy)
@@ -1566,6 +1566,8 @@
         OV_ECS_1_1      = 0x06010100,
         OV_ECS_1_2      = 0x06010200,
         OV_ECS_2_0      = 0x06020000,
+        OV_ECS_2_1      = 0x06020100,
+        OV_ECS_2_2      = 0x06020200,
 
         /* version masks */
         OV_WARP3        = 0x01000000,
