Skip to content

Commit

Permalink
merging in some old changes, from a different working copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonpilgrim committed Dec 27, 2017
1 parent 14c5ac8 commit 8be0e02
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions PTP Tools/NikonDump/Program.cs
Expand Up @@ -250,6 +250,9 @@ static void DumpTests()

//FR_LiveView_hack();

//Tmp19_LogSet_Eeprom(SN);
//Tmp19_Search_Set04();

//Tmp19_Resume();
//ExitServiceMode();
}
Expand Down Expand Up @@ -1099,6 +1102,72 @@ static void Tmp19_Resume()
}
}

static void Tmp19_LogSet_Eeprom(string sn)
{
string filesname = string.Format("eeprom_log_{0}.txt", sn);
using (TextWriter tw = new StreamWriter(filesname))
{
var set = FR_DumpSet(1, 0x3);
tw.WriteLine("set01 " + DataToHexString(set.Data, 0));
set = FR_DumpSet(2, 0x80);
tw.WriteLine("set02 " + DataToHexString(set.Data, 0));
set = FR_DumpSet(3, 0x80);
tw.WriteLine("set03 " + DataToHexString(set.Data, 0));
set = FR_DumpSet(4, 0x80);
tw.WriteLine("set04 " + DataToHexString(set.Data, 0));

var res = Tmp19_Cmd_4155_EepromRead(0x0, 0x80);
tw.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x80, 0x80);
tw.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x100, 0x80);
tw.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x180, 0x80);
tw.WriteLine(DataToHexString(res.Data, 0));
}

Tmp19_Resume();
ExitServiceMode();
}

static void Tmp19_Search_Set04()
{
var set = FR_DumpSet(1, 0x3);
Debug.WriteLine(DataToHexString(set.Data, 0));
set = FR_DumpSet(2, 0x80);
Debug.WriteLine(DataToHexString(set.Data, 0));
set = FR_DumpSet(3, 0x80);
Debug.WriteLine(DataToHexString(set.Data, 0));
set = FR_DumpSet(4, 0x80);
Debug.WriteLine(DataToHexString(set.Data, 0));

var res = Tmp19_Cmd_4155_EepromRead(0x0, 0x80);
Debug.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x80, 0x80);
Debug.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x100, 0x80);
Debug.WriteLine(DataToHexString(res.Data, 0));
res = Tmp19_Cmd_4155_EepromRead(0x180, 0x80);
Debug.WriteLine(DataToHexString(res.Data, 0));


//Debug.WriteLine(DataToHexString(res.Data, 44));

//if (turnOff)
// res.Data[0] |= 0x08;
//else
// res.Data[0] &= 0xF7;


////Tmp19_Cmd_4154_RAMWrite(0xFF4043, 1, res.Data);
//Tmp19_Cmd_4157_EepromWrite(0x43, 1, res.Data);
//Tmp19_Cmd_4771_EepromSave();

//var chk = Tmp19_Cmd_4155_EepromRead(0x43, 1);
//Debug.WriteLine(chk.Data[0]);
Tmp19_Resume();
}

static void Tmp19_DisablesDefectProcessing_Set(bool turnOff)
{
var res = Tmp19_Cmd_4155_EepromRead(0x43, 1);
Expand Down Expand Up @@ -1447,5 +1516,16 @@ static string DataToHexString(byte[] data, int offset)

return sb.ToString();
}

static string DataToHexString(byte[] data, int offset, int len)
{
StringBuilder sb = new StringBuilder();
for (int i = offset; i < data.Length && i < len; i++)
{
sb.Append(string.Format("{0:X2} ", data[i]));
}

return sb.ToString();
}
}
}

0 comments on commit 8be0e02

Please sign in to comment.