fix verify in linux tool
This commit is contained in:
parent
6244c44e65
commit
a857b3906e
@ -267,14 +267,13 @@ int twb_write(struct twiboot *twb, struct databuf *dbuf, int memtype)
|
||||
int twb_verify(struct twiboot *twb, struct databuf *dbuf, int memtype)
|
||||
{
|
||||
int pos = 0;
|
||||
int size = (memtype == MEMTYPE_FLASH) ? twb->flashsize : twb->eepromsize;
|
||||
uint8_t comp[READ_BLOCK_SIZE];
|
||||
|
||||
while (pos < size) {
|
||||
while (pos < dbuf->length) {
|
||||
if (twb->progress_cb)
|
||||
twb->progress_cb(twb->progress_msg, pos, size);
|
||||
twb->progress_cb(twb->progress_msg, pos, dbuf->length);
|
||||
|
||||
int len = MIN(READ_BLOCK_SIZE, size - pos);
|
||||
int len = MIN(READ_BLOCK_SIZE, dbuf->length - pos);
|
||||
if (twb_read_memory(twb, comp, len, memtype, pos)) {
|
||||
if (twb->progress_cb)
|
||||
twb->progress_cb(twb->progress_msg, -1, -1);
|
||||
@ -294,7 +293,7 @@ int twb_verify(struct twiboot *twb, struct databuf *dbuf, int memtype)
|
||||
}
|
||||
|
||||
if (twb->progress_cb)
|
||||
twb->progress_cb(twb->progress_msg, pos, size);
|
||||
twb->progress_cb(twb->progress_msg, pos, dbuf->length);
|
||||
|
||||
dbuf->length = pos;
|
||||
return 0;
|
||||
|
@ -99,7 +99,7 @@ static void progress_cb(const char *msg, int pos, int size)
|
||||
for (i = 0; i < sizeof(stars); i++)
|
||||
stars[i] = ((pos * 100 / size) >= (i * 100 / sizeof(stars))) ? '*' : ' ';
|
||||
|
||||
printf("%-14s: [%s] (%d)\r", msg, stars, pos);
|
||||
printf("%-15s: [%s] (%d)\r", msg, stars, pos);
|
||||
}
|
||||
|
||||
if (pos == size)
|
||||
@ -218,10 +218,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!abort) {
|
||||
printf("device : %-16s (address: 0x%02x)\n", twb.device, twb.address);
|
||||
printf("version : %-16s (sig: 0x%02x 0x%02x 0x%02x => %s)\n", twb.version, twb.signature[0], twb.signature[1], twb.signature[2], check_signature(twb.signature));
|
||||
printf("flash size : 0x%04x (0x%02x bytes/page)\n", twb.flashsize, twb.pagesize);
|
||||
printf("eeprom size : 0x%04x\n", twb.eepromsize);
|
||||
printf("device : %-16s (address: 0x%02x)\n", twb.device, twb.address);
|
||||
printf("version : %-16s (sig: 0x%02x 0x%02x 0x%02x => %s)\n", twb.version, twb.signature[0], twb.signature[1], twb.signature[2], check_signature(twb.signature));
|
||||
printf("flash size : 0x%04x (0x%02x bytes/page)\n", twb.flashsize, twb.pagesize);
|
||||
printf("eeprom size : 0x%04x\n", twb.eepromsize);
|
||||
|
||||
if (progress) {
|
||||
setbuf(stdout, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user