-
Notifications
You must be signed in to change notification settings - Fork 3
RDKEMW-9474: ctrlm multiple IRDB support #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c81185a
d16c326
9a6021f
2e55a74
01b4194
c501665
cb80e15
8af9588
0bc040e
276997a
828ec71
698a628
5203d2a
6e44de3
082ba2e
9d9e20f
aa022d8
f4f47b9
9989267
a055a7a
f583c46
79ec2a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
egalla204 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| 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.", | ||
|
||
| ieee_address_get().to_string().c_str(), vendor_support_bitmask); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -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; | ||
|
|
@@ -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); | ||
|
|
@@ -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
|
||
| return ret; | ||
| } | ||
|
|
||
|
|
@@ -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) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.