summaryrefslogtreecommitdiff
path: root/src/hvinfo.adb
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-03-10 19:12:06 +0600
committerDaniil Baturin <daniil@baturin.org>2015-03-10 19:12:06 +0600
commit773e91c9101fb0b9b956a6b54b0dbff5ceedca38 (patch)
tree83cf22b5c1f78f0920f525951911c5f9077076f3 /src/hvinfo.adb
parent8df2750299424d74af357e650554d2a814a2b123 (diff)
downloadhvinfo-773e91c9101fb0b9b956a6b54b0dbff5ceedca38.tar.gz
hvinfo-773e91c9101fb0b9b956a6b54b0dbff5ceedca38.zip
Add support for SMBIOS vendor string based detection.
Diffstat (limited to 'src/hvinfo.adb')
-rw-r--r--src/hvinfo.adb29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/hvinfo.adb b/src/hvinfo.adb
index cfde51b..aa456a4 100644
--- a/src/hvinfo.adb
+++ b/src/hvinfo.adb
@@ -1,16 +1,35 @@
+with Ada.Strings.Unbounded;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Ada.Command_Line; use Ada.Command_Line;
with Hypervisor_Check; use Hypervisor_Check;
+
procedure HVInfo is
+ package US renames Ada.Strings.Unbounded;
+ CPUID_HV_Name, SMBIOS_HV_Name, Hypervisor_Name : US.Unbounded_String;
begin
+ CPUID_HV_Name := US.To_Unbounded_String ("");
+ SMBIOS_HV_Name := US.To_Unbounded_String ("");
- -- Try CPUID checks first
if Hypervisor_Present then
- Put_Line (Get_Vendor_Name);
- Set_Exit_Status (0);
- else
- Set_Exit_Status (1);
+ CPUID_HV_Name := Get_Vendor_Name;
end if;
+
+ SMBIOS_HV_Name := Get_DMI_Vendor_Name;
+
+ declare
+ use US;
+ begin
+ if (CPUID_HV_Name = "") and (SMBIOS_HV_Name = "") then
+ Set_Exit_Status (1);
+ elsif (CPUID_HV_Name /= "") then
+ Set_Exit_Status (0);
+ UIO.Put_Line (CPUID_HV_Name);
+ else
+ Set_Exit_Status (0);
+ UIO.Put_Line (SMBIOS_HV_Name);
+ end if;
+ end;
+
end HVInfo;