Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3324427
RDKEMW-9659 Implement DeviceSettings client library for FPD in rpc/cli
Jan 27, 2026
b6e760c
Modified the dsFPD-com.cpp code based on latest DeviceSettings plugin…
Jan 30, 2026
fdc4105
Modified the rpc/cliMakefile with conditionally exclude dsFPD.c when …
Feb 2, 2026
034e5db
Added export USE_WPE_THUNDER_PLUGIN=y in cov_build.sh
Feb 4, 2026
3ed996d
Added the DSCliLibStandaloneApp.cpp file for validate the FPD
Feb 6, 2026
d731afd
Install DSApp standalone app into /usr/bin folder
Feb 9, 2026
b18f613
Install the DSApp in install/bin path
Feb 9, 2026
e6d435d
Resolved compilation error
Feb 9, 2026
9c65c2d
Commentout libds.so initialization
Feb 9, 2026
ddf5841
Commentout libds common init
Feb 9, 2026
6a2a905
Modified the dsFPD-com.cpp thunder client code based on latest Master
Feb 13, 2026
10c5f29
Added debug prints in dsFPD-com.cpp for FPInit failure
Feb 16, 2026
51180b6
Added debug prints in GetBrightness and SetBrightness APIs
Feb 16, 2026
a816846
Added debug prints to print the Error code
Feb 17, 2026
53aa9f4
Added dsController-com.cpp and dsController-com.h file
Feb 18, 2026
6b55778
Resolved compilation error
Feb 18, 2026
32bd65d
Modified the flag USE_THUNDER_PLUGIN
Feb 19, 2026
4b4c3e7
Modified the USE_THUNDER_PLUGIN flag in manager.cpp and
Feb 19, 2026
cc261ad
Removed USE_THUNDER_PLUGIN flag from dsFPD-com.cpp file
Feb 19, 2026
673c305
Resolved linker error
Feb 19, 2026
8ae412d
Added the USE_THUNDER_PLUGIN flag in dsFPD-com.cpp file
Feb 19, 2026
6201448
Modified the Makefile for linker error
Feb 19, 2026
b928216
Modified the devicesettings module changes as compiled successfully in
Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ package_ipk:
rm -rf $(IPK_GEN_PATH)/data.tar.gz
rm -rf $(IPK_GEN_PATH)/control.tar.gz
rm -rf $(IPK_GEN_STAGING_DIR)

# DSApp - Device Settings Test Application
.PHONY: dsapp dsapp-clean

dsapp:
@echo "Building DSApp..."
$(MAKE) -C sample dsapp
@echo "DSApp executable: $(abs_top_builddir)/DSApp"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target prints DSApp executable: $(abs_top_builddir)/DSApp, but the underlying sample/Makefile currently builds DSApp to ../DSApp relative to sample/, which won’t match $(abs_top_builddir) in out-of-tree builds. Align the build output path and the reported path (ideally output into $(abs_top_builddir)/$(top_builddir)).

Suggested change
@echo "DSApp executable: $(abs_top_builddir)/DSApp"
@echo "DSApp executable: $(top_builddir)/DSApp"

Copilot uses AI. Check for mistakes.

dsapp-clean:
@echo "Cleaning DSApp..."
$(MAKE) -C sample dsapp-clean
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ PKG_CHECK_MODULES([DBUS], [dbus-1])

AC_CHECK_LIB(gthread-2.0, g_thread_init)

# Thunder COM-RPC plugin support
AC_ARG_ENABLE([thunder-plugin],
AS_HELP_STRING([--enable-thunder-plugin], [Enable Thunder COM-RPC plugin support (default: no)]),
[enable_thunder_plugin=$enableval],
[enable_thunder_plugin=no])

AM_CONDITIONAL([USE_WPE_THUNDER_PLUGIN], [test "x$enable_thunder_plugin" = "xyes"])

