Added AMT on, off, reset power commands to meshctrl.js, #4038

Ylian Saint-Hilaire committed May 24, 2022 at 14:37 UTC 92dac1df8b45b7d9ed079abd104163eabf1542ea
2 files changed +13
amtmanager.js
+1
@@ -955,6 +955,7 @@ module.exports.CreateAmtManager = function (parent) {
955 // If not LMS, has a AMT stack present and is in connected state, perform power operation.
956 if ((dev.connType != 2) && (dev.state == 1) && (dev.amtstack != null)) {
957 // Action: 2 = Power on, 8 = Power down, 10 = reset
958 + parent.debug('amt', dev.name, "performPowerAction", action);
959 dev.powerAction = action;
960 try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { }
961 }
meshctrl.js
+12
@@ -839,6 +839,9 @@ if (args['_'].length == 0) {
839 console.log(" --reset - Attempt to remote the remote device.");
840 console.log(" --sleep - Attempt to place the remote device in low power mode.");
841 console.log(" --off - Attempt to power off the remote device.");
842 + console.log(" --amtoff - Attempt to power off the remote device using Intel AMT.");
843 + console.log(" --amton - Attempt to power on the remote device using Intel AMT.");
844 + console.log(" --amtreset - Attempt to reset the remote device using Intel AMT.");
845 break;
846 }
847 case 'devicesharing': {
@@ -1520,6 +1523,15 @@ function serverConnect() {
1523 } else if (args.sleep) {
1524 // Sleep operation
1525 ws.send(JSON.stringify({ action: 'poweraction', nodeids: nodes, actiontype: 4, responseid: 'meshctrl' }));
1526 + } else if (args.amton) {
1527 + // Intel AMT Power on operation
1528 + ws.send(JSON.stringify({ action: 'poweraction', nodeids: nodes, actiontype: 302, responseid: 'meshctrl' }));
1529 + } else if (args.amtoff) {
1530 + // Intel AMT Power off operation
1531 + ws.send(JSON.stringify({ action: 'poweraction', nodeids: nodes, actiontype: 308, responseid: 'meshctrl' }));
1532 + } else if (args.amtreset) {
1533 + // Intel AMT Power reset operation
1534 + ws.send(JSON.stringify({ action: 'poweraction', nodeids: nodes, actiontype: 310, responseid: 'meshctrl' }));
1535 } else {
1536 console.log('No power operation specified.');
1537 process.exit(1);