summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-06-23 17:01:48 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-06-23 17:01:48 +0200
commit2110196958579fd26112ed358106edb2ef952b19 (patch)
treea60e1c0a48ebd3821702b57945680beb245fa968
parent9195f3c7dadd3dd630884d7532cf977c2506ba98 (diff)
download0xFFFF-2110196958579fd26112ed358106edb2ef952b19.tar.bz2
Fiasco image: Allow to specify device string without hw revision (then image is valid for all hw revisions). Generating images should be complete!
-rw-r--r--src/fiasco.c31
-rw-r--r--src/main.c8
2 files changed, 20 insertions, 19 deletions
diff --git a/src/fiasco.c b/src/fiasco.c
index 31b59df..c767407 100644
--- a/src/fiasco.c
+++ b/src/fiasco.c
@@ -459,22 +459,24 @@ int fiasco_add(int fd, const char *name, const char *file, const char *layout, c
write(fd, device, len);
for (i=0; i<16-len; ++i)
write(fd, "\x00", 1);
- ptr = hwrevs;
- oldptr = hwrevs;
- while ((ptr = strchr(ptr, ','))) {
- len = ptr-oldptr;
+ if (hwrevs) {
+ ptr = hwrevs;
+ oldptr = hwrevs;
+ while ((ptr = strchr(ptr, ','))) {
+ len = ptr-oldptr;
+ if (len > 8) len = 8;
+ write(fd, oldptr, len);
+ for (i=0; i<8-len; ++i)
+ write(fd, "\x00", 1);
+ ++ptr;
+ oldptr = ptr;
+ }
+ len = strlen(oldptr);
if (len > 8) len = 8;
write(fd, oldptr, len);
for (i=0; i<8-len; ++i)
write(fd, "\x00", 1);
- ++ptr;
- oldptr = ptr;
}
- len = strlen(oldptr);
- if (len > 8) len = 8;
- write(fd, oldptr, len);
- for (i=0; i<8-len; ++i)
- write(fd, "\x00", 1);
}
/* append layout subsection */
@@ -554,7 +556,7 @@ int fiasco_pack(int optind, char *argv[])
if (strncmp(arg, "version:", strlen("version:"))==0)
continue;
-// format: [[[[dev:hw:]ver:]type:]file[%layout]
+// format: [[[[dev:[hw:]]ver:]type:]file[%layout]
ptr = strdup(arg);
layout = strchr(ptr, '%');
if (layout) {
@@ -576,10 +578,9 @@ int fiasco_pack(int optind, char *argv[])
if (version) {
*(version++) = 0;
hwrevs = strchr(ptr, ':');
- if (hwrevs) {
+ if (hwrevs)
*(hwrevs++) = 0;
- device = ptr;
- }
+ device = ptr;
} else {
version = ptr;
}
diff --git a/src/main.c b/src/main.c
index ae33d2e..b2196a6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -112,9 +112,9 @@ void show_usage()
printf ("Image specification:\n"
" -p [arg] specify normal image\n"
- " arg is [[[dev:hw:]ver:]type:]file[%%layout]\n"
+ " arg is [[[dev:[hw:]]ver:]type:]file[%%layout]\n"
" hw is device HW revision\n"
- " dev is device string\n"
+ " dev is device name string\n"
" ver is image version string\n"
" type is image type\n"
" file is image file name\n"
@@ -169,9 +169,9 @@ void show_usage()
" -i show device information (let standby mode)\n"
" -l list supported usb device ids\n"
" -p format piece-of-firmware\n"
- " piece format: [[[[dev:hw:]ver:]type:]file[%%layout]\n"
+ " piece format: [[[[dev:[hw:]]ver:]type:]file[%%layout]\n"
" hw is device HW revision\n"
- " dev is device string\n"
+ " dev is device name string\n"
" ver is image version string\n"
" type is image type\n"
" file is image file name\n"