From 4ebd6086c983416fccbf09dbdc305e0aec07a56a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 9 Feb 2008 09:59:00 -0200 Subject: Fix firmware size and number of firmwares From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/xc3028-firmware/firmware-tool.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/v4l2-apps/util/xc3028-firmware/firmware-tool.c b/v4l2-apps/util/xc3028-firmware/firmware-tool.c index 89b792307..da063ca77 100644 --- a/v4l2-apps/util/xc3028-firmware/firmware-tool.c +++ b/v4l2-apps/util/xc3028-firmware/firmware-tool.c @@ -667,8 +667,8 @@ int seek_chunks(struct chunk_hunk *fhunk, for (p = base_start; p < endp; p++) { fpos = p; - for (p2 = fdata + ini_sig; - p2 < fdata + ini_sig + sig_len; p2++, + for (p2 = fdata + ini_sig; + p2 < fdata + ini_sig + sig_len; p2++, fpos++) { if (*fpos != *p2) break; @@ -878,7 +878,7 @@ void seek_firmware(struct firmware *f, char *seek_file, char *write_file) { if (!hunk->size) continue; - if (hunk->hint_method) + if (hunk->hint_method) fprintf(fp, "\n\t#\n\t# Guessed format "); fprintf(fp, "\n\t#\n\t# Firmware %d, ", i); @@ -892,9 +892,12 @@ void seek_firmware(struct firmware *f, char *seek_file, char *write_file) { if (f->desc[i].type & HAS_IF) fprintf(fp, "\twrite_le16(%d);\t\t\t# IF\n", f->desc[i].int_freq); - fprintf(fp, "\twrite_le32(%d);\t\t\t# Size\n", - f->desc[i].size); -fflush(fp); + if (hunk->hint_method == 3) + fprintf(fp, "\twrite_le32(%d);\t\t\t# Size\n", + hunk->size); + else + fprintf(fp, "\twrite_le32(%d);\t\t\t# Size\n", + f->desc[i].size); while (hunk) { if (hunk->data) { int j; @@ -921,7 +924,7 @@ fflush(fp); } fprintf(fp, end_extract, seek_file, md5, "xc3028-v27.fw", - f->name, f->version, f->nr_desc); + f->name, f->version, nfound); } void print_usage(void) -- cgit v1.2.3