diff options
author | Wink Saville <wink@google.com> | 2011-04-04 17:54:59 -0700 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2011-04-04 17:54:59 -0700 |
commit | b98762f7824c291dc5d9a9b757af434ef31d8c81 (patch) | |
tree | 7f719a05275e43a74a312d17987f74a22e8e0112 /fastboot/engine.c | |
parent | 47e4ee5958bfd48c741f17c23b3a4a3f7866416e (diff) | |
download | system_core-b98762f7824c291dc5d9a9b757af434ef31d8c81.zip system_core-b98762f7824c291dc5d9a9b757af434ef31d8c81.tar.gz system_core-b98762f7824c291dc5d9a9b757af434ef31d8c81.tar.bz2 |
Teach fastboot to allow required variables per product.
This is needed for products like xoom-cdma and xoom-cdma-lte.
The xoom-cdma-lte product requires an lte baseband binary but
it's not needed for xoom-cdma.
This is implemented by allowing an optional product parameter
to "required" statements. The parameter is separated from
"required" by a colon so the version-baseband-2 requirment in
board-info.txt for stingray becomes:
require-for-product:xoom-cdma-lte version-baseband-2=ltedc_u_03.25.00|ltedc_u_03.19.00
In the above statement, only xoom-cdma-lte requires version-baseband-2
and the baseband can be lte_u_03.25.00 or lte_u_03.19.00. For other
products version-baseband-2 will be ignored.
Change-Id: I786bec5f5661c2243d87925b064fc6124d3cffa1
Diffstat (limited to 'fastboot/engine.c')
-rw-r--r-- | fastboot/engine.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/fastboot/engine.c b/fastboot/engine.c index 28a0ad9..6d94035 100644 --- a/fastboot/engine.c +++ b/fastboot/engine.c @@ -69,6 +69,7 @@ struct Action Action *next; char cmd[64]; + const char *prod; void *data; unsigned size; @@ -183,6 +184,16 @@ static int cb_check(Action *a, int status, char *resp, int invert) return status; } + if (a->prod) { + if (strcmp(a->prod, cur_product) != 0) { + double split = now(); + fprintf(stderr,"IGNORE, product is %s required only for %s [%7.3fs]\n", + cur_product, a->prod, (split - a->start)); + a->start = split; + return 0; + } + } + yes = match(resp, value, count); if (invert) yes = !yes; @@ -214,10 +225,12 @@ static int cb_reject(Action *a, int status, char *resp) return cb_check(a, status, resp, 1); } -void fb_queue_require(const char *var, int invert, unsigned nvalues, const char **value) +void fb_queue_require(const char *prod, const char *var, + int invert, unsigned nvalues, const char **value) { Action *a; a = queue_action(OP_QUERY, "getvar:%s", var); + a->prod = prod; a->data = value; a->size = nvalues; a->msg = mkmsg("checking %s", var); @@ -244,6 +257,25 @@ void fb_queue_display(const char *var, const char *prettyname) a->func = cb_display; } +static int cb_save(Action *a, int status, char *resp) +{ + if (status) { + fprintf(stderr, "%s FAILED (%s)\n", a->cmd, resp); + return status; + } + strncpy(a->data, resp, a->size); + return 0; +} + +void fb_queue_query_save(const char *var, char *dest, unsigned dest_size) +{ + Action *a; + a = queue_action(OP_QUERY, "getvar:%s", var); + a->data = (void *)dest; + a->size = dest_size; + a->func = cb_save; +} + static int cb_do_nothing(Action *a, int status, char *resp) { fprintf(stderr,"\n"); |