summaryrefslogtreecommitdiff
path: root/fastboot/device/variables.cpp
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2018-09-26 13:08:16 -0700
committerHridya Valsaraju <hridya@google.com>2018-09-28 11:38:58 -0700
commit4af80901a66ea6b3f62d0b21bb96026ba602eb25 (patch)
tree3560eea1b7b6d6838539c884846760409cd61696 /fastboot/device/variables.cpp
parente4931c5bd4d8acd85f1ebfc93759754d7e5866e8 (diff)
Support fastboot variable 'variant'.
Bug: 79480454 Bug: 78793464 Test: fastboot getvar variant Change-Id: Iefef82c147d8405318c793ad0a73f00674bbb63d Merged-In: Iefef82c147d8405318c793ad0a73f00674bbb63d (cherry picked from commit 4785287a0043ddea2f784433d8a4fc8a168efc79)
Diffstat (limited to 'fastboot/device/variables.cpp')
-rw-r--r--fastboot/device/variables.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp
index 002e04349..77cd4bc25 100644
--- a/fastboot/device/variables.cpp
+++ b/fastboot/device/variables.cpp
@@ -74,6 +74,27 @@ bool GetSecure(FastbootDevice* /* device */, const std::vector<std::string>& /*
return true;
}
+bool GetVariant(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->getVariant([&](std::string device_variant, Result result) {
+ *message = device_variant;
+ ret = result;
+ });
+ if (!ret_val.isOk() || ret.status != Status::SUCCESS) {
+ *message = "Unable to get device variant";
+ return false;
+ }
+
+ return true;
+}
+
bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */,
std::string* message) {
std::string suffix = device->GetCurrentSlot();