mirror of
https://gitlab.com/prpl-foundation/prplmesh/prplMesh.git
synced 2025-12-20 01:21:22 +08:00
bwl: agent: fix amxb_usp events not received
Problem: -------- The agent process is not receiving pwhm events over usp direct socket. Cause: ------ beerocks_agent connects simultaneously to both ubus and usp direct socket. The following initialization sequence exposes several limitations in libamxb and amxb_usp: 1 - Load and connect to ubus 2 - Load usp backend 3 - Set usp configuration 4 - Connect to usp socket In step 1: An internal libamxb configuration is created without a usp section. In step 2: - When loading usp backend the previous configuration (which doesn't include any usp section) is automatically set to amxb_usp. As a "limitation" in amxb_usp, this will result into a NULL amxb_usp configuration (ie config_opts = NULL). - As a consequence no EndPointID (needed later by usp LocalAgent to created imtp handshake) can be created and later events subscription will fail internally. The fail is not returned by the subscribe API which is yet another problem. In step 3: - Calling amxb_set_config has no effect because the configuration is applied only to backends listed in the load_order. - Since the usp backend was not added to load_order list (internal to libamxb) in step 2, the USP configuration is never applied. (This appears to be another limitation in libamxb.) Solution: --------- Invert steps 2 and 3. By setting the usp configuration before loading the backend, the usp section is present in the internal libamxb configuration. As a result, when the usp backend is loaded, it receives a non-NULL configuration, allowing the EndPointID to be created correctly and enabling successful event subscription. Fixes: PPW-1208 Signed-off-by: Houssem Dafdouf <houssem.dafdouf_ext@softathome.com>
This commit is contained in:
@@ -48,6 +48,11 @@ bool AmbiorixConnection::init()
|
|||||||
amxc_var_t *usp_section = amxc_var_add_key(amxc_htable_t, m_config, "usp", NULL);
|
amxc_var_t *usp_section = amxc_var_add_key(amxc_htable_t, m_config, "usp", NULL);
|
||||||
amxc_var_add_key(bool, usp_section, "requires-device-prefix", true);
|
amxc_var_add_key(bool, usp_section, "requires-device-prefix", true);
|
||||||
|
|
||||||
|
// set usp configuration
|
||||||
|
if (amxb_set_config(m_config) != 0) {
|
||||||
|
LOG(ERROR) << "Failed to set amxb config";
|
||||||
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
// Load the backend .so file
|
// Load the backend .so file
|
||||||
ret = amxb_be_load(m_amxb_backend.c_str());
|
ret = amxb_be_load(m_amxb_backend.c_str());
|
||||||
@@ -55,9 +60,6 @@ bool AmbiorixConnection::init()
|
|||||||
LOG(ERROR) << "Failed to load the " << m_amxb_backend.c_str() << " backend";
|
LOG(ERROR) << "Failed to load the " << m_amxb_backend.c_str() << " backend";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (amxb_set_config(m_config) != 0) {
|
|
||||||
LOG(ERROR) << "Failed to set amxb config";
|
|
||||||
}
|
|
||||||
// Connect to the bus
|
// Connect to the bus
|
||||||
ret = amxb_connect(&m_bus_ctx, m_bus_uri.c_str());
|
ret = amxb_connect(&m_bus_ctx, m_bus_uri.c_str());
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user