AS_IF([test "x$enable_thunder_plugin" = "xyes"],
[AC_DEFINE([USE_WPE_THUNDER_PLUGIN], [1], [Define to 1 to enable Thunder COM-RPC plugin support])
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AC_DEFINE([USE_WPE_THUNDER_PLUGIN], ...) places the macro in cfg/config.h, but none of the rpc/cli sources include that header, and the Makefiles don’t -include it either (verified by searching for config.h). As a result, --enable-thunder-plugin may not actually enable the #ifdef USE_WPE_THUNDER_PLUGIN code. Ensure cfg/config.h is included in compilation (e.g., add -include $(top_builddir)/cfg/config.h or explicitly add -DUSE_WPE_THUNDER_PLUGIN when the option is enabled).

Suggested change
[AC_DEFINE([USE_WPE_THUNDER_PLUGIN], [1], [Define to 1 to enable Thunder COM-RPC plugin support])
[AC_DEFINE([USE_WPE_THUNDER_PLUGIN], [1], [Define to 1 to enable Thunder COM-RPC plugin support])
CPPFLAGS="$CPPFLAGS -DUSE_WPE_THUNDER_PLUGIN"

Copilot uses AI. Check for mistakes.
AC_MSG_NOTICE([Thunder COM-RPC plugin support enabled])],
Comment on lines +62 to +63
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--enable-thunder-plugin toggles compilation/linking against WPEFramework (Core/COM), but configure.ac does not validate that the required headers and libraries are present (no PKG_CHECK_MODULES / AC_CHECK_HEADERS / AC_CHECK_LIB for Thunder). Enabling this option will likely fail later during compilation/linking with a less actionable error. Add explicit checks and surface a clear configure-time failure or disable the option when dependencies are missing.

Suggested change
[AC_DEFINE([USE_WPE_THUNDER_PLUGIN], [1], [Define to 1 to enable Thunder COM-RPC plugin support])
AC_MSG_NOTICE([Thunder COM-RPC plugin support enabled])],
[PKG_CHECK_MODULES([THUNDER], [WPEFrameworkCore WPEFrameworkCOM],
[AC_DEFINE([USE_WPE_THUNDER_PLUGIN], [1], [Define to 1 to enable Thunder COM-RPC plugin support])
AC_MSG_NOTICE([Thunder COM-RPC plugin support enabled])],
[AC_MSG_ERROR([Thunder COM-RPC plugin support requested, but WPEFramework Core/COM (pkg-config modules WPEFrameworkCore and WPEFrameworkCOM) were not found. Install the appropriate development packages or re-run configure without --enable-thunder-plugin.])])],

Copilot uses AI. Check for mistakes.
[AC_MSG_NOTICE([Thunder COM-RPC plugin support disabled])])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_TYPE_SIZE_T
Expand Down
4 changes: 3 additions & 1 deletion cov_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ cd ${RDK_SOURCE_PATH}
export STANDALONE_BUILD_ENABLED=y
export DS_MGRS=$WORKDIR

export USE_WPE_THUNDER_PLUGIN=y
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script enables USE_WPE_THUNDER_PLUGIN, which changes rpc/cli/Makefile to link against -lWPEFrameworkCore -lWPEFrameworkCOM, but the script doesn’t build/install stubs for those libraries (it only stubs libWPEFrameworkPowerController.so). Unless those libs are guaranteed to exist in the build environment, this will break the Coverity build. Either keep Thunder disabled here by default or add the required dependency setup for the Thunder libraries.

Suggested change
export USE_WPE_THUNDER_PLUGIN=y
# Thunder/WPEFramework plugin is disabled by default for Coverity builds to
# avoid introducing unresolved link-time dependencies on WPEFrameworkCore/COM.
# It can still be enabled explicitly by exporting USE_WPE_THUNDER_PLUGIN=y
# before invoking this script, in environments where the libraries are present.
export USE_WPE_THUNDER_PLUGIN=${USE_WPE_THUNDER_PLUGIN-n}

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error in comment. "Devicesttings" should be "DeviceSettings" (missing 'e' and has extra 't').

Copilot uses AI. Check for mistakes.

find $WORKDIR -iname "*.o" -exec rm -v {} \;
find $WORKDIR -iname "*.so*" -exec rm -v {} \;

echo "##### Triggering make"
make CFLAGS+='-fPIC -DDSMGR_LOGGER_ENABLED=ON -DRDK_DSHAL_NAME=\"libdshal.so\" -I${DS_IF_PATH}/include -I${DS_HAL_PATH} -I${DS_MGRS}/stubs -I${IARMBUS_PATH}/core -I${IARMBUS_PATH}/core/include -I${IARM_MGRS}/sysmgr/include -I${DS_MGRS}/ds/include -I${DS_MGRS}/rpc/include -I${POWER_IF_PATH}/include/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I${IARM_MGRS}/mfr/include/ -I${IARM_MGRS}/mfr/common -I${DEEPSLEEP_IF_PATH}/include -I${IARM_MGRS}/hal/include -I${IARM_MGRS}/power -I${IARM_MGRS}/power/include' LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -L/usr/local/include -lglib-2.0 -lIARMBus -lWPEFrameworkPowerController -ldshal"
make CFLAGS+='-fPIC -DDSMGR_LOGGER_ENABLED=ON -DRDK_DSHAL_NAME=\"libdshal.so\" -I${DS_IF_PATH}/include -I${DS_HAL_PATH} -I${DS_MGRS}/stubs -I${IARMBUS_PATH}/core -I${IARMBUS_PATH}/core/include -I${IARM_MGRS}/sysmgr/include -I${DS_MGRS}/ds/include -I${DS_MGRS}/rpc/include -I${POWER_IF_PATH}/include/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I${IARM_MGRS}/mfr/include/ -I${IARM_MGRS}/mfr/common -I${DEEPSLEEP_IF_PATH}/include -I${IARM_MGRS}/hal/include -I${IARM_MGRS}/power -I${IARM_MGRS}/power/include' LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -L/usr/local/include -lglib-2.0 -lIARMBus -lWPEFrameworkPowerController -ldshal"
Comment on lines 66 to 75
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script exports USE_WPE_THUNDER_PLUGIN=y, which will switch builds into Thunder mode, but the script only builds/installs stubs for libIARMBus.so and libWPEFrameworkPowerController.so (not libWPEFrameworkCore/libWPEFrameworkCOM) and doesn’t provide the corresponding headers. This is likely to break the Coverity build in environments without real Thunder libraries. Consider gating this export behind an environment check, or add the needed stubs/deps when enabling Thunder mode here.

Copilot uses AI. Check for mistakes.
4 changes: 2 additions & 2 deletions ds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ all: install

library: $(OBJS)
@echo "Building $(LIBNAMEFULL) ...."
$(CXX) $(OBJS) $(CFLAGS) $(DSHAL_LDFLAGS) -L$(INSTALL)/lib -lIARMBus -ldshalcli -shared -o $(LIBNAMEFULL)
$(CXX) $(OBJS) $(CFLAGS) -L$(INSTALL)/lib -lIARMBus -ldshalcli -shared -o $(LIBNAMECLI)
$(CXX) $(OBJS) $(CFLAGS) $(DSHAL_LDFLAGS) -L$(INSTALL)/lib -lIARMBus -Wl,--no-as-needed -ldshalcli -Wl,--as-needed -shared -o $(LIBNAMEFULL)
$(CXX) $(OBJS) $(CFLAGS) -L$(INSTALL)/lib -lIARMBus -Wl,--no-as-needed -ldshalcli -Wl,--as-needed -shared -o $(LIBNAMECLI)

%.o: %.cpp
@echo "Building $@ ...."
Expand Down
2 changes: 2 additions & 0 deletions ds/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ libds_la_SOURCES = aspectRatio.cpp \
host.cpp \
manager.cpp \
videoDFC.cpp

libds_la_LIBADD = ../rpc/cli/libdshalcli.la
261 changes: 261 additions & 0 deletions ds/include/dsController-com.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the

Check failure on line 2 in ds/include/dsController-com.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'GPL-2.0' license found in local file 'ds/include/dsController-com.h' (Match: gnuton/asuswrt-merlin.ng/3006.102.1-beta1, 15 lines, url: https://github.com/gnuton/asuswrt-merlin.ng/archive/refs/tags/3006.102.1-beta1.tar.gz, file: release/src-rt-5.04behnd.4916/userspace/public/include/wifi_hal.h)
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file DeviceSettingsController.h
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same documentation error in duplicate file: Line 21 states "@file DeviceSettingsController.h" but the actual filename is "dsController-com.h". This is the same issue as in rpc/cli/dsController-com.h, confirming these are duplicate files with the same documentation error.

Suggested change
* @file DeviceSettingsController.h
* @file dsController-com.h

Copilot uses AI. Check for mistakes.
* @brief Central controller for all DeviceSettings COM-RPC connections
*
* This controller manages a single RPC connection to the Thunder DeviceSettings plugin
* and provides access to all component interfaces (FPD, HDMIIn, Audio, etc.) through
* QueryInterface on the main IDeviceSettings interface.
*/

#pragma once

#ifdef USE_WPE_THUNDER_PLUGIN

#ifndef MODULE_NAME
#define MODULE_NAME DeviceSettings_Client
#endif

#include <core/core.h>
#include <com/com.h>
#include <plugins/Types.h>
#include <interfaces/IDeviceSettings.h>
#include <interfaces/IDeviceSettingsFPD.h>
#include <interfaces/IDeviceSettingsHDMIIn.h>
#include <interfaces/IDeviceSettingsAudio.h>
#include <interfaces/IDeviceSettingsDisplay.h>
#include <interfaces/IDeviceSettingsVideoPort.h>
#include <interfaces/IDeviceSettingsVideoDevice.h>
#include <interfaces/IDeviceSettingsHost.h>
#include <interfaces/IDeviceSettingsCompositeIn.h>

namespace WPEFramework {

/**
* @brief Component types supported by DeviceSettings
*/
enum class DeviceSettingsComponent : uint8_t {
FPD,
HDMIIn,
Audio,
Display,
VideoPort,
VideoDevice,
Host,
CompositeIn
};

/**
* @class DeviceSettingsController
* @brief Singleton controller managing all DeviceSettings component interfaces
*
* This class provides:
* - Single RPC connection to Thunder DeviceSettings plugin
* - Thread-safe access to all component interfaces
* - Automatic lifecycle management
* - Connection status monitoring
* - Reconnection support
*/
class DeviceSettingsController : public RPC::SmartInterfaceType<Exchange::IDeviceSettings> {
private:
using BaseClass = RPC::SmartInterfaceType<Exchange::IDeviceSettings>;

// Main interface
Exchange::IDeviceSettings* _deviceSettings;

// Component interfaces obtained via QueryInterface
Exchange::IDeviceSettingsFPD* _fpdInterface;
Exchange::IDeviceSettingsHDMIIn* _hdmiInInterface;
Exchange::IDeviceSettingsAudio* _audioInterface;
Exchange::IDeviceSettingsDisplay* _displayInterface;
Exchange::IDeviceSettingsVideoPort* _videoPortInterface;
Exchange::IDeviceSettingsVideoDevice* _videoDeviceInterface;
Exchange::IDeviceSettingsHost* _hostInterface;
Exchange::IDeviceSettingsCompositeIn* _compositeInInterface;

// Singleton instance
static DeviceSettingsController* _instance;
static Core::CriticalSection _lock;

// Connection state
bool _connected;
bool _shutdown;

// Thunder callsign
static constexpr const TCHAR _callSign[] = _T("org.rdk.DeviceSettings");

// Connection retry thread management
static pthread_t _connectionThreadID;
static std::atomic<bool> _isConnecting;
static uint32_t _connectionRetryCount;

#define DS_CONTROLLER_CONNECT_WAIT_TIME_MS 300000 // 300ms in microseconds
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect units in comment. The comment states "300ms in microseconds" but the value 300000 is actually 300 milliseconds when used with usleep() which expects microseconds. The comment should say "300ms converted to microseconds (300000 µs)" or simply "300000 microseconds (300ms)" to avoid confusion.

Suggested change
#define DS_CONTROLLER_CONNECT_WAIT_TIME_MS 300000 // 300ms in microseconds
#define DS_CONTROLLER_CONNECT_WAIT_TIME_MS 300000 // 300ms converted to microseconds (300000 µs)

Copilot uses AI. Check for mistakes.

// Helper methods
static void EstablishThunderConnection();
static void* RetryThunderConnectionThread(void* arg);
static void FetchAndInitializeInterfaces();

/**
* @brief Private constructor for singleton pattern
*/
DeviceSettingsController();

/**
* @brief Private destructor
*/
~DeviceSettingsController();

/**
* @brief Operational callback from SmartInterfaceType
* @param upAndRunning true if plugin is operational, false otherwise
*/
virtual void Operational(const bool upAndRunning) override;

/**
* @brief Check if connected (without lock)
*/
inline bool isConnected() const { return _connected; }

/**
* @brief Query and cache a component interface
* @tparam T Component interface type
* @param interfacePtr Reference to cached interface pointer
* @param componentName Name for logging
* @return true if interface obtained successfully
*/
template<typename T>
bool QueryComponentInterface(T*& interfacePtr, const char* componentName);

public:
// Delete copy constructor and assignment operator
DeviceSettingsController(const DeviceSettingsController&) = delete;
DeviceSettingsController& operator=(const DeviceSettingsController&) = delete;

/**
* @brief Get singleton instance
* @return Pointer to singleton instance
*/
static DeviceSettingsController* GetInstance();

/**
* @brief Initialize the controller
* @return Core::ERROR_NONE on success, error code otherwise
*/
static uint32_t Initialize();

/**
* @brief Terminate the controller and release all resources
*/
static void Terminate();

/**
* @brief Connect to Thunder DeviceSettings plugin
* @return Core::ERROR_NONE on success, error code otherwise
*/
uint32_t Connect();

/**
* @brief Disconnect from Thunder DeviceSettings plugin
* @return Core::ERROR_NONE on success, error code otherwise
*/
uint32_t Disconnect();

/**
* @brief Check if the main interface is operational
* @return true if operational, false otherwise
*/
bool IsOperational() const;

/**
* @brief Check if a specific component interface is available
* @param component Component type to check
* @return true if available, false otherwise
*/
bool IsComponentAvailable(DeviceSettingsComponent component) const;

/**
* @brief Wait for the main interface to become operational
* @param timeoutMs Timeout in milliseconds
* @return true if operational within timeout, false otherwise
*/
bool WaitForOperational(uint32_t timeoutMs = 5000) const;

/**
* @brief Wait for a specific component to become available
* @param component Component type to wait for
* @param timeoutMs Timeout in milliseconds
* @return true if available within timeout, false otherwise
*/
bool WaitForComponent(DeviceSettingsComponent component, uint32_t timeoutMs = 5000) const;

/**
* @brief Get FPD component interface
* @return Pointer to IDeviceSettingsFPD interface or nullptr
*/
Exchange::IDeviceSettingsFPD* GetFPDInterface();

/**
* @brief Get HDMIIn component interface
* @return Pointer to IDeviceSettingsHDMIIn interface or nullptr
*/
Exchange::IDeviceSettingsHDMIIn* GetHDMIInInterface();

/**
* @brief Get Audio component interface
* @return Pointer to IDeviceSettingsAudio interface or nullptr
*/
Exchange::IDeviceSettingsAudio* GetAudioInterface();

/**
* @brief Get Display component interface
* @return Pointer to IDeviceSettingsDisplay interface or nullptr
*/
Exchange::IDeviceSettingsDisplay* GetDisplayInterface();

/**
* @brief Get VideoPort component interface
* @return Pointer to IDeviceSettingsVideoPort interface or nullptr
*/
Exchange::IDeviceSettingsVideoPort* GetVideoPortInterface();

/**
* @brief Get VideoDevice component interface
* @return Pointer to IDeviceSettingsVideoDevice interface or nullptr
*/
Exchange::IDeviceSettingsVideoDevice* GetVideoDeviceInterface();

/**
* @brief Get Host component interface
* @return Pointer to IDeviceSettingsHost interface or nullptr
*/
Exchange::IDeviceSettingsHost* GetHostInterface();

/**
* @brief Get CompositeIn component interface
* @return Pointer to IDeviceSettingsCompositeIn interface or nullptr
*/
Exchange::IDeviceSettingsCompositeIn* GetCompositeInInterface();
};

} // namespace WPEFramework

#endif // USE_WPE_THUNDER_PLUGIN
13 changes: 13 additions & 0 deletions ds/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
#include <unistd.h>
#include <functional>

#ifdef USE_WPE_THUNDER_PLUGIN
#include "dsController-com.h"
#endif

/**
* @file manager.cpp
* @brief RDK Device Settings module is a cross-platform device for controlling the following hardware configurations:
Expand Down Expand Up @@ -156,6 +160,15 @@ void Manager::Initialize()
if (needInit) {
dsError_t err = dsERR_GENERAL;

#ifdef USE_WPE_THUNDER_PLUGIN
// For Thunder COM-RPC mode, initialize the DeviceSettingsController
if (WPEFramework::DeviceSettingsController::Initialize() != WPEFramework::Core::ERROR_NONE) {
fprintf(stderr, "[Manager] Failed to initialize DeviceSettingsController\n");
throw std::runtime_error("DeviceSettingsController initialization failed");
}
printf("[Manager] DeviceSettingsController initialized successfully\n");
#endif

err = initializeFunctionWithRetry("dsDisplayInit", dsDisplayInit);
CHECK_RET_VAL(err);

Expand Down
24 changes: 21 additions & 3 deletions rpc/cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@ CFLAGS += -g -fPIC -D_REENTRANT -Wall
LIBNAME := dshalcli
LIBNAMEFULL := lib$(LIBNAME).so
INSTALL := $(PWD)/install
OBJS := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
OBJS += $(patsubst %.c,%.o,$(wildcard *.c))

# Conditional compilation: Thunder vs IARM
ifdef USE_WPE_THUNDER_PLUGIN
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build inconsistency between autotools and plain Makefile. The rpc/cli/Makefile.am uses the variable USE_THUNDER_PLUGIN (line 33), while rpc/cli/Makefile uses USE_WPE_THUNDER_PLUGIN (line 26). This inconsistency means that the two build systems will have different conditional compilation behavior. Use the same variable name in both build systems, or ensure proper translation between them.

Copilot uses AI. Check for mistakes.
# Thunder mode - use dsFPD-com.cpp and dsController-com.cpp, exclude dsFPD.c
OBJS := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
OBJS += $(patsubst %.c,%.o,$(filter-out dsFPD.c,$(wildcard *.c)))
else
# IARM mode - use dsFPD.c, exclude both dsFPD-com.cpp and dsController-com.cpp
OBJS := $(patsubst %.cpp,%.o,$(filter-out dsFPD-com.cpp dsController-com.cpp,$(wildcard *.cpp)))
OBJS += $(patsubst %.c,%.o,$(wildcard *.c))
endif
Comment on lines 25 to 34
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Makefile switches object selection based on the make variable USE_WPE_THUNDER_PLUGIN, but it never defines the C/C++ preprocessor macro USE_WPE_THUNDER_PLUGIN. Since dsFPD-com.cpp is guarded by #ifdef USE_WPE_THUNDER_PLUGIN, enabling the make variable will compile an object with no symbols and likely break linking (because dsFPD.c is filtered out). Ensure the macro is passed in compiler flags when Thunder mode is enabled (or remove the #ifdef guard and rely solely on source selection).

Copilot uses AI. Check for mistakes.
Comment on lines 25 to 34
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Makefile ifdef USE_WPE_THUNDER_PLUGIN is used to pick Thunder objects, but it does not add -DUSE_WPE_THUNDER_PLUGIN to the compiler flags. Because dsFPD-com.cpp is wrapped in #ifdef USE_WPE_THUNDER_PLUGIN, compiling it without the macro will omit all implementations and cause link errors. Ensure the macro is passed via CFLAGS/CPPFLAGS in this branch (or remove the source-level guard).

Copilot uses AI. Check for mistakes.

#OBJS := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
#OBJS += $(patsubst %.c,%.o,$(wildcard *.c))
Comment on lines +36 to +37
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commented-out lines should be removed rather than kept in the codebase. The version control system preserves the history, so keeping commented code creates clutter and confusion about what the intended implementation should be.

Suggested change
#OBJS := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
#OBJS += $(patsubst %.c,%.o,$(wildcard *.c))

Copilot uses AI. Check for mistakes.
INCLUDE := -I$(PWD) \
-I$(PWD)/hal/include \
-I$(PWD)/rpc/include
Expand All @@ -31,13 +43,19 @@ INCLUDE += $(HAL_INCLUDE)

CFLAGS += $(INCLUDE)

# Conditional linking flags
ifdef USE_WPE_THUNDER_PLUGIN
LDLIBS := -lWPEFrameworkCore -lWPEFrameworkCOM
else
Comment on lines +48 to +49
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Thunder mode, LDLIBS drops -lIARMBus, but most other rpc/cli sources (e.g., dsAudio.c, dsDisplay.c, dsHost.cpp, dsVideo*.c) still call IARM_Bus_Call and require IARMBus symbols. This will either fail to link or produce a lib with unresolved dependencies. Keep -lIARMBus in Thunder mode as well (and add Thunder libs on top), or conditionally exclude/replace the other IARM-based sources too.

Suggested change
LDLIBS := -lWPEFrameworkCore -lWPEFrameworkCOM
else
# Thunder mode: still need IARMBus symbols plus Thunder libraries
LDLIBS := -lIARMBus -lWPEFrameworkCore -lWPEFrameworkCOM
else
# IARM-only mode

Copilot uses AI. Check for mistakes.
LDLIBS := -lIARMBus
endif
Comment on lines +46 to +51
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Makefile conditionally compiles based on USE_WPE_THUNDER_PLUGIN, but this macro is not added to CFLAGS. The source file dsFPD-com.cpp uses #ifdef USE_WPE_THUNDER_PLUGIN (line 27 in that file) to conditionally compile the Thunder implementation. Without -DUSE_WPE_THUNDER_PLUGIN in CFLAGS, the code in dsFPD-com.cpp will not be compiled even when it's included in the build. Add -DUSE_WPE_THUNDER_PLUGIN to CFLAGS when Thunder mode is enabled.

Copilot uses AI. Check for mistakes.

all: install
@echo "Build Finished...."

library: $(OBJS)
@echo "Building $(LIBNAMEFULL) ...."
$(CXX) $(OBJS) $(CFLAGS) -lIARMBus -shared -o $(LIBNAMEFULL)
$(CXX) $(OBJS) $(CFLAGS) $(LDLIBS) -shared -o $(LIBNAMEFULL)

%.o: %.cpp
@echo "Building $@ ...."
Expand Down
Loading
Loading