[edk2] [Patch] BaseTool: Fixed the bug of Boolean Hii Pcd packing.

BobCF posted 1 patch 5 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/GenVar.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2] [Patch] BaseTool: Fixed the bug of Boolean Hii Pcd packing.
Posted by BobCF 5 years, 9 months ago
When packing HiiPcd into PcdNvStoreDefaultValueBuffer,
The boolean type pcd value packing incorrect.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenVar.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index 3675be8de9..bf3d225c21 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -294,11 +294,11 @@ class VariableMgr(object):
             if tail:
                 for value_char in tail.split(","):
                     Buffer += pack("=B",int(value_char,16))
                 data_len += len(tail.split(","))
         elif data_type == "BOOLEAN":
-            Buffer += pack("=B",True) if var_value.upper() == "TRUE" else pack("=B",False)
+            Buffer += pack("=B",True) if var_value.upper() in ["TRUE","1"] else pack("=B",False)
             data_len += 1
         elif data_type  == DataType.TAB_UINT8:
             Buffer += pack("=B",GetIntegerValue(var_value))
             data_len += 1
         elif data_type == DataType.TAB_UINT16:
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTool: Fixed the bug of Boolean Hii Pcd packing.
Posted by Gao, Liming 5 years, 9 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Thursday, June 14, 2018 11:01 AM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTool: Fixed the bug of Boolean Hii Pcd packing.
>
>When packing HiiPcd into PcdNvStoreDefaultValueBuffer,
>The boolean type pcd value packing incorrect.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/AutoGen/GenVar.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py
>b/BaseTools/Source/Python/AutoGen/GenVar.py
>index 3675be8de9..bf3d225c21 100644
>--- a/BaseTools/Source/Python/AutoGen/GenVar.py
>+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
>@@ -294,11 +294,11 @@ class VariableMgr(object):
>             if tail:
>                 for value_char in tail.split(","):
>                     Buffer += pack("=B",int(value_char,16))
>                 data_len += len(tail.split(","))
>         elif data_type == "BOOLEAN":
>-            Buffer += pack("=B",True) if var_value.upper() == "TRUE" else
>pack("=B",False)
>+            Buffer += pack("=B",True) if var_value.upper() in ["TRUE","1"] else
>pack("=B",False)
>             data_len += 1
>         elif data_type  == DataType.TAB_UINT8:
>             Buffer += pack("=B",GetIntegerValue(var_value))
>             data_len += 1
>         elif data_type == DataType.TAB_UINT16:
>--
>2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel