Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a253390 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Make fastboot command-line parsing a bit more like adb."

parents 4963b42d d6365a70
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -258,6 +258,12 @@ static int cb_reject(Action* a, int status, const char* resp) {
    return cb_check(a, status, resp, 1);
}

static char* xstrdup(const char* s) {
    char* result = strdup(s);
    if (!result) die("out of memory");
    return result;
}

void fb_queue_require(const char *prod, const char *var,
                      bool invert, size_t nvalues, const char **value)
{
@@ -276,16 +282,14 @@ static int cb_display(Action* a, int status, const char* resp) {
        fprintf(stderr, "%s FAILED (%s)\n", a->cmd, resp);
        return status;
    }
    fprintf(stderr, "%s: %s\n", (char*) a->data, resp);
    fprintf(stderr, "%s: %s\n", static_cast<const char*>(a->data), resp);
    free(static_cast<char*>(a->data));
    return 0;
}

void fb_queue_display(const char *var, const char *prettyname)
{
    Action *a;
    a = queue_action(OP_QUERY, "getvar:%s", var);
    a->data = strdup(prettyname);
    if (a->data == nullptr) die("out of memory");
void fb_queue_display(const char* var, const char* prettyname) {
    Action* a = queue_action(OP_QUERY, "getvar:%s", var);
    a->data = xstrdup(prettyname);
    a->func = cb_display;
}

@@ -298,11 +302,9 @@ static int cb_save(Action* a, int status, const char* resp) {
    return 0;
}

void fb_queue_query_save(const char *var, char *dest, uint32_t dest_size)
{
    Action *a;
    a = queue_action(OP_QUERY, "getvar:%s", var);
    a->data = (void *)dest;
void fb_queue_query_save(const char* var, char* dest, uint32_t dest_size) {
    Action* a = queue_action(OP_QUERY, "getvar:%s", var);
    a->data = dest;
    a->size = dest_size;
    a->func = cb_save;
}
@@ -342,15 +344,13 @@ void fb_queue_download_fd(const char *name, int fd, uint32_t sz)
    a->msg = mkmsg("sending '%s' (%d KB)", name, sz / 1024);
}

void fb_queue_upload(char *outfile)
{
void fb_queue_upload(const char* outfile) {
    Action* a = queue_action(OP_UPLOAD, "");
    a->data = outfile;
    a->data = xstrdup(outfile);
    a->msg = mkmsg("uploading '%s'", outfile);
}

void fb_queue_notice(const char *notice)
{
void fb_queue_notice(const char* notice) {
    Action *a = queue_action(OP_NOTICE, "");
    a->data = (void*) notice;
}
+173 −229

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ void fb_queue_reboot(void);
void fb_queue_command(const char *cmd, const char *msg);
void fb_queue_download(const char *name, void *data, uint32_t size);
void fb_queue_download_fd(const char *name, int fd, uint32_t sz);
void fb_queue_upload(char *outfile);
void fb_queue_upload(const char* outfile);
void fb_queue_notice(const char *notice);
void fb_queue_wait_for_disconnect(void);
int64_t fb_execute_queue(Transport* transport);