Skip to content

Commit fd48f92

Browse files
committed
qt: added bad block notification for read command
1 parent d60a9b5 commit fd48f92

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

qt/programmer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ int Programmer::readChip(uint8_t *buf, uint32_t addr, uint32_t len)
244244
int ret;
245245
uint8_t rx_buf[CDC_BUF_SIZE];
246246
RespHeader *dataResp;
247+
RespBadBlock *badBlock;
247248
uint32_t offset = 0;
248249
Cmd cmd = { .code = CMD_NAND_READ };
249250
ReadCmd readCmd = { .cmd = cmd, .addr = addr, .len = len };
@@ -271,7 +272,16 @@ int Programmer::readChip(uint8_t *buf, uint32_t addr, uint32_t len)
271272

272273
dataResp = (RespHeader *)rx_buf;
273274
if (dataResp->code == RESP_STATUS)
274-
return handleStatus(dataResp);
275+
{
276+
if (dataResp->info == STATUS_BAD_BLOCK)
277+
{
278+
badBlock = (RespBadBlock *)dataResp;
279+
qInfo() << "Bad block at" << QString("0x%1").
280+
arg(badBlock->addr, 8, 16, QLatin1Char('0'));
281+
}
282+
else
283+
return handleStatus(dataResp);
284+
}
275285

276286
if (dataResp->code == RESP_DATA)
277287
{

0 commit comments

Comments
 (0)