fastboot: fix set_active for legacy A/B.

Legacy A/B implementations use _a and _b slot names, but currently the
set_active command is unconditionally stripping the _ prefix. This CL
adds some code to add the _ back in if connected to a legacy A/B
implementation.

This isn't a complete fix (there are other places in the code that also
unconditionally strip the prefix) but is sufficient for Android Things
use case, and we want to keep this change as small and safe as possible
to avoid breaking anything else.

Bug: http://b/32996227
Test: `fastboot set_active _a` and `fastboot set_active a` works on
      both AndroidThings Edison board and Marlin.
Test: AndroidThings Edison flashall script now completes successfully.
Change-Id: I1a07e48b9e2726f386e9ece5267a9f1d8edefe22

(cherry picked from commit 04396f62da6150b94e02d50e5302fd980048833d)
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 7f4a0dd..3f8bc8f 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1742,6 +1742,14 @@
         } else if(!strcmp(*argv, "set_active")) {
             require(2);
             std::string slot = verify_slot(transport, std::string(argv[1]), false);
+            // Legacy support: verify_slot() removes leading underscores, we need to put them back
+            // in for old bootloaders. Legacy bootloaders do not have the slot-count variable but
+            // do have slot-suffixes.
+            std::string var;
+            if (!fb_getvar(transport, "slot-count", &var) &&
+                    fb_getvar(transport, "slot-suffixes", &var)) {
+                slot = "_" + slot;
+            }
             fb_set_active(slot.c_str());
             skip(2);
         } else if(!strcmp(*argv, "oem")) {