3.12. powerd

The powerd utility monitors the system state and sets various power control options accordingly. It offers power-saving modes that can be individually selected for operation on AC power or batteries.

Table 3.12.1 shows the parameters for powerd requests:

Table 3.12.1 : Powerd class request parameters
Parameter Value Description
id   Any unique value for the request, including a hash, checksum, or uuid.
name powerd  
namespace sysadm  
action   list_options, list_status, read_options, set_active, set_inactive, set_options, start, stop.

The rest of this section provides examples of the available actions for each type of request, along with their responses.

3.12.1. List Options

The list_options action lists all the available options and possible settings for each one.

REST Request

PUT /sysadm/powerd
{
   "action" : "list_options"
}

WebSocket Request

{
   "name" : "powerd",
   "namespace" : "sysadm",
   "args" : {
      "action" : "list_options"
   },
   "id" : "fooid"
}

Response

{
  "args": {
    "list_options": {
      "ac_power_mode": [
        "maximum",
        "hiadaptive",
        "adaptive",
        "minumum"
      ],
      "adaptive_lower_threshold_percent": "int min=1 max=100",
      "adaptive_raise_threshold_percent": "int min=1 max=100",
      "battery_power_mode": [
        "maximum",
        "hiadaptive",
        "adaptive",
        "minumum"
      ],
      "max_cpu_freq": "int frequency(hz)>0",
      "min_cpu_freq": "int frequency(hz)>0",
      "polling_interval_ms": "int milliseconds>0",
      "unknown_power_mode": [
        "maximum",
        "hiadaptive",
        "adaptive",
        "minumum"
      ]
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.2. List Status

The list_status command displays the current state of the service (running, enabled, etc).

REST Request

PUT /sysadm/powerd
{
   "action" : "list_status"
}

WebSocket Request

{
   "id" : "fooid",
   "name" : "powerd",
   "namespace" : "sysadm",
   "args" : {
      "action" : "list_status"
   }
}

Response

{
  "args": {
    "list_status": {
      "enabled": "true",
      "running": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.3. Read Options

The read_options command shows all the current powerd settings.

REST Request

PUT /sysadm/powerd
{
   "action" : "read_options"
}

WebSocket Request

{
   "id" : "fooid",
   "name" : "powerd",
   "args" : {
      "action" : "read_options"
   },
   "namespace" : "sysadm"
}

Response

{
  "args": {
    "read_options": {
      "ac_power_mode": "maximum",
      "adaptive_lower_threshold_percent": "50",
      "adaptive_raise_threshold_percent": "75",
      "battery_power_mode": "adaptive",
      "max_cpu_freq": "-1",
      "min_cpu_freq": "-1",
      "polling_interval_ms": "250",
      "unknown_power_mode": "adaptive"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.4. Set Active

The set_active command enables the specified device to start on bootup.

REST Request

PUT /sysadm/powerd
{
   "action" : "set_active"
}

WebSocket Request

{
   "args" : {
      "action" : "set_active"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "powerd"
}

Response

{
  "args": {
    "set_active": {
      "enabled": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.5. Set Inactive

The set_inactive command disables the specific device from starting on bootup.

REST Request

PUT /sysadm/powerd
{
   "action" : "set_inactive"
}

WebSocket Request

{
   "args" : {
      "action" : "set_inactive"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "powerd"
}

Response

{
  "args": {
    "set_inactive": {
      "disabled": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.6. Set Options

Use the set_options command to modify any powerd settings.

REST Request

PUT /sysadm/powerd
{
   "battery_power_mode" : "minimum",
   "action" : "set_options"
}

WebSocket Request

{
   "name" : "powerd",
   "args" : {
      "action" : "set_options",
      "battery_power_mode" : "minimum"
   },
   "id" : "fooid",
   "namespace" : "sysadm"
}

Response

{
  "args": {
    "set_options": {
      "ac_power_mode": "maximum",
      "adaptive_lower_threshold_percent": "50",
      "adaptive_raise_threshold_percent": "75",
      "battery_power_mode": "minimum",
      "max_cpu_freq": "-1",
      "min_cpu_freq": "-1",
      "polling_interval_ms": "250",
      "unknown_power_mode": "adaptive"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.7. Start

The start command starts the service immediately.

REST Request

PUT /sysadm/powerd
{
   "action" : "start"
}

WebSocket Request

{
   "args" : {
      "action" : "start"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "powerd"
}

Response

{
  "args": {
    "start": {
      "started": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}

3.12.8. Stop

The stop command immediately stops the service.

REST Request

PUT /sysadm/powerd
{
   "action" : "stop"
}

WebSocket Request

{
   "args" : {
      "action" : "stop"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "powerd"
}

Response

{
  "args": {
    "stop": {
      "stopped": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}