Loading fastboot/constants.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,3 +61,4 @@ #define FB_VAR_IS_USERSPACE "is-userspace" #define FB_VAR_HW_REVISION "hw-revision" #define FB_VAR_VARIANT "variant" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge" fastboot/device/commands.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args) {FB_VAR_PARTITION_TYPE, {GetPartitionType, GetAllPartitionArgsWithSlot}}, {FB_VAR_IS_LOGICAL, {GetPartitionIsLogical, GetAllPartitionArgsWithSlot}}, {FB_VAR_IS_USERSPACE, {GetIsUserspace, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}}; if (args.size() < 2) { Loading fastboot/device/variables.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,28 @@ bool GetVariant(FastbootDevice* device, const std::vector<std::string>& /* args return true; } bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { auto fastboot_hal = device->fastboot_hal(); if (!fastboot_hal) { *message = "Fastboot HAL not found"; return false; } Result ret; auto ret_val = fastboot_hal->getOffModeChargeState([&](bool off_mode_charging_state, Result result) { *message = off_mode_charging_state ? "1" : "0"; ret = result; }); if (!ret_val.isOk() || (ret.status != Status::SUCCESS)) { *message = "Unable to get off mode charge state"; return false; } return true; } bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string suffix = device->GetCurrentSlot(); Loading fastboot/device/variables.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ bool GetIsUserspace(FastbootDevice* device, const std::vector<std::string>& args bool GetHardwareRevision(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetVariant(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); // Helpers for getvar all. std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device); Loading Loading
fastboot/constants.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,3 +61,4 @@ #define FB_VAR_IS_USERSPACE "is-userspace" #define FB_VAR_HW_REVISION "hw-revision" #define FB_VAR_VARIANT "variant" #define FB_VAR_OFF_MODE_CHARGE_STATE "off-mode-charge"
fastboot/device/commands.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args) {FB_VAR_PARTITION_TYPE, {GetPartitionType, GetAllPartitionArgsWithSlot}}, {FB_VAR_IS_LOGICAL, {GetPartitionIsLogical, GetAllPartitionArgsWithSlot}}, {FB_VAR_IS_USERSPACE, {GetIsUserspace, nullptr}}, {FB_VAR_OFF_MODE_CHARGE_STATE, {GetOffModeChargeState, nullptr}}, {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}}; if (args.size() < 2) { Loading
fastboot/device/variables.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,28 @@ bool GetVariant(FastbootDevice* device, const std::vector<std::string>& /* args return true; } bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { auto fastboot_hal = device->fastboot_hal(); if (!fastboot_hal) { *message = "Fastboot HAL not found"; return false; } Result ret; auto ret_val = fastboot_hal->getOffModeChargeState([&](bool off_mode_charging_state, Result result) { *message = off_mode_charging_state ? "1" : "0"; ret = result; }); if (!ret_val.isOk() || (ret.status != Status::SUCCESS)) { *message = "Unable to get off mode charge state"; return false; } return true; } bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */, std::string* message) { std::string suffix = device->GetCurrentSlot(); Loading
fastboot/device/variables.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ bool GetIsUserspace(FastbootDevice* device, const std::vector<std::string>& args bool GetHardwareRevision(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetVariant(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); bool GetOffModeChargeState(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); // Helpers for getvar all. std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device); Loading