diff options
author | pancake <pancake@dazo> | 2008-12-08 18:13:36 +0100 |
---|---|---|
committer | pancake <pancake@dazo> | 2008-12-08 18:13:36 +0100 |
commit | 5a96158322b4b7e8289dfd429af3e7b15a99d173 (patch) | |
tree | d095a25f2bf1485132895c1525786fa34f71f5e8 /src/main.c | |
parent | 3d427bfd7740731bfc203b047d557af564975cf6 (diff) | |
download | 0xFFFF-5a96158322b4b7e8289dfd429af3e7b15a99d173.tar.bz2 |
* 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.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 46 |
1 files changed, 41 insertions, 5 deletions
@@ -159,17 +159,41 @@ void unpack_fiasco_image(char *file) { printf("Dumping firmware pieces to disk.\n"); fiasco_callback = &unpack_callback; - openfiasco( file ); + openfiasco(file, NULL ,1); } int fiasco_flash(char *file) { + char *p,version[64]; + + if (connect_via_usb()) { + fprintf(stderr, "Cannot connect to device. It is possibly not in boot stage.\n"); + return 0; + } + + // if (info) + cmd_info(""); + check_nolo_order(); get_sw_version(); + get_hw_revision(version, 44); + + if (subverstr == NULL) { + p = strstr(version, "hw_rev:"); + if (p) { + subverstr = strdup(p+7); + // TODO: delimit string by comma + printf("SubVersionString autodetected: '%s'\n", subverstr); + } + } get_nolo_version(); fiasco_callback = &flash_callback; - openfiasco( file ); + openfiasco(file, "xloader", 0); + openfiasco(file, "secondary", 0); + openfiasco(file, "kernel", 0); + openfiasco(file, "initfs", 0); + openfiasco(file, "rootfs", 0); return 0; } @@ -277,7 +301,8 @@ int main(int argc, char **argv) usb_mode = atoi(optarg); break; case 'F': - return fiasco_flash(optarg); + fiasco_image = optarg; + break; case 'd': sscanf(optarg, "%04hx:%04hx", &supported_devices[SUPPORTED_DEVICES-2].vendor_id, @@ -350,6 +375,9 @@ int main(int argc, char **argv) if (qmode) return queue_mode(); + if (!unpack && fiasco_image) + return fiasco_flash(fiasco_image); + if (identify) return 0; @@ -395,10 +423,18 @@ int main(int argc, char **argv) cmd_info(""); if (pcs_n) { - int c; - + char version[64]; check_nolo_order(); get_sw_version(); + get_hw_revision(version, 44); + if (subverstr == NULL) { + char *p = strstr(version, "hw_rev:"); + if (p) { + subverstr = strdup(p+7); + // TODO: delimit string by comma + printf("SubVersionString autodetected: '%s'\n", subverstr); + } + } get_nolo_version(); for(c=0;c<pcs_n;c++) { |