diff options
author | David Anderson <dvander@google.com> | 2018-09-04 18:11:03 -0700 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2018-09-05 12:52:15 -0700 |
commit | c091c176cbc93044c4d70d7f733fef4c59672f96 (patch) | |
tree | 4d5f6a962c878c75d5fe530200301e0b6146e436 | |
parent | 56843eec457cc06ccf7d39db56ebcd3dba25df8b (diff) | |
download | system_core-c091c176cbc93044c4d70d7f733fef4c59672f96.tar.gz system_core-c091c176cbc93044c4d70d7f733fef4c59672f96.tar.bz2 system_core-c091c176cbc93044c4d70d7f733fef4c59672f96.zip |
fastbootd: Implement getvar hw-revision.
Bug: 78793464
Test: fastboot getvar hw-revision works
fuzzy_fastboot Conformance.GetVarRevision passes
Change-Id: I5a3e9893d61e18567f2f818ef06cad8e862d637f
-rw-r--r-- | fastboot/constants.h | 1 | ||||
-rw-r--r-- | fastboot/device/commands.cpp | 3 | ||||
-rw-r--r-- | fastboot/device/variables.cpp | 6 | ||||
-rw-r--r-- | fastboot/device/variables.h | 2 |
4 files changed, 11 insertions, 1 deletions
diff --git a/fastboot/constants.h b/fastboot/constants.h index 063cd40b4..8a425ae0d 100644 --- a/fastboot/constants.h +++ b/fastboot/constants.h @@ -57,3 +57,4 @@ #define FB_VAR_SLOT_UNBOOTABLE "slot-unbootable" #define FB_VAR_IS_LOGICAL "is-logical" #define FB_VAR_IS_USERSPACE "is-userspace" +#define FB_VAR_HW_REVISION "hw-revision" diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp index b1c2958fe..771c28892 100644 --- a/fastboot/device/commands.cpp +++ b/fastboot/device/commands.cpp @@ -89,7 +89,8 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args) {FB_VAR_SLOT_UNBOOTABLE, {GetSlotUnbootable, nullptr}}, {FB_VAR_PARTITION_SIZE, {GetPartitionSize, GetAllPartitionArgsWithSlot}}, {FB_VAR_IS_LOGICAL, {GetPartitionIsLogical, GetAllPartitionArgsWithSlot}}, - {FB_VAR_IS_USERSPACE, {GetIsUserspace, nullptr}}}; + {FB_VAR_IS_USERSPACE, {GetIsUserspace, nullptr}}, + {FB_VAR_HW_REVISION, {GetHardwareRevision, nullptr}}}; if (args.size() < 2) { return device->WriteFail("Missing argument"); diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp index 68efa08c3..a9601896d 100644 --- a/fastboot/device/variables.cpp +++ b/fastboot/device/variables.cpp @@ -256,3 +256,9 @@ std::vector<std::vector<std::string>> GetAllPartitionArgsNoSlot(FastbootDevice* } return args; } + +bool GetHardwareRevision(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, + std::string* message) { + *message = android::base::GetProperty("ro.revision", ""); + return true; +} diff --git a/fastboot/device/variables.h b/fastboot/device/variables.h index c3a64cfab..a44e72928 100644 --- a/fastboot/device/variables.h +++ b/fastboot/device/variables.h @@ -48,6 +48,8 @@ bool GetPartitionIsLogical(FastbootDevice* device, const std::vector<std::string std::string* message); bool GetIsUserspace(FastbootDevice* device, const std::vector<std::string>& args, std::string* message); +bool GetHardwareRevision(FastbootDevice* device, const std::vector<std::string>& args, + std::string* message); // Helpers for getvar all. std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device); |