@@ -76,6 +76,7 @@ RecordOffset Impl::getVtocOffset() const
7676#ifdef IPZ_PARSER
7777int Impl::vhdrEccCheck ()
7878{
79+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeHDRECC_IPZ.txt" );
7980 int rc = eccStatus::SUCCESS;
8081 auto vpdPtr = vpd.cbegin ();
8182
@@ -88,13 +89,17 @@ int Impl::vhdrEccCheck()
8889 {
8990 try
9091 {
92+ std::cout<<" Correction HDR ERR" <<std::endl;
93+ vpdFileStream.open (vpdFilePath,
94+ std::ios::in | std::ios::out | std::ios::binary);
9195 if (vpdFileStream.is_open ())
9296 {
9397 vpdFileStream.seekp (vpdStartOffset + offsets::VHDR_RECORD,
9498 std::ios::beg);
9599 vpdFileStream.write (
96100 reinterpret_cast <const char *>(&vpd[offsets::VHDR_RECORD]),
97101 lengths::VHDR_RECORD_LENGTH);
102+ vpdFileStream.close ();
98103 }
99104 else
100105 {
@@ -113,12 +118,14 @@ int Impl::vhdrEccCheck()
113118 {
114119 rc = eccStatus::FAILED;
115120 }
121+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterHRDECC_IPZ.txt" );
116122
117123 return rc;
118124}
119125
120126int Impl::vtocEccCheck ()
121127{
128+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeTOCECC_IPZ.txt" );
122129 int rc = eccStatus::SUCCESS;
123130 // Use another pointer to get ECC information from VHDR,
124131 // actual pointer is pointing to VTOC data
@@ -150,12 +157,17 @@ int Impl::vtocEccCheck()
150157 {
151158 try
152159 {
160+ std::cout<<" Correction TOC ERR" <<std::endl;
161+ vpdFileStream.open (vpdFilePath,
162+ std::ios::in | std::ios::out | std::ios::binary);
163+
153164 if (vpdFileStream.is_open ())
154165 {
155166 vpdFileStream.seekp (vpdStartOffset + vtocOffset, std::ios::beg);
156167 vpdFileStream.write (
157168 reinterpret_cast <const char *>(&vpdPtr[vtocOffset]),
158169 vtocLength);
170+ vpdFileStream.close ();
159171 }
160172 else
161173 {
@@ -174,7 +186,7 @@ int Impl::vtocEccCheck()
174186 {
175187 rc = eccStatus::FAILED;
176188 }
177-
189+ executeCmd ( " hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterTOCECC_IPZ.txt " );
178190 return rc;
179191}
180192
@@ -214,13 +226,19 @@ int Impl::recordEccCheck(Binary::const_iterator iterator)
214226 {
215227 try
216228 {
229+ std::cout<<" Correction REC ERR" <<std::endl;
230+ vpdFileStream.open (vpdFilePath,
231+ std::ios::in | std::ios::out | std::ios::binary);
232+
217233 if (vpdFileStream.is_open ())
218234 {
219235 vpdFileStream.seekp (vpdStartOffset + recordOffset,
220236 std::ios::beg);
221237 vpdFileStream.write (
222238 reinterpret_cast <const char *>(&vpdPtr[recordOffset]),
223239 recordLength);
240+
241+ vpdFileStream.close ();
224242 }
225243 else
226244 {
@@ -246,6 +264,7 @@ int Impl::recordEccCheck(Binary::const_iterator iterator)
246264
247265void Impl::checkHeader ()
248266{
267+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeCheckHeader_IPZ.txt" );
249268 if (vpd.empty () || (lengths::RECORD_MIN > vpd.size ()))
250269 {
251270 throw (VpdDataException (" Malformed VPD" ));
@@ -271,10 +290,12 @@ void Impl::checkHeader()
271290 }
272291#endif
273292 }
293+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterCheckHeader_IPZ.txt" );
274294}
275295
276296std::size_t Impl::readTOC (Binary::const_iterator& iterator)
277297{
298+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeReadTOC_IPZ.txt" );
278299 // The offset to VTOC could be 1 or 2 bytes long
279300 RecordOffset vtocOffset = getVtocOffset ();
280301
@@ -310,6 +331,7 @@ std::size_t Impl::readTOC(Binary::const_iterator& iterator)
310331 std::size_t ptLen = *iterator;
311332 // Skip past PT size
312333 std::advance (iterator, sizeof (KwSize));
334+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterReadTOC_IPZ.txt" );
313335
314336 // length of PT keyword
315337 return ptLen;
@@ -318,6 +340,7 @@ std::size_t Impl::readTOC(Binary::const_iterator& iterator)
318340internal::OffsetList Impl::readPT (Binary::const_iterator iterator,
319341 std::size_t ptLength)
320342{
343+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeReadPT_IPZ.txt" );
321344 internal::OffsetList offsets{};
322345
323346 auto end = iterator;
@@ -380,11 +403,13 @@ internal::OffsetList Impl::readPT(Binary::const_iterator iterator,
380403 sizeof (ECCOffset) + sizeof (ECCLength));
381404 }
382405
406+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterReadPT_IPZ.txt" );
383407 return offsets;
384408}
385409
386410void Impl::processRecord (std::size_t recordOffset)
387411{
412+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeProcessRecord_IPZ.txt" );
388413 // Jump to record name
389414 auto nameOffset = recordOffset + sizeof (RecordId) + sizeof (RecordSize) +
390415 // Skip past the RT keyword, which contains
@@ -415,6 +440,8 @@ void Impl::processRecord(std::size_t recordOffset)
415440 // to the parsed vpd output.
416441 out.emplace (std::move (name), std::move (kwMap));
417442
443+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterProcessRecord_IPZ.txt" );
444+
418445#ifndef IPZ_PARSER
419446 }
420447#endif
@@ -518,6 +545,7 @@ std::string Impl::readKwData(const internal::KeywordInfo& keyword,
518545
519546internal::KeywordMap Impl::readKeywords (Binary::const_iterator iterator)
520547{
548+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_beforeReadKWD_IPZ.txt" );
521549 internal::KeywordMap map{};
522550 while (true )
523551 {
@@ -576,6 +604,8 @@ internal::KeywordMap Impl::readKeywords(Binary::const_iterator iterator)
576604 std::advance (iterator, length);
577605 }
578606
607+ executeCmd (" hexdump -C -s 196608 -n 1024 /sys/bus/spi/drivers/at25/spi42.0/eeprom > /tmp/spi42_afterReadKWD_IPZ.txt" );
608+
579609 return map;
580610}
581611
@@ -596,6 +626,8 @@ Store Impl::run()
596626 {
597627 processRecord (offset);
598628 }
629+
630+
599631 // Return a Store object, which has interfaces to
600632 // access parsed VPD by record:keyword
601633 return Store (std::move (out));
0 commit comments