feat: add AMT wireless adapter info to amtinfo LAN settings.
This commit is contained in:
@@ -377,14 +377,14 @@ bool cmd_get_remote_access_connection_status(int& network_status, int& remote_st
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settings)
|
bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settings, bool wired_interface)
|
||||||
{
|
{
|
||||||
// initialize HECI interface
|
// initialize HECI interface
|
||||||
if (heci_Init(NULL, PTHI_CLIENT) == 0) return false;
|
if (heci_Init(NULL, PTHI_CLIENT) == 0) return false;
|
||||||
|
|
||||||
// get wired interface
|
// get wired interface
|
||||||
LAN_SETTINGS lan_settings;
|
LAN_SETTINGS lan_settings;
|
||||||
UINT32 interface_settings = 0; // wired=0, wireless=1
|
UINT32 interface_settings = (wired_interface) ? 0 : 1; // wired=0, wireless=1
|
||||||
AMT_STATUS amt_status = pthi_GetLanInterfaceSettings(interface_settings, &lan_settings);
|
AMT_STATUS amt_status = pthi_GetLanInterfaceSettings(interface_settings, &lan_settings);
|
||||||
if (amt_status == 0)
|
if (amt_status == 0)
|
||||||
{
|
{
|
||||||
@@ -393,11 +393,13 @@ bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settin
|
|||||||
lan_interface_settings.dhcp_enabled = lan_settings.DhcpEnabled;
|
lan_interface_settings.dhcp_enabled = lan_settings.DhcpEnabled;
|
||||||
lan_interface_settings.link_status = lan_settings.LinkStatus;
|
lan_interface_settings.link_status = lan_settings.LinkStatus;
|
||||||
|
|
||||||
|
lan_interface_settings.ip_address.clear();
|
||||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 24) & 0xff);
|
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 24) & 0xff);
|
||||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 16) & 0xff);
|
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 16) & 0xff);
|
||||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 8) & 0xff);
|
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 8) & 0xff);
|
||||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address) & 0xff);
|
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address) & 0xff);
|
||||||
|
|
||||||
|
lan_interface_settings.mac_address.clear();
|
||||||
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[0]);
|
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[0]);
|
||||||
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[1]);
|
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[1]);
|
||||||
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[2]);
|
lan_interface_settings.mac_address.push_back(lan_settings.MacAddress[2]);
|
||||||
|
@@ -49,6 +49,6 @@ bool cmd_get_dns_suffix(std::string& suffix);
|
|||||||
bool cmd_get_wired_mac_address(std::vector<unsigned char>& address);
|
bool cmd_get_wired_mac_address(std::vector<unsigned char>& address);
|
||||||
bool cmd_get_certificate_hashes(std::vector<cert_hash_entry>& hash_entries);
|
bool cmd_get_certificate_hashes(std::vector<cert_hash_entry>& hash_entries);
|
||||||
bool cmd_get_remote_access_connection_status(int& network_status, int& remote_status, int& remote_trigger, std::string& mps_hostname);
|
bool cmd_get_remote_access_connection_status(int& network_status, int& remote_status, int& remote_trigger, std::string& mps_hostname);
|
||||||
bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settings);
|
bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settings, bool wired_interface = true);
|
||||||
|
|
||||||
#endif
|
#endif
|
42
info.cpp
42
info.cpp
@@ -20,7 +20,7 @@ void out_text(const std::string name, const std::vector<unsigned char> value, co
|
|||||||
for (unsigned char tmp : value)
|
for (unsigned char tmp : value)
|
||||||
{
|
{
|
||||||
(hex) ? std::cout << std::setfill('0') << std::setw(2) << std::hex << (unsigned int)tmp
|
(hex) ? std::cout << std::setfill('0') << std::setw(2) << std::hex << (unsigned int)tmp
|
||||||
: std::cout << (unsigned int)tmp;
|
: std::cout << std::dec << (unsigned int)tmp;
|
||||||
|
|
||||||
if (char_count++ < value.size())
|
if (char_count++ < value.size())
|
||||||
{
|
{
|
||||||
@@ -270,15 +270,41 @@ bool info_get_lan_interface_settings()
|
|||||||
tmp.ip_address.clear();
|
tmp.ip_address.clear();
|
||||||
tmp.mac_address.clear();
|
tmp.mac_address.clear();
|
||||||
|
|
||||||
if (!cmd_get_lan_interface_settings(tmp)) return false;
|
bool hasWired = cmd_get_lan_interface_settings(tmp);
|
||||||
|
if (hasWired)
|
||||||
|
{
|
||||||
|
out_text("LAN Inteface", "wired");
|
||||||
|
out_text("DHCP Enabled", (tmp.dhcp_enabled) ? "true" : "false");
|
||||||
|
out_text("DHCP Mode", (tmp.dhcp_mode == 1) ? "active" : "passive");
|
||||||
|
out_text("Link Status", (tmp.link_status) ? "up" : "down");
|
||||||
|
out_text("IP Address", tmp.ip_address, '.', false);
|
||||||
|
out_text("MAC Address", tmp.mac_address, ':');
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp.is_enabled = false;
|
||||||
|
tmp.link_status = false;
|
||||||
|
tmp.dhcp_enabled = false;
|
||||||
|
tmp.dhcp_mode = 0;
|
||||||
|
tmp.ip_address.clear();
|
||||||
|
tmp.mac_address.clear();
|
||||||
|
|
||||||
out_text("DHCP Enabled", (tmp.dhcp_enabled) ? "true" : "false");
|
bool hasWireless = cmd_get_lan_interface_settings(tmp, false);
|
||||||
out_text("DHCP Mode", (tmp.dhcp_mode == 1) ? "active" : "passive");
|
if (hasWireless)
|
||||||
out_text("Link Status", (tmp.link_status) ? "up" : "down");
|
{
|
||||||
out_text("IP Address", tmp.ip_address, '.', false);
|
out_text("LAN Inteface", "wireless");
|
||||||
out_text("MAC Address", tmp.mac_address, ':');
|
out_text("DHCP Enabled", (tmp.dhcp_enabled) ? "true" : "false");
|
||||||
|
out_text("DHCP Mode", (tmp.dhcp_mode == 1) ? "active" : "passive");
|
||||||
|
out_text("Link Status", (tmp.link_status) ? "up" : "down");
|
||||||
|
out_text("IP Address", tmp.ip_address, '.', false);
|
||||||
|
out_text("MAC Address", tmp.mac_address, ':');
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
if (hasWired || hasWireless)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool info_get(const std::string info)
|
bool info_get(const std::string info)
|
||||||
|
Reference in New Issue
Block a user