8/15/2015

EFI_GUID in EfiPy

Description

In EfiPy2, it uses self-defined ctypes structure, similar to EDK II structure, rather then python uuid library.
This is for easy to transfer EFI program from C code to Python.

for example, in EFI C program, it uses

EFI_GUID guid_sample = \
  { \
      0x8D59D32B, 0xC655, 0x4AE9, \
     {0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43} \
  };

In EfiPy2, it can be codded as

>>> from EfiPy2 import EFI_GUID
>>> TestGuid1 = EFI_GUID (
              0x8D59D32B,
              0xC655,
              0x4AE9,
              (0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43)
              )
>>> TestGuid2 = EFI_GUID (
              0x8D59D32B,
              0xC655,
              0x4AE9,
              (0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x44)
              )

EFI_GUID in EfiPy also provide object comparison and string output function

>>> print ("TestGuid1 == TestGuid2 :", TestGuid1 == TestGuid2)
TestGuid1 == TestGuid2 : False

Above result is false because these two GUID have different byte in their capability.

>>> print ("TestGuid1: %s" % TestGuid1)
8D59D32B-C655-4AE9-9B15-F25904992A43

Screenshot of EfiPy2Guild.py




No comments:

Post a Comment