1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added Intel AMT wake support.

This commit is contained in:
Ylian Saint-Hilaire 2020-10-07 14:06:13 -07:00
parent 9df9de0922
commit b12b6fa26b
2 changed files with 22 additions and 0 deletions

View file

@ -59,6 +59,11 @@ module.exports.CreateAmtManager = function(parent) {
// React to node being removed
if (event.action == 'removenode') { removeDevice(event.nodeid); }
// React to node wakeup command, perform Intel AMT wake if possible
if ((event.action == 'wakedevices') && (Array.isArray(event.nodeids))) {
for (var i in event.nodeids) { performPowerAction(event.nodeids[i], 2); }
}
}
// Remove a device
@ -69,6 +74,18 @@ module.exports.CreateAmtManager = function(parent) {
delete obj.amtDevices[nodeid];
}
// Perform a power action: 2 = Power up, 5 = Power cycle, 8 = Power down, 10 = Reset
function performPowerAction(nodeid, action) {
var dev = obj.amtDevices[nodeid];
if ((dev == null) || (dev.amtstack == null)) return;
try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { }
}
// Response to Intel AMT power action
function performPowerActionResponse(stack, name, responses, status) {
//console.log('performPowerActionResponse', status);
}
// Update information about a device
function fetchIntelAmtInformation(nodeid) {
parent.db.Get(nodeid, function (err, nodes) {