Пример #1
0
        private void UnlockControllerForEepromReadWrite(IKW1281Dialog kwp1281)
        {
            switch ((ControllerAddress)_controllerAddress)
            {
            case ControllerAddress.CCM:
            case ControllerAddress.CentralLocking:
                kwp1281.Login(code: 19283, workshopCode: 222);     // This is what VDS-PRO uses
                break;

            case ControllerAddress.Cluster:
                // TODO:UnlockCluster() is only needed for EEPROM read, not memory read
                if (!VdoCluster.UnlockCluster(kwp1281))
                {
                    Logger.WriteLine("Unknown cluster software version. EEPROM access will likely fail.");
                }

                if (!ClusterRequiresSeedKey(kwp1281))
                {
                    Logger.WriteLine(
                        "Cluster is unlocked for EEPROM access. Skipping Seed/Key login.");
                    return;
                }

                ClusterSeedKeyAuthenticate(kwp1281);
                break;
            }
        }
Пример #2
0
        private void DumpCcmRom(IKW1281Dialog kwp1281)
        {
            if (_controllerAddress != (int)ControllerAddress.CCM &&
                _controllerAddress != (int)ControllerAddress.CentralLocking)
            {
                Logger.WriteLine("Only supported for CCM and Central Locking");
                return;
            }

            kwp1281.Login(19283, 222);

            var        dumpFileName = _filename ?? "ccm_rom_dump.bin";
            const byte blockSize    = 8;

            Logger.WriteLine($"Saving CCM ROM to {dumpFileName}");

            bool succeeded = true;

            using (var fs = File.Create(dumpFileName, blockSize, FileOptions.WriteThrough))
            {
                for (int seg = 0; seg < 16; seg++)
                {
                    for (int msb = 0; msb < 16; msb++)
                    {
                        for (int lsb = 0; lsb < 256; lsb += blockSize)
                        {
                            var blockBytes = kwp1281.ReadCcmRom((byte)seg, (byte)msb, (byte)lsb, blockSize);
                            if (blockBytes == null)
                            {
                                blockBytes = Enumerable.Repeat((byte)0, blockSize).ToList();
                                succeeded  = false;
                            }
                            else if (blockBytes.Count < blockSize)
                            {
                                blockBytes.AddRange(Enumerable.Repeat((byte)0, blockSize - blockBytes.Count));
                                succeeded = false;
                            }

                            fs.Write(blockBytes.ToArray(), 0, blockBytes.Count);
                            fs.Flush();
                        }
                    }
                }
            }

            if (!succeeded)
            {
                Logger.WriteLine();
                Logger.WriteLine("**********************************************************************");
                Logger.WriteLine("*** Warning: Some bytes could not be read and were replaced with 0 ***");
                Logger.WriteLine("**********************************************************************");
                Logger.WriteLine();
            }
        }
Пример #3
0
        private void DelcoVWPremium5SafeCode(IKW1281Dialog kwp1281)
        {
            if (_controllerAddress != (int)ControllerAddress.RadioManufacturing)
            {
                Logger.WriteLine("Only supported for radio manufacturing address 7C");
                return;
            }

            // Thanks to Mike Naberezny for this (https://github.com/mnaberez)
            const string secret       = "DELCO";
            var          code         = (ushort)(secret[4] * 256 + secret[3]);
            var          workshopCode = (ushort)(secret[1] * 256 + secret[0]);
            var          unknown      = (byte)secret[2];

            kwp1281.Login(code, workshopCode, unknown);
            var bytes = kwp1281.ReadRomEeprom(0x0014, 2);

            Logger.WriteLine($"Safe code: {bytes[0]:X2}{bytes[1]:X2}");
        }
Пример #4
0
        private void MapCcmEeprom(IKW1281Dialog kwp1281)
        {
            kwp1281.Login(19283, 222);

            var        bytes     = new List <byte>();
            const byte blockSize = 1;

            for (int addr = 0; addr <= 65535; addr += blockSize)
            {
                var blockBytes = kwp1281.ReadEeprom((ushort)addr, blockSize);
                blockBytes = Enumerable.Repeat(
                    blockBytes == null ? (byte)0 : (byte)0xFF,
                    blockSize).ToList();
                bytes.AddRange(blockBytes);
            }
            var dumpFileName = _filename ?? "ccm_eeprom_map.bin";

            Logger.WriteLine($"Saving EEPROM map to {dumpFileName}");
            File.WriteAllBytes(dumpFileName, bytes.ToArray());
        }