Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c81185a
preliminary interface changes
egalla204 Oct 24, 2025
d16c326
add set preferred vendor
egalla204 Oct 30, 2025
9a6021f
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
2e55a74
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
01b4194
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
c501665
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
cb80e15
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
8af9588
Apply suggestion from @Copilot
egalla204 Oct 30, 2025
0bc040e
fix error handling
egalla204 Oct 30, 2025
276997a
fix error
egalla204 Oct 30, 2025
828ec71
rebase (#138)
egalla204 Oct 31, 2025
698a628
Merge branch 'develop' into feature/RDKEMW-9474_multiple_IRDBs
egalla204 Oct 31, 2025
5203d2a
fix warning
egalla204 Dec 2, 2025
6e44de3
Merge branch 'feature/RDKEMW-9474_multiple_IRDBs' of https://github.c…
egalla204 Dec 2, 2025
082ba2e
apply copilot suggestion
egalla204 Dec 2, 2025
9d9e20f
Merge tag '1.1.6' into feature/RDKEMW-9474_multiple_IRDBs-FIXED
egalla204 Dec 5, 2025
aa022d8
Apply suggestion from @Copilot
egalla204 Dec 5, 2025
f4f47b9
fix comment
egalla204 Dec 5, 2025
9989267
Merge remote-tracking branch 'refs/remotes/origin/feature/RDKEMW-9474…
egalla204 Dec 5, 2025
a055a7a
Merge tag '1.1.7' into feature/RDKEMW-9474_multiple_IRDBs-FIXED
egalla204 Dec 12, 2025
f583c46
Merge tag '1.1.8' into feature/RDKEMW-9474_multiple_IRDBs-FIXED
egalla204 Jan 14, 2026
79ec2a1
reset preferred IRDB to default for remotes that don't have IR suppor…
egalla204 Jan 15, 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
29 changes: 23 additions & 6 deletions src/ble/ctrlm_ble_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,30 @@ void ctrlm_obj_controller_ble_t::setSupportedIrdbs(uint8_t vendor_support_bitmas
this->irdbs_supported_ = vendor_support_bitmask;

ctrlm_irdb_interface_t *irdb = ctrlm_main_irdb_get();
ctrlm_irdb_vendor_info_t vendor_info;
if (irdb && irdb->get_vendor_info(vendor_info)) {
XLOGD_INFO("Controller <%s> IRDBs supported bitmask = <0x%X>, which %s support the loaded IRDB plugin vendor <%s>",
ieee_address_get().to_string().c_str(), vendor_support_bitmask,
isSupportedIrdb(vendor_info) ? "DOES" : "does NOT", vendor_info.name.c_str());

if (irdb == NULL) {
XLOGD_ERROR("IRDB interface is NULL!!!");
return;
}

ctrlm_irdb_vendor_info_t rcu_vendor_info{};
rcu_vendor_info.rcu_support_bitmask = vendor_support_bitmask;
if (!irdb->set_vendor(rcu_vendor_info)) {
XLOGD_ERROR("Failed to set IRDB vendor info for controller <%s> with bitmask <0x%X>.",
ieee_address_get().to_string().c_str(), vendor_support_bitmask);
}

ctrlm_irdb_vendor_info_t vendor_info{};
if (irdb->get_vendor_info(vendor_info)) {
if (isSupportedIrdb(vendor_info)) {
XLOGD_INFO("Controller <%s> IRDBs supported bitmask = <0x%X>, which DOES support the loaded IRDB plugin vendor <%s>",
ieee_address_get().to_string().c_str(), vendor_support_bitmask, vendor_info.name.c_str());
} else {
XLOGD_ERROR("Controller <%s> IRDBs supported bitmask = <0x%X>, which does NOT support the loaded IRDB plugin vendor <%s>",
ieee_address_get().to_string().c_str(), vendor_support_bitmask, vendor_info.name.c_str());
}
} else {
XLOGD_INFO("Controller <%s> IRDBs supported bitmask = <0x%X>, couldn't retrieve IRDB plugin vendor info.",
XLOGD_WARN("Controller <%s> IRDBs supported bitmask = <0x%X>, couldn't retrieve IRDB plugin vendor info.",
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The log level change from XLOGD_INFO to XLOGD_WARN is appropriate for this error condition, but consider whether the earlier successful case at line 549 should remain at INFO level or be changed to DEBUG, since it's called every time setSupportedIrdbs() is invoked and may generate excessive logs during normal operation.

Copilot uses AI. Check for mistakes.
ieee_address_get().to_string().c_str(), vendor_support_bitmask);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ void GattInfraredService::requestIrSupport()
// sanity check we actually have a ir support characteristic
if (!m_irSupportCharacteristic || !m_irSupportCharacteristic->isValid()) {
XLOGD_WARN("missing ir support characteristic");

// Set ir support back to invalid value and notify
m_irSupport = 0;
m_irSupportChangedSlots.invoke(m_irSupport);

return;
}

Expand All @@ -434,8 +439,9 @@ void GattInfraredService::requestIrSupport()
XLOGD_ERROR("failed to get initial ir support code due to <%s>",
reply->errorMessage().c_str());

// Set ir support back to invalid value and notify
m_irSupport = 0;

m_irSupportChangedSlots.invoke(m_irSupport);
} else {

std::vector<uint8_t> value;
Expand Down
37 changes: 37 additions & 0 deletions src/irdb/ctrlm_irdb_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ typedef struct {
std::string (*pluginVersion)() = NULL;
bool (*pluginInitialize)() = NULL;
bool (*pluginGetVendorInfo)(ctrlm_irdb_vendor_info_t &info) = NULL;
bool (*pluginGetSupportedVendors)(std::vector<ctrlm_irdb_vendor_info_t> &info) = NULL;
bool (*pluginSetPreferredVendor)(const ctrlm_irdb_vendor_info_t &vendor) = NULL;
bool (*pluginGetManufacturers)(ctrlm_irdb_manufacturer_list_t &manufacturers, ctrlm_irdb_dev_type_t type, const std::string &prefix) = NULL;
bool (*pluginGetModels)(ctrlm_irdb_model_list_t &models, ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &prefix) = NULL;
bool (*pluginGetEntryIds)(ctrlm_irdb_entry_id_list_t &codes, ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &model) = NULL;
Expand Down Expand Up @@ -132,6 +134,8 @@ ctrlm_irdb_interface_t::ctrlm_irdb_interface_t(bool platform_tv) {
g_irdb.pluginVersion = STUB_irdb_version;
g_irdb.pluginInitialize = STUB_ctrlm_irdb_initialize;
g_irdb.pluginGetVendorInfo = STUB_ctrlm_irdb_get_vendor_info;
g_irdb.pluginSetPreferredVendor = STUB_ctrlm_irdb_set_preferred_vendor;
g_irdb.pluginGetSupportedVendors = STUB_ctrlm_irdb_get_supported_vendor_info;
g_irdb.pluginGetManufacturers = STUB_ctrlm_irdb_get_manufacturers;
g_irdb.pluginGetModels = STUB_ctrlm_irdb_get_models;
g_irdb.pluginGetEntryIds = STUB_ctrlm_irdb_get_entry_ids;
Expand Down Expand Up @@ -182,6 +186,20 @@ ctrlm_irdb_interface_t::ctrlm_irdb_interface_t(bool platform_tv) {
}
dlerror(); // Clear any existing error

*(void **) (&g_irdb.pluginGetSupportedVendors) = dlsym(m_irdbPluginHandle, "ctrlm_irdb_get_supported_vendor_info");
if ((error = dlerror()) != NULL) {
XLOGD_ERROR("Failed to find plugin method (ctrlm_irdb_get_supported_vendor_info), error <%s>, Using STUB implementation", error);
g_irdb.pluginGetSupportedVendors = STUB_ctrlm_irdb_get_supported_vendor_info;
}
dlerror(); // Clear any existing error

*(void **) (&g_irdb.pluginSetPreferredVendor) = dlsym(m_irdbPluginHandle, "ctrlm_irdb_set_preferred_vendor");
if ((error = dlerror()) != NULL) {
XLOGD_ERROR("Failed to find plugin method (ctrlm_irdb_set_preferred_vendor), error <%s>, Using STUB implementation", error);
g_irdb.pluginSetPreferredVendor = STUB_ctrlm_irdb_set_preferred_vendor;
}
dlerror(); // Clear any existing error

*(void **) (&g_irdb.pluginGetManufacturers) = dlsym(m_irdbPluginHandle, "ctrlm_irdb_get_manufacturers");
if ((error = dlerror()) != NULL) {
XLOGD_ERROR("Failed to find plugin method (ctrlm_irdb_get_manufacturers), error <%s>, Using STUB implementation", error);
Expand Down Expand Up @@ -278,6 +296,17 @@ bool ctrlm_irdb_interface_t::open_plugin() {
}
}
XLOGD_INFO("IRDB plugin opened, ret = <%s>", ret ? "SUCCESS" : "ERROR");

if (g_irdb.pluginGetSupportedVendors) {
std::vector<ctrlm_irdb_vendor_info_t> supported_vendors;
if ((*g_irdb.pluginGetSupportedVendors)(supported_vendors) == true) {
for (const auto &it : supported_vendors) {
XLOGD_INFO("Found supported IRDB Vendor <%s, 0x%X>", it.name.c_str(), it.rcu_support_bitmask);
}
} else {
XLOGD_WARN("Unable to query IRDB plugin for list of supported vendors, check version of the plugin...");
}
}
Comment on lines +300 to +309
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

This informational logging is placed in the critical path of open_plugin() which is called during initialization. If a plugin supports many vendors, this could generate numerous log entries. Consider whether this should be at DEBUG level or only log a summary (e.g., 'Found N supported IRDB vendors').

Copilot uses AI. Check for mistakes.
return ret;
}

Expand All @@ -299,6 +328,14 @@ bool ctrlm_irdb_interface_t::get_vendor_info(ctrlm_irdb_vendor_info_t &info) {
return false;
}

bool ctrlm_irdb_interface_t::set_vendor(const ctrlm_irdb_vendor_info_t &info) {
std::unique_lock<std::mutex> guard(m_mutex);
if (g_irdb.pluginSetPreferredVendor) {
return (*g_irdb.pluginSetPreferredVendor)(info);
}
return false;
}

void ctrlm_irdb_interface_t::on_thunder_ready() {
#if defined(CTRLM_THUNDER)

Expand Down
1 change: 1 addition & 0 deletions src/irdb/ctrlm_irdb_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ctrlm_irdb_interface_t {
virtual ~ctrlm_irdb_interface_t();

bool get_vendor_info(ctrlm_irdb_vendor_info_t &info);
bool set_vendor(const ctrlm_irdb_vendor_info_t &info);
bool get_manufacturers(ctrlm_irdb_manufacturer_list_t &manufacturers, ctrlm_irdb_dev_type_t type, const std::string &prefix = "");
bool get_models(ctrlm_irdb_model_list_t &models, ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &prefix = "");
bool get_irdb_entry_ids(ctrlm_irdb_entry_id_list_t &codes, ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &model = "");
Expand Down
6 changes: 6 additions & 0 deletions src/irdb/ctrlm_irdb_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ bool ctrlm_irdb_close();

bool ctrlm_irdb_initialize();

// Will return info on all the IRDB vendors currently installed, could be multiple vendors returned
bool ctrlm_irdb_get_supported_vendor_info(std::vector<ctrlm_irdb_vendor_info_t> &info);

// Tell the IRDB plugin which vendor(s) the RCU supports
bool ctrlm_irdb_set_preferred_vendor(const ctrlm_irdb_vendor_info_t &vendor);

bool ctrlm_irdb_get_vendor_info(ctrlm_irdb_vendor_info_t &info);

bool ctrlm_irdb_get_manufacturers(ctrlm_irdb_manufacturer_list_t &manufacturers, ctrlm_irdb_dev_type_t type, const std::string &prefix);
Expand Down
10 changes: 10 additions & 0 deletions src/irdb/ctrlm_irdb_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ bool STUB_ctrlm_irdb_get_vendor_info(ctrlm_irdb_vendor_info_t &info)
XLOGD_ERROR("not implemented");
return(false);
}
bool STUB_ctrlm_irdb_get_supported_vendor_info(std::vector<ctrlm_irdb_vendor_info_t> &info)
{
XLOGD_ERROR("not implemented");
return(false);
}
bool STUB_ctrlm_irdb_set_preferred_vendor(const ctrlm_irdb_vendor_info_t &info)
{
XLOGD_ERROR("not implemented");
return(false);
}
bool STUB_ctrlm_irdb_get_manufacturers(ctrlm_irdb_manufacturer_list_t &manufacturers, ctrlm_irdb_dev_type_t type, const std::string &prefix)
{
XLOGD_ERROR("not implemented");
Expand Down
4 changes: 4 additions & 0 deletions src/irdb/ctrlm_irdb_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ bool STUB_ctrlm_irdb_initialize();

bool STUB_ctrlm_irdb_get_vendor_info(ctrlm_irdb_vendor_info_t &info);

bool STUB_ctrlm_irdb_get_supported_vendor_info(std::vector<ctrlm_irdb_vendor_info_t> &info);

bool STUB_ctrlm_irdb_set_preferred_vendor(const ctrlm_irdb_vendor_info_t &info);

bool STUB_ctrlm_irdb_get_manufacturers(ctrlm_irdb_manufacturer_list_t &manufacturers, ctrlm_irdb_dev_type_t type, const std::string &prefix);

bool STUB_ctrlm_irdb_get_models(ctrlm_irdb_model_list_t &models, ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &prefix);
Expand Down