fastboot: add support for 'getvar platform'
[platform/kernel/u-boot.git] / drivers / fastboot / fb_getvar.c
index 91a774a..4268628 100644 (file)
@@ -17,6 +17,7 @@ static void getvar_downloadsize(char *var_parameter, char *response);
 static void getvar_serialno(char *var_parameter, char *response);
 static void getvar_version_baseband(char *var_parameter, char *response);
 static void getvar_product(char *var_parameter, char *response);
+static void getvar_platform(char *var_parameter, char *response);
 static void getvar_current_slot(char *var_parameter, char *response);
 static void getvar_slot_suffixes(char *var_parameter, char *response);
 static void getvar_has_slot(char *var_parameter, char *response);
@@ -56,6 +57,9 @@ static const struct {
                .variable = "product",
                .dispatch = getvar_product
        }, {
+               .variable = "platform",
+               .dispatch = getvar_platform
+       }, {
                .variable = "current-slot",
                .dispatch = getvar_current_slot
        }, {
@@ -117,6 +121,16 @@ static void getvar_product(char *var_parameter, char *response)
                fastboot_fail("Board not set", response);
 }
 
+static void getvar_platform(char *var_parameter, char *response)
+{
+       const char *p = env_get("platform");
+
+       if (p)
+               fastboot_okay(p, response);
+       else
+               fastboot_fail("platform not set", response);
+}
+
 static void getvar_current_slot(char *var_parameter, char *response)
 {
        /* A/B not implemented, for now always return _a */