Skip to content
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

binc_agentmanager_register_agent succeeds on first, but fails on second and third adapter #76

Open
abqjln opened this issue Oct 29, 2024 · 0 comments

Comments

@abqjln
Copy link
Contributor

abqjln commented Oct 29, 2024

Trying to set up multiple clients on the Pi3/bluez 5.66. Same issue on Pi4/bluez 5.78. Both using the internal and two USB adapters. The adapters get configured properly but binc_agentmanager_register_agent fails at binc_agentmanager_call_method twice.

The input adapter and agent path are unique (borrowing your random_string function from the application config previously), yet the error show it thinks the second attempt (with unique adapter and path) is a duplicate, and then fails at the default agent manager because it is null. I don't understand what the manager is doing??

Also noted there's no way to trap this type of error--can it be done? Thank you.

Modified code from agent.c
Agent *binc_agent_create(Adapter *adapter, const char *path, IoCapability io_capability) { Agent *agent = g_new0(Agent, 1); agent->path = g_strdup(path); agent->connection = binc_adapter_get_dbus_connection(adapter); agent->adapter = adapter; agent->io_capability = io_capability; bluez_register_agent(agent); log_error( TAG, "[%s]: bluez registered ok using adapter %s", __func__ , binc_adapter_get_path( adapter )); // *******MY LINE binc_agentmanager_register_agent(agent); <<<<<<<<<<<<<<---FAILS HERE log_error( TAG, "[%s]: manager_registered", __func__ ); return agent; }

produces the following with hc0, hc1, hc2 initialized
`
//FIRST ADAPTER--No errors*******

[gl_client_agent_init_all]: Creating agent for adapter hci0 with path /org/bluez/BincAgent_EcTV...
2024-10-28 21:00:09:193 ERROR [Agent] [binc_agent_create]: bluez registered ok using adapter /org/bluez/hci0
[gl_client_agent_init_all]: Started agent '/org/bluez/BincAgent_EcTV'

//SECOND ADAPTER--errors*******

[gl_client_agent_init_all]: Creating agent for adapter hci1 with path /org/bluez/BincAgent_ez7Q...
2024-10-28 21:00:09:211 ERROR [Agent] [binc_agent_create]: bluez registered ok using adapter /org/bluez/hci1

(process:1684): GLib-CRITICAL **: 21:00:09.215: g_variant_unref: assertion 'value != NULL' failed
2024-10-28 21:00:09:216 ERROR [Agent] AgentManager call failed 'RegisterAgent': GDBus.Error:org.bluez.Error.AlreadyExists: Already Exists

(process:1684): GLib-CRITICAL **: 21:00:09.220: g_variant_unref: assertion 'value != NULL' failed
2024-10-28 21:00:09:220 ERROR [Agent] AgentManager call failed 'RequestDefaultAgent': GDBus.Error:org.bluez.Error.DoesNotExist: Does Not Exist

[gl_client_agent_init_all]: Started agent '/org/bluez/BincAgent_ez7Q'

//THIRD ADAPTER--same errors*

[gl_client_agent_init_all]: Creating agent for adapter hci2 with path /org/bluez/BincAgent_HrO6...
2024-10-28 21:00:09:222 ERROR [Agent] [binc_agent_create]: bluez registered ok using adapter /org/bluez/hci2

(process:1684): GLib-CRITICAL **: 21:00:09.226: g_variant_unref: assertion 'value != NULL' failed
2024-10-28 21:00:09:227 ERROR [Agent] AgentManager call failed 'RegisterAgent': GDBus.Error:org.bluez.Error.AlreadyExists: Already Exists

(process:1684): GLib-CRITICAL **: 21:00:09.231: g_variant_unref: assertion 'value != NULL' failed
2024-10-28 21:00:09:231 ERROR [Agent] AgentManager call failed 'RequestDefaultAgent': GDBus.Error:org.bluez.Error.DoesNotExist: Does Not Exist
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant