DCMI: Set and Get DCMI Management Controller Identifier String
- Created new script for Set and Get DCMI Management Controller Identifier String.
Tested:
- Ran All The Scripts Successfully
Change-Id: I8085617716949a73ccf7dbb5b20502a03ee4d721
Signed-off-by: ganesanb <ganesanb@ami.com>
diff --git a/lib/utils.py b/lib/utils.py
index ee167de..50244bb 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -505,3 +505,56 @@
"""
return re.findall(r"\d+", re.sub("[A-Z]|[a-z]", "", version))
+
+
+def convert_name_into_bytes_with_prefix(name):
+ r"""
+ Convert name into bytes with prefix 0x
+ """
+
+ bytes_list = []
+
+ for letter in name:
+ bytes_list.append(hex(ord(letter)))
+
+ return bytes_list
+
+
+def convert_name_into_bytes_without_prefix(name):
+ r"""
+ Convert name into bytes
+ """
+
+ tmp_lst = []
+
+ for letter in name:
+ value = convert_to_hex_value_without_prefix(letter)
+ tmp_lst.append(value)
+
+ return tmp_lst
+
+
+def convert_to_hex_value_without_prefix(letter):
+ r"""
+ Convert into hex
+ """
+
+ value = hex(ord(letter))
+ if value[:2] == "0x":
+ value = value[2:]
+
+ return value
+
+
+def convert_prefix_hex_list_to_non_prefix_hex_list(list):
+ r"""
+ Convert into list of hex with prefix to list of hex without prefix.
+ """
+
+ tmp_list = []
+
+ for value in list:
+ if value[:2] == "0x":
+ tmp_list.append(value[2:])
+
+ return tmp_list