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

Commit 55b61f4c authored by Szymon Starzycki's avatar Szymon Starzycki Committed by Colin Cross
Browse files

Fastbootd: General fixes and changes

read data once bug fix
ability to run fastbootd without network and named socket configuration in init.rc
vendortrigger name changed to fastbootd
deleted unused function from default implementation of OEM library

Change-Id: Ib957fae8172530f20d51bb51b5e07bccab07e555
parent 4662a114
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ static void cmd_gpt_layout(struct protocol_handle *phandle, const char *arg) {
        return;
    }

    //TODO: add same verification as in cmd_flash
    if (phandle->download_fd < 0) {
        fastboot_fail(phandle, "no layout file");
        return;
+9 −2
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@
#ifndef _FASTBOOTD_ERASE_H
#define _FASTBOOTD_ERASE_H

#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "debug.h"

int flash_find_entry(const char *, char *, size_t);
int flash_erase(int fd);

@@ -50,10 +55,12 @@ static inline ssize_t read_data_once(int fd, char *buffer, ssize_t size) {
    ssize_t len;

    while ((len = TEMP_FAILURE_RETRY(read(fd, (void *) &buffer[readcount], size - readcount))) > 0) {
        readcount -= len;
        readcount += len;
    }
    if (len < 0)
    if (len < 0) {
        D(ERR, "Read error:%s", strerror(errno));
        return len;
    }

    return readcount;
}
+15 −5
Original line number Diff line number Diff line
@@ -38,17 +38,19 @@ int main(int argc, char **argv)
{
    int socket_client = 0;
    int c;
    int network = 1;

    klog_init();
    klog_set_level(6);

    const struct option longopts[] = {
        {"socket", no_argument, 0, 'S'},
        {"nonetwork", no_argument, 0, 'n'},
        {0, 0, 0, 0}
    };

    while (1) {
        c = getopt_long(argc, argv, "S", longopts, NULL);
        c = getopt_long(argc, argv, "Sn", longopts, NULL);
        /* Alphabetical cases */
        if (c < 0)
            break;
@@ -56,6 +58,9 @@ int main(int argc, char **argv)
        case 'S':
            socket_client = 1;
            break;
        case 'n':
            network = 0;
            break;
        case '?':
            return 1;
        default:
@@ -70,6 +75,7 @@ int main(int argc, char **argv)
    klog_set_level(6);

    if (socket_client) {
        //TODO: Shouldn't we change current tty into raw mode?
        run_socket_client();
    }
    else {
@@ -78,10 +84,14 @@ int main(int argc, char **argv)
        load_trigger();
        commands_init();
        usb_init();

        if (network) {
            if (!transport_socket_init())
                exit(1);
            ssh_server_start();
            network_discovery_init();
        }

        while (1) {
            sleep(1);
        }
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
#ifndef __VENDOR_TRIGGER_H_
#define __VENDOR_TRIGGER_H_

#define TRIGGER_MODULE_ID "vendortrigger"
#define TRIGGER_MODULE_ID "fastbootd"
#include <hardware/hardware.h>

__BEGIN_DECLS
@@ -59,7 +59,7 @@ struct vendor_trigger_t {


    /*
     * Return value 1 forbid the action from the vendor site and sets errno
     * Return value -1 forbid the action from the vendor site and sets errno
     */
    int (* gpt_layout)(struct GPT_content *);
    int (* oem_cmd)(const char *arg, const char **response);
+0 −19
Original line number Diff line number Diff line
@@ -38,30 +38,11 @@ unsigned int debug_level = DEBUG;

static const int version = 1;

int delete_partition(struct GPT_entry_raw *);
int add_partition(struct GPT_entry_raw *);
int modify_partition(struct GPT_entry_raw *, struct GPT_entry_raw *);

int check_version(const int fastboot_version, int *libversion) {
    *libversion = version;
    return !(fastboot_version == version);
}

int delete_partition(struct GPT_entry_raw *entry) {
    D(DEBUG, "message from libvendor");
    return 0;
}

int add_partition(struct GPT_entry_raw *entry) {
    D(DEBUG, "message from libvendor");
    return 0;
}

int modify_partition(struct GPT_entry_raw *oldentry, struct GPT_entry_raw *newentry) {
    D(DEBUG, "message from libvendor");
    return 0;
}

int gpt_layout(struct GPT_content *table) {
    D(DEBUG, "message from libvendor");
    return 0;
Loading