From 5a96158322b4b7e8289dfd429af3e7b15a99d173 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 8 Dec 2008 18:13:36 +0100 Subject: * Implement and test direct file FIASCO flash - openfiasco receives options for grepping for pieces and be verbose - fixed flashing order using grep options xloader, secondary, kernel, initfs, rootfs - Tested and working - Added parser for the hw revision string * Autodetect device hw revision and setup the subversion string on the fly. --- src/fiasco.c | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'src/fiasco.c') diff --git a/src/fiasco.c b/src/fiasco.c index 192238f..a521270 100644 --- a/src/fiasco.c +++ b/src/fiasco.c @@ -29,7 +29,7 @@ int (*fiasco_callback)(struct header_t *header) = NULL; -int openfiasco(char *name) +int openfiasco(char *name, char *piece_grep, int v) { struct header_t header; unsigned char buf[128]; @@ -38,6 +38,7 @@ int openfiasco(char *name) unsigned int namelen; off_t off, here; int i,j; + header.fd = open(name, O_RDONLY); if (header.fd == -1) { @@ -60,8 +61,9 @@ int openfiasco(char *name) memset(buf,'\0', 128); read(header.fd, buf, namelen); - printf("Fiasco version: %2d\n", buf[3]); + if (v) printf("Fiasco version: %2d\n", buf[3]); strcpy(header.fwname, (char *)buf+6); + if (v) for(i=6;i (%s) %s\n", piece_grep, header.name); + if (fiasco_callback != NULL) { + fiasco_callback(&header); + free(header.data); + continue; + } else { + // ??huh + } } // XXX dup lseek(header.fd, off, SEEK_SET); lseek(header.fd, header.size, SEEK_CUR); } - return 0; + return close(header.fd); } void fiasco_data_read(struct header_t *header) -- cgit v1.2.3