diff --git a/fastboot/constants.h b/fastboot/constants.h index 063cd40b41bb4977d1626d1ecf23e0bbb0fee063..8a425ae0d1ccaaf2f873aa630a84101cd4307cdb 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 b1c2958fef5c1a425a3234cd5f8d41938a24c773..771c28892cad61e58cf5160124b639716a3b6a01 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 68efa08c35e13f9a5c4ac35ad3afdce8522804a8..a9601896dff50ff7efd7edf27f5fdc3ef637a677 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 c3a64cfab8035a6bd2a545da08a635fc093d8189..a44e72928c0a2f9fa04897d2aa615844fadbb0b6 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);