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

Commit b33e2c2d authored by philz-cwm6's avatar philz-cwm6 Committed by Gerrit Code Review
Browse files

Do not log to screen when mounting/unmounting sdcards.

This will preserve logging for format/usb mount and for all USB OTG storage

Change-Id: I0ab41632b4b97d23a43471755e21d9750c6cfa04
parent f4c69bf9
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -837,12 +837,22 @@ static int handle_volume_hotswap(char* label, char* path) {
}

static int handle_volume_state_changed(char* label, char* path, int state) {
    if (state == State_Checking ||
        state == State_Mounted ||
        state == State_Idle ||
        state == State_Formatting ||
        state == State_Shared)
    int log = -1;
    if (state == State_Checking || state == State_Mounted || state == State_Idle) {
        // do not ever log to screen mount/unmount events for sdcards
        if (strncmp(path, "/storage/sdcard", 15) == 0)
            log = 0;
        else log = 1;
    }
    else if (state == State_Formatting || state == State_Shared) {
            log = 1;
    }

    if (log == 0)
        LOGI("%s: %s\n", path, volume_state_to_string(state));
    else if (log == 1)
        ui_print("%s: %s\n", path, volume_state_to_string(state));

    return 0;
}