
{"id":12902,"date":"2026-05-07T10:09:40","date_gmt":"2026-05-07T10:09:40","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/?page_id=12902"},"modified":"2026-05-07T10:13:52","modified_gmt":"2026-05-07T10:13:52","slug":"power-manager","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/","title":{"rendered":"Power-Manager"},"content":{"rendered":"\n<p>The RDKB Power Manager is a lightweight system service responsible for managing power state transitions and coordinating orderly shutdown and startup of RDKB CCSP components based on power source changes and thermal conditions. This component monitors power transition events from the system layer and orchestrates component lifecycle management during power state changes. Power Manager handles transitions between AC power and battery operation on supported platforms, as well as thermal management states to protect hardware from overheating conditions.<\/p>\n\n\n\n<p>The component operates as a daemon process that listens to sysevent notifications for power state changes, validates transitions, invokes management scripts to control RDKB component lifecycles, and publishes the current power state for other components to consume. Power Manager maintains minimal resource footprint for power event handling and component coordination across different power modes.<\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">graph LR\n    subgraph \"External Systems\"\n        SYSD[System Power Events]\n        THERM[Thermal Monitoring]\n    end\n\n    subgraph \"RDK-B Platform\"\n        PWR[\"Power Manager\"]\n        PANDM[\"CCSP P&amp;M\"]\n        MTA[\"MTA Agent\"]\n        WIFI[\"WiFi Manager\"]\n        MOCA[\"MoCA Agent\"]\n        LM[\"LMLite\"]\n        HARV[\"Harvester\"]\n\n        subgraph \"System Layer\"\n            SYSEVT[\"Sysevent Daemon\"]\n            SYSD_SVC[\"Systemd Services\"]\n        end\n\n        subgraph \"HAL Layer\"\n            MTAHAL[\"MTA HAL\"]\n        end\n    end\n\n    SYSD -->|Power Events| SYSEVT\n    THERM -->|Thermal Events| SYSEVT\n    SYSEVT &lt;-->|rdkb-power-transition&lt;br \/>rdkb-power-state| PWR\n    PWR -->|Script Execution| SYSD_SVC\n    PWR -->|Battery Query| MTAHAL\n    SYSD_SVC -.->|Shutdown Order| HARV\n    SYSD_SVC -.->|Shutdown Order| LM\n    SYSD_SVC -.->|Shutdown Order| WIFI\n    SYSD_SVC -.->|Shutdown Order| MOCA\n    SYSD_SVC -.->|Keep Running| PANDM\n    SYSD_SVC -.->|Keep Running| MTA\n\n    classDef external fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;\n    classDef pwrMgr fill:#e3f2fd,stroke:#1976d2,stroke-width:3px;\n    classDef rdkbComponent fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px;\n    classDef system fill:#fce4ec,stroke:#c2185b,stroke-width:2px;\n\n    class SYSD,THERM external;\n    class PWR pwrMgr;\n    class PANDM,MTA,WIFI,MOCA,LM,HARV rdkbComponent;\n    class SYSEVT,SYSD_SVC,MTAHAL system;<\/pre><\/div>\n\n\n\n<p><strong>Key Features &amp; Responsibilities<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Power State Transition Management<\/strong>: Monitors and processes power source transitions between AC power and battery operation on supported platforms, ensuring graceful component shutdown and startup sequences<\/li>\n\n\n\n<li><strong>Thermal State Management<\/strong>: Handles thermal condition transitions from normal operation to hot state and back to cooled state, triggering protective component shutdowns to prevent hardware damage<\/li>\n\n\n\n<li><strong>Component Lifecycle Coordination<\/strong>: Orchestrates orderly shutdown and startup of non-essential RDKB components while preserving critical services for remote management and voice functionality<\/li>\n\n\n\n<li><strong>Sysevent Integration<\/strong>: Listens to rdkb-power-transition events and publishes rdkb-power-state notifications for current power operating mode<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"PowerManager-Design\">Design<\/h2>\n\n\n\n<p>Power Manager implements a lightweight event-driven architecture focused on power state monitoring and component coordination with minimal system overhead. The design separates power event detection, state transition validation, and component lifecycle management. The component operates as a standalone daemon process with dedicated threading for asynchronous event handling without blocking critical operations.<\/p>\n\n\n\n<p>The architecture maintains a simple state machine tracking current power mode and validating transition requests to prevent invalid state changes. Power Manager delegates actual component shutdown and startup operations to a companion shell script that encapsulates platform-specific systemd service management commands. This separation allows platform-specific customization while maintaining consistent core power management logic.<\/p>\n\n\n\n<p>Sysevent serves as the primary IPC mechanism for both receiving power transition notifications and publishing current state information. The component establishes two sysevent connections &#8211; one dedicated to asynchronous event notifications and another for synchronous state publication operations. On startup, Power Manager queries battery status through MTA HAL on battery-capable platforms to initialize with correct power state before beginning event processing.<\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">flowchart LR\n    subgraph External [\"External Services\"]\n        SYSE[Sysevent Daemon]\n        HAL[MTA HAL]\n        SYSD[Systemd Services]\n    end\n\n    subgraph PowerMgr [\"Power Manager\"]\n        MAIN[Main Process]\n        INIT[Initialization Module]\n        STATE[State Machine]\n        SYSE_HAND[Sysevent Handler Thread]\n        TRANS[Transition Handler]\n        SCRIPT[Script Executor]\n        SHELL[Management Script&lt;br\/>rdkb_power_manager.sh]\n    end\n\n    MAIN -->|Initialize| INIT\n    INIT -->|Register Events| SYSE\n    INIT -->|Query Battery Status| HAL\n    INIT -->|Set Initial State| STATE\n    INIT -->|Spawn Thread| SYSE_HAND\n    SYSE_HAND &lt;-->|Get Notifications| SYSE\n    SYSE_HAND -->|Validate &amp; Process| TRANS\n    TRANS -->|Check Current State| STATE\n    TRANS -->|Execute Script| SCRIPT\n    SCRIPT -->|Invoke| SHELL\n    SHELL -->|systemctl commands| SYSD\n    TRANS -->|Update State| STATE\n    TRANS -->|Publish State| SYSE\n\n    classDef component fill:#e1f5fe,stroke:#0277bd,stroke-width:2px\n    classDef external fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px\n\n    class MAIN,INIT,STATE,SYSE_HAND,TRANS,SCRIPT,SHELL component\n    class SYSE,HAL,SYSD external<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-PrerequisitesandDependencies\">Prerequisites and Dependencies<\/h3>\n\n\n\n<p><strong>Build-Time Flags and Configuration:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Configure Option<\/strong><\/td><td><strong>DISTRO Feature<\/strong><\/td><td><strong>Build Flag<\/strong><\/td><td><strong>Purpose<\/strong><\/td><td><strong>Default<\/strong><\/td><\/tr><tr><td><code>--enable-gtestapp<\/code><\/td><td>N\/A<\/td><td><code>GTEST_ENABLE<\/code><\/td><td>Enable GTest support for unit testing<\/td><td>Disabled<\/td><\/tr><tr><td>N\/A<\/td><td>RDK logging<\/td><td><code>FEATURE_SUPPORT_RDKLOG<\/code><\/td><td>Enable RDK logger integration for standardized logging<\/td><td>Enabled<\/td><\/tr><tr><td>N\/A<\/td><td>Crash reporting<\/td><td><code>INCLUDE_BREAKPAD<\/code><\/td><td>Enable breakpad crash handler for minidump generation<\/td><td>Enabled<\/td><\/tr><tr><td>N\/A<\/td><td>Development<\/td><td><code>_DEBUG<\/code><\/td><td>Enable debug output redirection to console<\/td><td>Enabled in source<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>RDK-B Platform and Integration Requirements:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Build Dependencies<\/strong>:\u00a0<code>ccsp-common-library<\/code>,\u00a0<code>sysevent<\/code>,\u00a0<code>syscfg<\/code>,\u00a0<code>hal-mta<\/code>,\u00a0<code>rdk-logger<\/code>,\u00a0<code>breakpad<\/code>,\u00a0<code>breakpad-wrapper<\/code>,\u00a0<code>secure-wrapper<\/code><\/li>\n\n\n\n<li><strong>RDK-B Components<\/strong>:\u00a0<code>CcspCrSsp<\/code>,\u00a0<code>CcspMtaAgentSsp<\/code><\/li>\n\n\n\n<li><strong>HAL Dependencies<\/strong>: MTA HAL APIs for battery status query on battery-capable platforms<\/li>\n\n\n\n<li><strong>Systemd Services<\/strong>:\u00a0<code>CcspCrSsp.service<\/code>,\u00a0<code>CcspMtaAgentSsp.service<\/code>\u00a0must be active before\u00a0<code>rdkbPowerManager.service<\/code>\u00a0starts<\/li>\n\n\n\n<li><strong>Configuration Files<\/strong>:\u00a0<code>\/tmp\/.rdkbPowerMgr.pid<\/code>\u00a0for process tracking,\u00a0<code>\/etc\/device.properties<\/code>\u00a0for platform configuration,\u00a0<code>\/etc\/debug.ini<\/code>\u00a0for RDK logger initialization<\/li>\n\n\n\n<li><strong>Startup Order<\/strong>: Initialize after sysevent daemon is running and MTA agent services are available<\/li>\n<\/ul>\n\n\n\n<p><strong>Threading Model:<\/strong><\/p>\n\n\n\n<p>Power Manager implements a multi-threaded architecture with a main process thread and a dedicated worker thread for asynchronous sysevent notification handling.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Threading Architecture<\/strong>: Multi-threaded with event-driven worker thread<\/li>\n\n\n\n<li><strong>Main Thread<\/strong>: Handles component initialization, sysevent registration, initial state setup, and process lifecycle management including thread creation and cleanup<\/li>\n\n\n\n<li><strong>Worker Threads<\/strong>:<\/li>\n\n\n\n<li><strong>Sysevent Handler Thread<\/strong>: Continuously monitors rdkb-power-transition events, validates incoming transition requests, invokes state transition logic, and publishes updated power state<\/li>\n\n\n\n<li><strong>Synchronization<\/strong>: Thread naming using pthread_setname_np for debugging and monitoring, thread joining on shutdown for clean termination<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-ComponentStateFlow\">Component State Flow<\/h3>\n\n\n\n<p><strong>Initialization to Active State<\/strong><\/p>\n\n\n\n<p>Power Manager follows a sequential initialization process: establish sysevent connections, query initial power state, spawn event handler thread, then transition to active monitoring mode.<\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">sequenceDiagram\n    autonumber\n    participant System as System Startup\n    participant PowerMgr as Power Manager\n    participant Sysevent as Sysevent Daemon\n    participant HAL as MTA HAL\n    participant Thread as Sysevent Handler Thread\n\n    System->>PowerMgr: Start rdkbPowerMgr Process\n    Note over PowerMgr: State: Initializing&lt;br\/>Fork and daemonize process\n\n    PowerMgr->>PowerMgr: Check PID File \/tmp\/.rdkbPowerMgr.pid\n    Note over PowerMgr: Prevent duplicate instances\n\n    PowerMgr->>Sysevent: sysevent_open(rdkb_power_manger)\n    Sysevent-->>PowerMgr: sysevent_fd and token\n    PowerMgr->>Sysevent: sysevent_open(rdkb_power_manger-gs)\n    Sysevent-->>PowerMgr: sysevent_fd_gs and token_gs\n    Note over PowerMgr: State: Initializing \u2192 LoadingDefaults\n\n    PowerMgr->>HAL: mta_hal_BatteryGetPowerStatus()\n    Note over PowerMgr: Query battery status on XBB1\/CBR2\n    HAL-->>PowerMgr: Battery Status or AC\n    PowerMgr->>PowerMgr: Set gCurPowerState\n    Note over PowerMgr: State: LoadingDefaults \u2192 RegisteringEvents\n\n    PowerMgr->>Sysevent: sysevent_set(rdkb-power-state)\n    PowerMgr->>Thread: pthread_create(PwrMgr_sysevent_handler)\n    Thread->>Sysevent: sysevent_setnotification(rdkb-power-transition)\n    Sysevent-->>Thread: async_id registered\n    Note over PowerMgr: State: RegisteringEvents \u2192 Active\n\n    PowerMgr->>System: Initialization Complete\n    Note over Thread: State: Active&lt;br\/>Event monitoring loop\n\n    loop Power State Monitoring\n        Thread->>Sysevent: sysevent_getnotification()\n        Sysevent-->>Thread: Power Transition Event\n        Thread->>Thread: PwrMgr_StateTranstion()\n    end\n\n    System->>PowerMgr: Stop Signal\n    PowerMgr->>Thread: pthread_join()\n    Thread-->>PowerMgr: Thread Terminated\n    Note over PowerMgr: State: Active \u2192 Shutdown\n    PowerMgr->>System: Process Exit<\/pre><\/div>\n\n\n\n<p><strong>Runtime State Changes and Context Switching<\/strong><\/p>\n\n\n\n<p>During active operation, Power Manager responds to power transition events by validating state and managing component lifecycle.<\/p>\n\n\n\n<p><strong>State Change Triggers:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>rdkb-power-transition<\/code>\u00a0sysevent set to\u00a0<code>POWER_TRANS_AC<\/code>\u00a0initiates transition to AC power mode with component startup<\/li>\n\n\n\n<li><code>rdkb-power-transition<\/code>\u00a0sysevent set to\u00a0<code>POWER_TRANS_BATTERY<\/code>\u00a0initiates transition to battery mode with non-essential component shutdown on battery-capable platforms<\/li>\n\n\n\n<li><code>rdkb-power-transition<\/code>\u00a0sysevent set to\u00a0<code>POWER_TRANS_HOT<\/code>\u00a0initiates transition to thermal hot state with protective component shutdown<\/li>\n\n\n\n<li><code>rdkb-power-transition<\/code>\u00a0sysevent set to\u00a0<code>POWER_TRANS_COOLED<\/code>\u00a0initiates transition from thermal hot to cooled state with component restart<\/li>\n\n\n\n<li>Sysevent daemon restart detection triggers connection re-establishment after 600 second delay<\/li>\n<\/ul>\n\n\n\n<p><strong>Context Switching Scenarios:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Battery to AC transition switches from low-power component-limited mode to full operational mode with all services running<\/li>\n\n\n\n<li>AC to Battery transition switches from full operational mode to low-power mode preserving only critical services for remote management and voice<\/li>\n\n\n\n<li>Thermal hot transition switches from normal operation to protective mode shutting down high-activity components to reduce heat generation<\/li>\n\n\n\n<li>Thermal cooled transition restores normal operational context after thermal conditions normalize<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-CallFlow\">Call Flow<\/h3>\n\n\n\n<p><strong>Initialization Call Flow:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">sequenceDiagram\n    participant Main as Main Process\n    participant Init as PwrMgr_Init\n    participant Reg as PwrMgr_Register_sysevent\n    participant Def as PwrMgr_SetDefaults\n    participant HAL as MTA HAL\n    participant Sysevent as Sysevent Daemon\n\n    Main->>Main: Daemonize Process\n    Main->>Main: checkIfAlreadyRunning()\n    Main->>Init: PwrMgr_Init()\n    Init->>Reg: PwrMgr_Register_sysevent()\n    Reg->>Sysevent: sysevent_open(rdkb_power_manger)\n    Sysevent-->>Reg: sysevent_fd and token\n    Reg->>Sysevent: sysevent_open(rdkb_power_manger-gs)\n    Sysevent-->>Reg: sysevent_fd_gs and token_gs\n    Reg->>Def: PwrMgr_SetDefaults()\n    Def->>HAL: mta_hal_BatteryGetPowerStatus()\n    HAL-->>Def: Battery Status AC or Battery\n    Def->>Def: Set gCurPowerState\n    Def->>Def: sleep(5)\n    Def->>Sysevent: sysevent_set(rdkb-power-state)\n    Note over Sysevent: Publish initial power state\n    Def-->>Reg: Initialization Complete\n    Reg-->>Init: Registration Complete\n    Init->>Init: pthread_create(PwrMgr_sysevent_handler)\n    Init-->>Main: Initialization Complete<\/pre><\/div>\n\n\n\n<p><strong>Power Transition Processing Call Flow:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">sequenceDiagram\n    participant External as External Event Source\n    participant Sysevent as Sysevent Daemon\n    participant Thread as Sysevent Handler Thread\n    participant Trans as PwrMgr_StateTranstion\n    participant Script as rdkb_power_manager.sh\n    participant Systemd as Systemd\n\n    External->>Sysevent: sysevent set rdkb-power-transition POWER_TRANS_*\n    Sysevent->>Thread: Notification with event name and value\n    Thread->>Thread: sysevent_getnotification(rdkb-power-transition)\n    Thread->>Thread: Parse Event Name and Value\n    Thread->>Trans: PwrMgr_StateTranstion(POWER_TRANS_*)\n    Trans->>Trans: Convert String to Power State Enum\n    Trans->>Trans: Validate Current vs New State\n\n    alt Valid Transition AC\/COOLED\n        Trans->>Script: v_secure_system(rdkb_power_manager.sh POWER_TRANS_AC\/COOLED)\n        Script->>Systemd: systemctl start CcspMoca.service\n        Script->>Systemd: systemctl start ccspwifiagent\/onewifi.service\n        Script->>Systemd: systemctl start CcspLMLite.service\n        Script->>Systemd: systemctl start harvester.service\n        Systemd-->>Script: Services Started\n        Script-->>Trans: Exit Code 0 Success\n        Trans->>Trans: Update gCurPowerState\n        Trans->>Sysevent: sysevent_set(rdkb-power-state, AC\/ThermalCooled)\n    else Valid Transition BATTERY\/HOT\n        Trans->>Script: v_secure_system(rdkb_power_manager.sh POWER_TRANS_BATTERY\/HOT)\n        Script->>Systemd: systemctl stop harvester.service\n        Script->>Systemd: systemctl stop CcspLMLite.service\n        Script->>Systemd: systemctl stop ccspwifiagent\/onewifi.service\n        Script->>Systemd: systemctl stop CcspMoca.service\n        Systemd-->>Script: Services Stopped\n        Script-->>Trans: Exit Code 0 Success\n        Trans->>Trans: Update gCurPowerState\n        Trans->>Sysevent: sysevent_set(rdkb-power-state, Battery\/ThermalHot)\n    else Invalid or Same State\n        Trans->>Trans: Log Warning and Ignore\n    end\n\n    Trans-->>Thread: Transition Result\n    Thread->>Thread: Continue Event Loop<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"PowerManager-InternalModules\">Internal Modules<\/h2>\n\n\n\n<p>Power Manager consists of a single monolithic process with functional separation through internal functions rather than separate module files.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Module\/Class<\/strong><\/td><td><strong>Description<\/strong><\/td><td><strong>Key Files<\/strong><\/td><\/tr><tr><td><strong>Main Process<\/strong><\/td><td>Process entry point handling daemonization, PID file management, initialization orchestration, and breakpad crash handler setup<\/td><td><code>pwrMgr.c<\/code>&nbsp;main function<\/td><\/tr><tr><td><strong>Initialization Handler<\/strong><\/td><td>Component initialization logic including sysevent registration, default state setup, and thread creation<\/td><td><code>pwrMgr.c<\/code>&nbsp;PwrMgr_Init, PwrMgr_Register_sysevent, PwrMgr_SetDefaults<\/td><\/tr><tr><td><strong>Sysevent Handler Thread<\/strong><\/td><td>Asynchronous event monitoring loop receiving and dispatching power transition notifications<\/td><td><code>pwrMgr.c<\/code>&nbsp;PwrMgr_sysevent_handler<\/td><\/tr><tr><td><strong>State Transition Engine<\/strong><\/td><td>Power state validation and transition execution including script invocation and state publication<\/td><td><code>pwrMgr.c<\/code>&nbsp;PwrMgr_StateTranstion<\/td><\/tr><tr><td><strong>Component Lifecycle Management Script<\/strong><\/td><td>Shell script performing orderly shutdown and startup of RDKB components via systemd service management invoked by State Transition Engine<\/td><td><code>scripts\/rdkb_power_manager.sh<\/code>&nbsp;PwrMgr_TearDownComponents, PwrMgr_StartupComponents<\/td><\/tr><tr><td><strong>Configuration Module<\/strong><\/td><td>Power state definitions and transition string mappings<\/td><td><code>pwrMgr.h<\/code>&nbsp;PWRMGR_PwrState, PWRMGR_PwrStateItem<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"PowerManager-ComponentInteractions\">Component Interactions<\/h2>\n\n\n\n<p>Power Manager maintains focused interactions with system services for event monitoring and component lifecycle management through sysevent notifications and shell script execution for orderly component shutdown and startup sequences.<\/p>\n\n\n\n<p><strong>Configuration Persistence:<\/strong>&nbsp;Power Manager does not persist power state configuration across reboots. The component queries MTA HAL on startup to determine initial power state on battery-capable platforms, defaulting to AC mode otherwise. Runtime power state changes are handled via sysevent notifications and are not stored in syscfg or PSM.<\/p>\n\n\n\n<p><strong>Events Published by Power Manager:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Event Name<\/strong><\/td><td><strong>Event Topic\/Path<\/strong><\/td><td><strong>Trigger Condition<\/strong><\/td><td><strong>Subscriber Components<\/strong><\/td><\/tr><tr><td>Power State Update<\/td><td><code>rdkb-power-state<\/code>&nbsp;sysevent<\/td><td>Successful power state transition completion<\/td><td>All RDKB components monitoring power state for operational adjustments<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Events Subscribed by Power Manager:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Event Name<\/strong><\/td><td><strong>Event Topic\/Path<\/strong><\/td><td><strong>Action Taken<\/strong><\/td><\/tr><tr><td>Power Transition Request<\/td><td><code>rdkb-power-transition<\/code>&nbsp;sysevent<\/td><td>Validate and execute power state transition invoking management script<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-IPCFlowPatterns\">IPC Flow Patterns<\/h3>\n\n\n\n<p><strong>Primary IPC Flow &#8211; Power State Transition:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">sequenceDiagram\n    participant External as External Event Source\n    participant Sysevent as Sysevent Daemon\n    participant PowerMgr as Power Manager\n    participant Script as rdkb_power_manager.sh\n    participant Systemd as Systemd\n\n    External->>Sysevent: sysevent set rdkb-power-transition POWER_TRANS_BATTERY\n    Note over Sysevent: Event: rdkb-power-transition&lt;br\/>Value: POWER_TRANS_BATTERY\n    Sysevent->>PowerMgr: sysevent_getnotification() Callback\n    Note over PowerMgr: PwrMgr_StateTranstion() validates request\n    PowerMgr->>Script: v_secure_system(rdkb_power_manager.sh POWER_TRANS_BATTERY)\n    Script->>Systemd: systemctl stop harvester.service\n    Script->>Systemd: systemctl stop CcspLMLite.service\n    Script->>Systemd: systemctl stop ccspwifiagent\/onewifi.service\n    Script->>Systemd: systemctl stop CcspMoca.service\n    Note over Systemd: Non-essential services stopped\n    Systemd-->>Script: Services Stopped Successfully\n    Script-->>PowerMgr: Exit Status 0\n\n    alt Success\n        PowerMgr->>PowerMgr: Update gCurPowerState to BATTERY\n        PowerMgr->>Sysevent: sysevent_set(rdkb-power-state, Battery)\n        Note over Sysevent: State: Battery published\n    else Failure\n        PowerMgr->>PowerMgr: PWRMGRLOG(ERROR) Keep Current State\n    end<\/pre><\/div>\n\n\n\n<p><strong>Event Notification Flow:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-merpress-mermaidjs diagram-source-mermaid\"><pre class=\"mermaid\">sequenceDiagram\n    participant Sysevent as Sysevent Daemon\n    participant PowerMgr as Power Manager Sysevent Thread\n    participant Components as RDKB Components\n\n    loop Active Monitoring\n        PowerMgr->>Sysevent: sysevent_getnotification()\n        Note over PowerMgr: Blocking call waiting for rdkb-power-transition\n        Sysevent-->>PowerMgr: Event: rdkb-power-transition&lt;br\/>Value: POWER_TRANS_AC\n        PowerMgr->>PowerMgr: PwrMgr_StateTranstion(POWER_TRANS_AC)\n        PowerMgr->>PowerMgr: v_secure_system(rdkb_power_manager.sh POWER_TRANS_AC)\n        Note over PowerMgr: Start CcspMoca, WiFi, LMLite, Harvester\n        PowerMgr->>Sysevent: sysevent_set(rdkb-power-state, AC)\n    end\n\n    Note over Sysevent: Power state change published:&lt;br\/>rdkb-power-state = AC\n    Sysevent->>Components: Notify subscribed RDKB components\n    Components->>Components: Adjust behavior for AC power mode<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"PowerManager-ImplementationDetails\">Implementation Details<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-MajorHALAPIsIntegration\">Major HAL APIs Integration<\/h3>\n\n\n\n<p>Power Manager integrates with MTA HAL on battery-capable platforms to query initial battery power status during component initialization.<\/p>\n\n\n\n<p><strong>Core HAL APIs:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>HAL API<\/strong><\/td><td><strong>Purpose<\/strong><\/td><td><strong>Implementation File<\/strong><\/td><\/tr><tr><td><code>mta_hal_BatteryGetPowerStatus()<\/code><\/td><td>Query current battery power status returning AC Battery or Unknown for initial state determination<\/td><td><code>pwrMgr.c<\/code>&nbsp;PwrMgr_SetDefaults function<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-KeyImplementationLogic\">Key Implementation Logic<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>State Machine Engine<\/strong>: Maintains current power state in\u00a0<code>gCurPowerState<\/code>\u00a0global variable with predefined state definitions in\u00a0<code>powerStateArr<\/code>\u00a0array mapping enum values to transition strings and state strings<\/li>\n\n\n\n<li>State transition validation in\u00a0<code>pwrMgr.c<\/code>\u00a0PwrMgr_StateTranstion function comparing requested state against current state<\/li>\n\n\n\n<li>State transition handlers in\u00a0<code>pwrMgr.c<\/code>\u00a0PwrMgr_StateTranstion switch statement executing platform-specific transitions<\/li>\n\n\n\n<li><strong>Event Processing<\/strong>: Sysevent notification handling in dedicated thread continuously monitoring rdkb-power-transition events<\/li>\n\n\n\n<li>Asynchronous event retrieval using\u00a0<code>sysevent_getnotification()<\/code>\u00a0in blocking mode within infinite loop<\/li>\n\n\n\n<li>Event name matching and value extraction dispatching to PwrMgr_StateTranstion function<\/li>\n\n\n\n<li>Sysevent daemon availability monitoring with 600 second retry delay on connection failure<\/li>\n\n\n\n<li><strong>Error Handling Strategy<\/strong>: Validates power state transitions preventing invalid or duplicate state change requests<\/li>\n\n\n\n<li>Duplicate state transition requests logged with warning and ignored without script execution<\/li>\n\n\n\n<li>Script execution failure detection through\u00a0<code>v_secure_system()<\/code>\u00a0return code checking<\/li>\n\n\n\n<li>Sysevent connection failure retry logic with maximum 6 attempts and automatic syseventd restart<\/li>\n\n\n\n<li>Thread creation failure detection with error logging and initialization abort<\/li>\n\n\n\n<li><strong>Logging &amp; Debugging<\/strong>: RDK logger integration for standardized log message formatting when\u00a0<code>FEATURE_SUPPORT_RDKLOG<\/code>\u00a0enabled<\/li>\n\n\n\n<li>Debug logging with function name and line number inclusion using\u00a0<code>PWRMGRLOG<\/code>\u00a0macro<\/li>\n\n\n\n<li>Log severity levels INFO WARNING ERROR mapped to CcspTrace functions<\/li>\n\n\n\n<li>Component name LOG.RDK.PWRMGR for log message identification and filtering<\/li>\n\n\n\n<li>Thread naming using pthread_setname_np for process monitoring and debugging<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"PowerManager-KeyConfigurationFiles\">Key Configuration Files<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Configuration File<\/strong><\/td><td><strong>Purpose<\/strong><\/td><td><strong>Override Mechanisms<\/strong><\/td><\/tr><tr><td><code>\/tmp\/.rdkbPowerMgr.pid<\/code><\/td><td>Process ID file preventing duplicate daemon instances<\/td><td>N\/A system managed<\/td><\/tr><tr><td><code>\/etc\/device.properties<\/code><\/td><td>Platform configuration properties used by management script<\/td><td>Platform build configuration<\/td><\/tr><tr><td><code>\/etc\/debug.ini<\/code><\/td><td>RDK logger initialization configuration<\/td><td>Manual configuration file edit<\/td><\/tr><tr><td><code>\/usr\/ccsp\/pwrMgr\/rdkb_power_manager.sh<\/code><\/td><td>Component lifecycle management script<\/td><td>Platform-specific customization<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><a href=\"https:\/\/wiki.rdkcentral.com\/spaces\/DOC\/pages\/476347275\/Power-Manager\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The RDKB Power Manager is a lightweight system service responsible for managing power state transitions [&hellip;]<\/p>\n","protected":false},"author":659,"featured_media":0,"parent":9575,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-12902","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Power-Manager - RDK Documentation Portal | Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Power-Manager - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"The RDKB Power Manager is a lightweight system service responsible for managing power state transitions [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/\" \/>\n<meta property=\"og:site_name\" content=\"RDK Documentation Portal | Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-07T10:13:52+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/\",\"name\":\"Power-Manager - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2026-05-07T10:09:40+00:00\",\"dateModified\":\"2026-05-07T10:13:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RDK Broadband\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Components\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Power-Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/\",\"name\":\"RDK Documentation Portal | Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Power-Manager - RDK Documentation Portal | Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/","og_locale":"en_US","og_type":"article","og_title":"Power-Manager - RDK Documentation Portal | Documentation","og_description":"The RDKB Power Manager is a lightweight system service responsible for managing power state transitions [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/","og_site_name":"RDK Documentation Portal | Documentation","article_modified_time":"2026-05-07T10:13:52+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/","name":"Power-Manager - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2026-05-07T10:09:40+00:00","dateModified":"2026-05-07T10:13:52+00:00","breadcrumb":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/power-manager\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":3,"name":"RDK Broadband","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/"},{"@type":"ListItem","position":4,"name":"Components","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_broadband_documentation\/components\/"},{"@type":"ListItem","position":5,"name":"Power-Manager"}]},{"@type":"WebSite","@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website","url":"https:\/\/developer.rdkcentral.com\/documentation\/","name":"RDK Documentation Portal | Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/12902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/users\/659"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/comments?post=12902"}],"version-history":[{"count":1,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/12902\/revisions"}],"predecessor-version":[{"id":12903,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/12902\/revisions\/12903"}],"up":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9575"}],"wp:attachment":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/media?parent=12902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}