Пример #1
0
 public TFFSNameTable(string Version, TFFSNameTableEntries Entries)
 {
     p_Version = new TFFSEnvironmentEntry(TFFSEnvironmentID.NameTableVersion, Version);
     foreach (TFFSEnvironmentID entry in Entries)
     {
         p_Entries.Add(entry, (TFFSEntryFactory.GetEntries()[entry]));
     }
     p_Order = Entries;
 }
Пример #2
0
        // generate name tables in various (known) versions
        public static TFFSNameTable GetNameTable(string Version)
        {
            TFFSNameTableEntries entries = new TFFSNameTableEntries();

            // Supported versions are between @G and @L, incl. - the differences between @G and @H are unknown - possibly the ID was
            // only incremented to reflect the new TFFS2 version support.
            // @I has introduced <linux_fs_start> and <modulemem> values.
            // @J changes are unknown, too - I could not find a source from AVM for this version, so I have implemented it as @I without
            //    <nfs> and <nfsroot> values and with correctly sorted names (alphabetically)
            // @K later has added 6490 support - more MTD definitions, crash and panic log for the 2nd system, DVB configuration, TFFS3
            //    support - which of these changes were contained in @J already, is currently unknown.
            // @L has added the individual WLAN SSID with two additional characters. Various "Mesh"-related changes have taken place in
            //    "tffs.h", but the name table was not changed anymore.
            // @M new entries were added (macwlan3 and HardwareFeatures for FRITZ!WLAN Repeater 3000, gpon_serial for Fiber models)
            // @N seems to be the same as @M, only HardwareFeatures was removed
            if (Version.CompareTo("@G") != 0 &&
                Version.CompareTo("@H") != 0 &&
                Version.CompareTo("@I") != 0 &&
                Version.CompareTo("@J") != 0 &&
                Version.CompareTo("@K") != 0 &&
                Version.CompareTo("@L") != 0 &&
                Version.CompareTo("@M") != 0 &&
                Version.CompareTo("@N") != 0)
            {
                throw new TFFSException("Only name table versions from @G (used in 2010) to @N (latest) are supported yet.");
            }

            entries.Add(TFFSEnvironmentID.AutoMDIX);
            entries.Add(TFFSEnvironmentID.DMC);

            if (Version.CompareTo("@M") == 0)
            {
                // HardwareFeatures was added in @M and seems to be removed in @N
                entries.Add(TFFSEnvironmentID.HardwareFeatures);
            }

            entries.Add(TFFSEnvironmentID.HWRevision);
            entries.Add(TFFSEnvironmentID.HWSubRevision);
            entries.Add(TFFSEnvironmentID.ProductID);
            entries.Add(TFFSEnvironmentID.SerialNumber);
            entries.Add(TFFSEnvironmentID.Annex);
            entries.Add(TFFSEnvironmentID.AutoLoad);
            entries.Add(TFFSEnvironmentID.Blob0);
            entries.Add(TFFSEnvironmentID.Blob1);
            entries.Add(TFFSEnvironmentID.Blob2);
            entries.Add(TFFSEnvironmentID.Blob3);
            entries.Add(TFFSEnvironmentID.Blob4);
            entries.Add(TFFSEnvironmentID.Blob5);
            entries.Add(TFFSEnvironmentID.Blob6);
            entries.Add(TFFSEnvironmentID.Blob7);
            entries.Add(TFFSEnvironmentID.Blob8);
            entries.Add(TFFSEnvironmentID.Blob9);
            entries.Add(TFFSEnvironmentID.BootloaderVersion);
            entries.Add(TFFSEnvironmentID.BootSerialPort);
            entries.Add(TFFSEnvironmentID.BluetoothKey);
            entries.Add(TFFSEnvironmentID.BluetoothMAC);
            entries.Add(TFFSEnvironmentID.Country);
            entries.Add(TFFSEnvironmentID.CPUFrequency);
            entries.Add(TFFSEnvironmentID.Crash);
            entries.Add(TFFSEnvironmentID.FirstFreeAddress);

            if (Version.CompareTo("@I") == 1)
            {
                // correct sort order after @I
                entries.Add(TFFSEnvironmentID.FirmwareInfo);
                entries.Add(TFFSEnvironmentID.FirmwareVersion);
            }
            else
            {
                // up to and incl. @I, these entries are out of (sort) order
                entries.Add(TFFSEnvironmentID.FirmwareVersion);
                entries.Add(TFFSEnvironmentID.FirmwareInfo);
            }

            entries.Add(TFFSEnvironmentID.FlashSize);

            if (Version.CompareTo("@L") == 1)
            {
                // gpon_serial was added in @M
                entries.Add(TFFSEnvironmentID.GPON_Serial);
            }

            entries.Add(TFFSEnvironmentID.JFFS2Size);
            entries.Add(TFFSEnvironmentID.KernelArgs);
            entries.Add(TFFSEnvironmentID.KernelArgs1);
            entries.Add(TFFSEnvironmentID.Language);

            if (Version.CompareTo("@H") == 1)
            {
                // this entry was hidden before @H (it was only a comment)
                entries.Add(TFFSEnvironmentID.LinuxFSStart);
            }

            entries.Add(TFFSEnvironmentID.MAC_A);
            entries.Add(TFFSEnvironmentID.MAC_B);
            entries.Add(TFFSEnvironmentID.MAC_WLAN);
            entries.Add(TFFSEnvironmentID.MAC_WLAN2);

            if (Version.CompareTo("@L") == 1)
            {
                // macwlan3 was added in @M
                entries.Add(TFFSEnvironmentID.MAC_WLAN3);
            }

            entries.Add(TFFSEnvironmentID.MAC_DSL);
            entries.Add(TFFSEnvironmentID.MemorySize);
            entries.Add(TFFSEnvironmentID.ModeTTY0);
            entries.Add(TFFSEnvironmentID.ModeTTY1);

            if (Version.CompareTo("@H") == 1)
            {
                // added in @I
                entries.Add(TFFSEnvironmentID.ModuleMemory);
            }

            entries.Add(TFFSEnvironmentID.MTD0);
            entries.Add(TFFSEnvironmentID.MTD1);
            entries.Add(TFFSEnvironmentID.MTD2);
            entries.Add(TFFSEnvironmentID.MTD3);
            entries.Add(TFFSEnvironmentID.MTD4);
            entries.Add(TFFSEnvironmentID.MTD5);
            entries.Add(TFFSEnvironmentID.MTD6);
            entries.Add(TFFSEnvironmentID.MTD7);

            if (Version.CompareTo("@I") == 1)
            {
                // additional MTD entries after @I
                entries.Add(TFFSEnvironmentID.MTD8);
                entries.Add(TFFSEnvironmentID.MTD9);
                entries.Add(TFFSEnvironmentID.MTD10);
                entries.Add(TFFSEnvironmentID.MTD11);
                entries.Add(TFFSEnvironmentID.MTD12);
                entries.Add(TFFSEnvironmentID.MTD13);
                entries.Add(TFFSEnvironmentID.MTD14);
                entries.Add(TFFSEnvironmentID.MTD15);
            }

            entries.Add(TFFSEnvironmentID.IPAddress);

            if (Version.CompareTo("@I") != 1)
            {
                // up to @I these two entries exist
                entries.Add(TFFSEnvironmentID.NFS);
                entries.Add(TFFSEnvironmentID.NFSRoot);
            }

            if (Version.CompareTo("@K") != -1)
            {
                // starting with @K (maybe it exists in @J already)
                entries.Add(TFFSEnvironmentID.PowerlineID);
            }

            entries.Add(TFFSEnvironmentID.EVAPrompt);
            entries.Add(TFFSEnvironmentID.Provider);
            entries.Add(TFFSEnvironmentID.ProdTest);
            entries.Add(TFFSEnvironmentID.MAC_reserved);
            entries.Add(TFFSEnvironmentID.FullRateFrequency);
            entries.Add(TFFSEnvironmentID.SysFrequency);
            entries.Add(TFFSEnvironmentID.TR069Passphrase);
            entries.Add(TFFSEnvironmentID.TR069Serial);
            entries.Add(TFFSEnvironmentID.UrladerVersion);
            entries.Add(TFFSEnvironmentID.MAC_USB_Board);

            if (Version.CompareTo("@I") == 1)
            {
                // sort order was changed here
                entries.Add(TFFSEnvironmentID.USBDeviceID);
                entries.Add(TFFSEnvironmentID.USBDeviceName);
                entries.Add(TFFSEnvironmentID.USBManufacturerName);
                entries.Add(TFFSEnvironmentID.USBRevisionID);
                entries.Add(TFFSEnvironmentID.MAC_USB_Network);
            }
            else
            {
                entries.Add(TFFSEnvironmentID.MAC_USB_Network);
                entries.Add(TFFSEnvironmentID.USBDeviceID);
                entries.Add(TFFSEnvironmentID.USBRevisionID);
                entries.Add(TFFSEnvironmentID.USBDeviceName);
                entries.Add(TFFSEnvironmentID.USBManufacturerName);
            }

            entries.Add(TFFSEnvironmentID.GUIPassword);

            if (Version.CompareTo("@I") == 1)
            {
                entries.Add(TFFSEnvironmentID.WLANCalibration);
                entries.Add(TFFSEnvironmentID.WLANKey);
            }
            else
            {
                entries.Add(TFFSEnvironmentID.WLANKey);
                entries.Add(TFFSEnvironmentID.WLANCalibration);
            }

            if (Version.CompareTo("@K") == 1)
            {
                // individual WLAN SSIDs starting with @K
                entries.Add(TFFSEnvironmentID.WLAN_SSID);
            }

            return(new TFFSNameTable(Version, entries));
        }
