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

Commit 029d44e6 authored by Iliyan Malchev's avatar Iliyan Malchev
Browse files

HACK: use /firmware/image as a 3rd choice



Change-Id: I74af2e2dc872f88b904ead13e300ae32547e70c8
Signed-off-by: default avatarIliyan Malchev <malchev@google.com>
parent db7462f8
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#define SYSFS_PREFIX    "/sys"
#define FIRMWARE_DIR1   "/etc/firmware"
#define FIRMWARE_DIR2   "/vendor/firmware"
#define FIRMWARE_DIR3   "/firmware/image"

#ifdef HAVE_SELINUX
static struct selabel_handle *sehandle;
@@ -725,7 +726,7 @@ static int is_booting(void)

static void process_firmware_event(struct uevent *uevent)
{
    char *root, *loading, *data, *file1 = NULL, *file2 = NULL;
    char *root, *loading, *data, *file1 = NULL, *file2 = NULL, *file3 = NULL;
    int l, loading_fd, data_fd, fw_fd;
    int booting = is_booting();

@@ -752,6 +753,10 @@ static void process_firmware_event(struct uevent *uevent)
    if (l == -1)
        goto data_free_out;

    l = asprintf(&file3, FIRMWARE_DIR3"/%s", uevent->firmware);
    if (l == -1)
        goto data_free_out;

    loading_fd = open(loading, O_WRONLY);
    if(loading_fd < 0)
        goto file_free_out;
@@ -764,6 +769,8 @@ try_loading_again:
    fw_fd = open(file1, O_RDONLY);
    if(fw_fd < 0) {
        fw_fd = open(file2, O_RDONLY);
        if (fw_fd < 0) {
            fw_fd = open(file3, O_RDONLY);
            if (fw_fd < 0) {
                if (booting) {
                        /* If we're not fully booted, we may be missing
@@ -778,6 +785,7 @@ try_loading_again:
                goto data_close_out;
            }
        }
    }

    if(!load_firmware(fw_fd, loading_fd, data_fd))
        INFO("firmware: copy success { '%s', '%s' }\n", root, uevent->firmware);