diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-12-21 00:08:09 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-12-21 00:08:09 +0000 |
commit | ddf0b3facf8bc26767185708582579a118aa8ed4 (patch) | |
tree | 9466ece4018d1417ac6b9c5a25427c36611fe3e4 /hcid | |
parent | aaf086315704313db2fee31d2e4ce68926be53e5 (diff) |
Setup D-Bus for PIN agent if needed
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c index daeb93bd..e8c5ec41 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -460,12 +460,17 @@ static gboolean unregister_dbus_path(const char *path) void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci) { - DBusMessage *message; + DBusMessage *message = NULL; DBusPendingCall *pending = NULL; struct pin_request *req; uint8_t *addr = (uint8_t *) &ci->bdaddr; dbus_bool_t out = ci->out; + if (!connection) { + if (!hcid_dbus_init()) + goto failed; + } + message = dbus_message_new_method_call(PINAGENT_SERVICE_NAME, PINAGENT_PATH, PINAGENT_INTERFACE, PIN_REQUEST); if (message == NULL) { @@ -497,7 +502,9 @@ void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci) return; failed: - dbus_message_unref(message); + if (message) + dbus_message_unref(message); + hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, 6, &ci->bdaddr); } |