Re: What could cause pairing to fail when bluetoothctl is not running?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am finally in business in Linux 5.10.

I built the old bt-agent, and started it with the NoInputNoOutput agent while running dbus-monitor.

I saw:

method call time=1661900193.562288 sender=:1.1182 -> destination=:1.1171 serial=23 path=/org/bluez; interface=org.bluez.AgentManager1; member=RegisterAgent
   object path "/org/blueztools"
   string "NoInputNoOutput"
method call time=1661900193.562697 sender=:1.1182 -> destination=:1.1171 serial=24 path=/org/bluez; interface=org.bluez.AgentManager1; member=RequestDefaultAgent
   object path "/org/blueztools"

I wrote this code in GTK:

#include <gio/gio.h>
const gchar *AM1 = "org.bluez.AgentManager1";
const gchar *AGENT_PATH = "/org/bluez/agent";
GDBusConnection *con;

void bluez_register_agent(){
    GVariant *result;
    GError *error = NULL;
    result = g_dbus_connection_call_sync(con,
        "org.bluez",
        "/org/bluez",
        AM1,
        "RegisterAgent",
        g_variant_new("(os)",AGENT_PATH,"NoInputNoOutput"),
        NULL,
        G_DBUS_SIGNAL_FLAGS_NONE,
        -1,
        NULL,
        &error
    );
    if (error) {
        print_error(error);
        g_error_free(error);
        g_abort();
        error = NULL;
    }
    if (result) {
#ifdef VERBOSE_DEBUG
        gchar *result_text;
        result_text = g_variant_print(result,TRUE);
        g_print("%s\n",result_text);
        g_free(result_text);
#endif
        g_variant_unref(result);
    }

    result = g_dbus_connection_call_sync(con,
    "org.bluez",
    "/org/bluez",
    AM1,
    "RequestDefaultAgent",
    g_variant_new("(o)",AGENT_PATH),
    NULL,
    G_DBUS_SIGNAL_FLAGS_NONE,
    -1,
    NULL,
    &error
    );
    if (error) {
        print_error(error);
        g_error_free(error);
        g_abort();
    }
    if (result) {
#ifdef VERBOSE_DEBUG
        gchar *result_text;
        result_text = g_variant_print(result,TRUE);
        g_print("%s\n",result_text);
        g_free(result_text);
#endif
        g_variant_unref(result);
    }
}

Thanks for the help.


John Klug




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux