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

Commit 27bdd9a7 authored by Bill Yi's avatar Bill Yi
Browse files

Merge commit '2b88845e' into HEAD

parents df345a8a 2b88845e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -872,7 +872,7 @@ static int logcat(TransportType transport, const char* serial, int argc, const c
}

static int backup(int argc, const char** argv) {
    const char* filename = "./backup.ab";
    const char* filename = "backup.ab";

    /* find, extract, and use any -f argument */
    for (int i = 1; i < argc; i++) {
+1 −0
Original line number Diff line number Diff line
service debuggerd /system/bin/debuggerd
    class main
    writepid /dev/cpuset/system-background/tasks
+1 −0
Original line number Diff line number Diff line
service debuggerd64 /system/bin/debuggerd64
    class main
    writepid /dev/cpuset/system-background/tasks
+39 −7
Original line number Diff line number Diff line
@@ -260,6 +260,11 @@ static void usage() {
            "                                           partitions.\n"
            "  flashing get_unlock_ability              Queries bootloader to see if the\n"
            "                                           device is unlocked.\n"
            "  flashing get_unlock_bootloader_nonce     Queries the bootloader to get the\n"
            "                                           unlock nonce.\n"
            "  flashing unlock_bootloader <request>     Issue unlock bootloader using request.\n"
            "  flashing lock_bootloader                 Locks the bootloader to prevent\n"
            "                                           bootloader version rollback.\n"
            "  erase <partition>                        Erase a flash partition.\n"
            "  format[:[<fs type>][:[<size>]] <partition>\n"
            "                                           Format a flash partition. Can\n"
@@ -794,7 +799,28 @@ static void do_flashall(usb_handle* usb, int erase_first) {
#define skip(n) do { argc -= (n); argv += (n); } while (0)
#define require(n) do { if (argc < (n)) {usage(); exit(1);}} while (0)

static int do_oem_command(int argc, char** argv) {
static int do_bypass_unlock_command(int argc, char **argv)
{
    if (argc <= 2) return 0;
    skip(2);

    /*
     * Process unlock_bootloader, we have to load the message file
     * and send that to the remote device.
     */
    require(1);

    int64_t sz;
    void* data = load_file(*argv, &sz);
    if (data == nullptr) die("could not load '%s': %s", *argv, strerror(errno));
    fb_queue_download("unlock_message", data, sz);
    fb_queue_command("flashing unlock_bootloader", "unlocking bootloader");
    skip(1);
    return 0;
}

static int do_oem_command(int argc, char **argv)
{
    char command[256];
    if (argc <= 1) return 0;

@@ -1200,12 +1226,18 @@ int main(int argc, char **argv)
            wants_reboot = 1;
        } else if(!strcmp(*argv, "oem")) {
            argc = do_oem_command(argc, argv);
        } else if(!strcmp(*argv, "flashing") && argc == 2) {
            if(!strcmp(*(argv+1), "unlock") || !strcmp(*(argv+1), "lock")
               || !strcmp(*(argv+1), "unlock_critical")
               || !strcmp(*(argv+1), "lock_critical")
               || !strcmp(*(argv+1), "get_unlock_ability")) {
        } else if(!strcmp(*argv, "flashing")) {
            if (argc == 2 && (!strcmp(*(argv+1), "unlock") ||
                              !strcmp(*(argv+1), "lock") ||
                              !strcmp(*(argv+1), "unlock_critical") ||
                              !strcmp(*(argv+1), "lock_critical") ||
                              !strcmp(*(argv+1), "get_unlock_ability") ||
                              !strcmp(*(argv+1), "get_unlock_bootloader_nonce") ||
                              !strcmp(*(argv+1), "lock_bootloader"))) {
                argc = do_oem_command(argc, argv);
            } else
            if (argc == 3 && !strcmp(*(argv+1), "unlock_bootloader")) {
                argc = do_bypass_unlock_command(argc, argv);
            } else {
              usage();
              return 1;
+12 −2
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ bool BatteryMonitor::update(void) {
    props.chargerWirelessOnline = false;
    props.batteryStatus = BATTERY_STATUS_UNKNOWN;
    props.batteryHealth = BATTERY_HEALTH_UNKNOWN;
    props.maxChargingCurrent = 0;

    if (!mHealthdConfig->batteryPresentPath.isEmpty())
        props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath);
@@ -246,6 +247,15 @@ bool BatteryMonitor::update(void) {
                    KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n",
                                 mChargerNames[i].string());
                }
                path.clear();
                path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH,
                                  mChargerNames[i].string());
                if (access(path.string(), R_OK) == 0) {
                    int maxChargingCurrent = getIntField(path);
                    if (props.maxChargingCurrent < maxChargingCurrent) {
                        props.maxChargingCurrent = maxChargingCurrent;
                    }
                }
            }
        }
    }
@@ -382,9 +392,9 @@ void BatteryMonitor::dumpState(int fd) {
    int v;
    char vs[128];

    snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d\n",
    snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d\n",
             props.chargerAcOnline, props.chargerUsbOnline,
             props.chargerWirelessOnline);
             props.chargerWirelessOnline, props.maxChargingCurrent);
    write(fd, vs, strlen(vs));
    snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n",
             props.batteryStatus, props.batteryHealth, props.batteryPresent);
Loading