Пример #3
0
        // generate name tables in various (known) versions
        public static TFFSNameTable GetNameTable(string Version)
        {
            TFFSNameTableEntries entries = new TFFSNameTableEntries();

            // Supported versions are between @G and @L, incl. - the differences between @G and @H are unknown - possibly the ID was
            // only incremented to reflect the new TFFS2 version support.
            // @I has introduced <linux_fs_start> and <modulemem> values.
            // @J changes are unknown, too - I could not find a source from AVM for this version, so I have implemented it as @I without
            //    <nfs> and <nfsroot> values and with correctly sorted names (alphabetically)
            // @K later has added 6490 support - more MTD definitions, crash and panic log for the 2nd system, DVB configuration, TFFS3
            //    support - which of these changes were contained in @J already, is currently unknown.
            // @L has added the individual WLAN SSID with two additional characters. Various "Mesh"-related changes have taken place in
            //    "tffs.h", but the name table was not changed anymore.
            // @M new entries were added (macwlan3 and HardwareFeatures for FRITZ!WLAN Repeater 3000, gpon_serial for Fiber models)
            // @N seems to be the same as @M, only HardwareFeatures was removed
            //
            // !!!ATTENTION!!!
            //
            // Meanwhile it looks like someone at AVM got a bit sloppy maintaining the versions of TFFS name tables - a new entry for
            // 'SoftwareFeatures' was added to the source code package 154.07.19 (in 'drivers/char/tffs/include/uapi/avm/tffs/tffs.h),
            // while the version number stays at value '@M'. On the other hand, the kernel version is used always now - if the stored
            // version differs, it gets replaced. Some comments from 'tffs_intern.c' claim 'is not older', but it's really a check for
            // equality:
            // Meanwhile it looks like someone at AVM got a bit sloppy maintaining the versions of TFFS name tables - a new entry for
            // 'SoftwareFeatures' was added to the source code package 154.07.19 (in 'drivers/char/tffs/include/uapi/avm/tffs/tffs.h),
            // while the version number stays at value '@M'.
            // On the other hand, the kernel version is used always now - if the stored version (from TFFS) differs, it gets replaced.
            // Some comments from 'tffs_intern.c' claim an 'is not older' check, but it's really a check for equality.
            //
            // 287         if(   (T_Init[0].id == TFFS_Name_Table[0].id)
            // 288            && (T_Init[0].Name[1] == TFFS_Name_Table[0].Name[1]))
            // 289         {
            // 290             pr_info("TFFS Name Table %c\n", TFFS_Name_Table[0].Name[1]);
            // 291             need_rebuild = 0;
            // 292         }else{
            // 293             pr_warn("WARNING: TFFS Name Table update ! (current %s new %s)\n", TFFS_Name_Table[0].Name, T_Init[0].Name);
            // 294         }
            //
            // Even if the stored version is newer, it gets replaced by the version from the running kernel.

            if (Version.CompareTo("@G") != 0 &&
                Version.CompareTo("@H") != 0 &&
                Version.CompareTo("@I") != 0 &&
                Version.CompareTo("@J") != 0 &&
                Version.CompareTo("@K") != 0 &&
                Version.CompareTo("@L") != 0 &&
                Version.CompareTo("@M") != 0 &&
                Version.CompareTo("@N") != 0)
            {
                throw new TFFSException("Only name table versions from @G (used in 2010) to @N (latest) are supported yet.");
            }

            entries.Add(TFFSEnvironmentID.AutoMDIX);
            entries.Add(TFFSEnvironmentID.DMC);

            if (Version.CompareTo("@M") == 0)
            {
                // HardwareFeatures was added in @M and seems to be removed in @N
                entries.Add(TFFSEnvironmentID.HardwareFeatures);
            }

            entries.Add(TFFSEnvironmentID.HWRevision);
            entries.Add(TFFSEnvironmentID.HWSubRevision);
            entries.Add(TFFSEnvironmentID.ProductID);
            entries.Add(TFFSEnvironmentID.SerialNumber);

            if (Version.CompareTo("@M") == 0)
            {
                // SoftwareFeatures was added in @M (late) and is assumed to be removed in @N
                entries.Add(TFFSEnvironmentID.SoftwareFeatures);
            }

            entries.Add(TFFSEnvironmentID.Annex);
            entries.Add(TFFSEnvironmentID.AutoLoad);
            entries.Add(TFFSEnvironmentID.Blob0);
            entries.Add(TFFSEnvironmentID.Blob1);
            entries.Add(TFFSEnvironmentID.Blob2);
            entries.Add(TFFSEnvironmentID.Blob3);
            entries.Add(TFFSEnvironmentID.Blob4);
            entries.Add(TFFSEnvironmentID.Blob5);
            entries.Add(TFFSEnvironmentID.Blob6);
            entries.Add(TFFSEnvironmentID.Blob7);
            entries.Add(TFFSEnvironmentID.Blob8);
            entries.Add(TFFSEnvironmentID.Blob9);
            entries.Add(TFFSEnvironmentID.BootloaderVersion);
            entries.Add(TFFSEnvironmentID.BootSerialPort);
            entries.Add(TFFSEnvironmentID.BluetoothKey);
            entries.Add(TFFSEnvironmentID.BluetoothMAC);
            entries.Add(TFFSEnvironmentID.Country);
            entries.Add(TFFSEnvironmentID.CPUFrequency);
            entries.Add(TFFSEnvironmentID.Crash);
            entries.Add(TFFSEnvironmentID.FirstFreeAddress);

            if (Version.CompareTo("@I") == 1)
            {
                // correct sort order after @I
                entries.Add(TFFSEnvironmentID.FirmwareInfo);
                entries.Add(TFFSEnvironmentID.FirmwareVersion);
            }
            else
            {
                // up to and incl. @I, these entries are out of (sort) order
                entries.Add(TFFSEnvironmentID.FirmwareVersion);
                entries.Add(TFFSEnvironmentID.FirmwareInfo);
            }

            entries.Add(TFFSEnvironmentID.FlashSize);

            if (Version.CompareTo("@L") == 1)
            {
                // gpon_serial was added in @M
                entries.Add(TFFSEnvironmentID.GPON_Serial);
            }

            entries.Add(TFFSEnvironmentID.JFFS2Size);
            entries.Add(TFFSEnvironmentID.KernelArgs);
            entries.Add(TFFSEnvironmentID.KernelArgs1);
            entries.Add(TFFSEnvironmentID.Language);

            if (Version.CompareTo("@H") == 1)
            {
                // this entry was hidden before @H (it was only a comment)
                entries.Add(TFFSEnvironmentID.LinuxFSStart);
            }

            entries.Add(TFFSEnvironmentID.MAC_A);
            entries.Add(TFFSEnvironmentID.MAC_B);
            entries.Add(TFFSEnvironmentID.MAC_WLAN);
            entries.Add(TFFSEnvironmentID.MAC_WLAN2);

            if (Version.CompareTo("@L") == 1)
            {
                // macwlan3 was added in @M
                entries.Add(TFFSEnvironmentID.MAC_WLAN3);
            }

            entries.Add(TFFSEnvironmentID.MAC_DSL);
            entries.Add(TFFSEnvironmentID.MemorySize);
            entries.Add(TFFSEnvironmentID.ModeTTY0);
            entries.Add(TFFSEnvironmentID.ModeTTY1);

            if (Version.CompareTo("@H") == 1)
            {
                // added in @I
                entries.Add(TFFSEnvironmentID.ModuleMemory);
            }

            entries.Add(TFFSEnvironmentID.MTD0);
            entries.Add(TFFSEnvironmentID.MTD1);
            entries.Add(TFFSEnvironmentID.MTD2);
            entries.Add(TFFSEnvironmentID.MTD3);
            entries.Add(TFFSEnvironmentID.MTD4);
            entries.Add(TFFSEnvironmentID.MTD5);
            entries.Add(TFFSEnvironmentID.MTD6);
            entries.Add(TFFSEnvironmentID.MTD7);

            if (Version.CompareTo("@I") == 1)
            {
                // additional MTD entries after @I
                entries.Add(TFFSEnvironmentID.MTD8);
                entries.Add(TFFSEnvironmentID.MTD9);
                entries.Add(TFFSEnvironmentID.MTD10);
                entries.Add(TFFSEnvironmentID.MTD11);
                entries.Add(TFFSEnvironmentID.MTD12);
                entries.Add(TFFSEnvironmentID.MTD13);
                entries.Add(TFFSEnvironmentID.MTD14);
                entries.Add(TFFSEnvironmentID.MTD15);
            }

            entries.Add(TFFSEnvironmentID.IPAddress);

            if (Version.CompareTo("@I") != 1)
            {
                // up to @I these two entries exist
                entries.Add(TFFSEnvironmentID.NFS);
                entries.Add(TFFSEnvironmentID.NFSRoot);
            }

            if (Version.CompareTo("@K") != -1)
            {
                // starting with @K (maybe it exists in @J already)
                entries.Add(TFFSEnvironmentID.PowerlineID);
            }

            entries.Add(TFFSEnvironmentID.EVAPrompt);
            entries.Add(TFFSEnvironmentID.Provider);
            entries.Add(TFFSEnvironmentID.ProdTest);
            entries.Add(TFFSEnvironmentID.MAC_reserved);
            entries.Add(TFFSEnvironmentID.FullRateFrequency);
            entries.Add(TFFSEnvironmentID.SysFrequency);
            entries.Add(TFFSEnvironmentID.TR069Passphrase);
            entries.Add(TFFSEnvironmentID.TR069Serial);
            entries.Add(TFFSEnvironmentID.UrladerVersion);
            entries.Add(TFFSEnvironmentID.MAC_USB_Board);

            if (Version.CompareTo("@I") == 1)
            {
                // sort order was changed here
                entries.Add(TFFSEnvironmentID.USBDeviceID);
                entries.Add(TFFSEnvironmentID.USBDeviceName);
                entries.Add(TFFSEnvironmentID.USBManufacturerName);
                entries.Add(TFFSEnvironmentID.USBRevisionID);
                entries.Add(TFFSEnvironmentID.MAC_USB_Network);
            }
            else
            {
                entries.Add(TFFSEnvironmentID.MAC_USB_Network);
                entries.Add(TFFSEnvironmentID.USBDeviceID);
                entries.Add(TFFSEnvironmentID.USBRevisionID);
                entries.Add(TFFSEnvironmentID.USBDeviceName);
                entries.Add(TFFSEnvironmentID.USBManufacturerName);
            }

            entries.Add(TFFSEnvironmentID.GUIPassword);

            if (Version.CompareTo("@I") == 1)
            {
                entries.Add(TFFSEnvironmentID.WLANCalibration);
                entries.Add(TFFSEnvironmentID.WLANKey);
            }
            else
            {
                entries.Add(TFFSEnvironmentID.WLANKey);
                entries.Add(TFFSEnvironmentID.WLANCalibration);
            }

            if (Version.CompareTo("@K") == 1)
            {
                // individual WLAN SSIDs starting with @K
                entries.Add(TFFSEnvironmentID.WLAN_SSID);
            }

            return(new TFFSNameTable(Version, entries));
        }