diff options
Diffstat (limited to 'input/device.c')
-rw-r--r-- | input/device.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/input/device.c b/input/device.c index f765c6f1..fe38e759 100644 --- a/input/device.c +++ b/input/device.c @@ -348,7 +348,8 @@ static gboolean rfcomm_connect_cb(GIOChannel *chan, GIOCondition cond, struct device *idev) { struct fake_input *fake; - DBusMessage *reply; + DBusMessage *reply, *signal; + const char *path; socklen_t len; int ret, err; @@ -394,11 +395,15 @@ static gboolean rfcomm_connect_cb(GIOChannel *chan, g_io_add_watch(fake->io, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, (GIOFunc) rfcomm_io_cb, fake); + /* Replying to the requestor */ reply = dbus_message_new_method_return(idev->pending_connect->msg); - if (reply) { - dbus_connection_send(idev->pending_connect->conn, reply, NULL); - dbus_message_unref(reply); - } + send_message_and_unref(idev->pending_connect->conn, reply); + + /* Sending the Connected signal */ + path = dbus_message_get_path(idev->pending_connect->msg); + signal = dbus_message_new_signal(path, + INPUT_DEVICE_INTERFACE, "Connected"); + send_message_and_unref(idev->pending_connect->conn, signal); pending_connect_free(idev->pending_connect); idev->pending_connect = NULL; @@ -548,6 +553,8 @@ static gboolean interrupt_connect_cb(GIOChannel *chan, GIOCondition cond, struct device *idev) { int ctl, isk, ret, err; + DBusMessage *signal; + const char *path; socklen_t len; if (cond & G_IO_NVAL) { @@ -604,9 +611,16 @@ static gboolean interrupt_connect_cb(GIOChannel *chan, goto failed; } + /* Replying to the requestor */ send_message_and_unref(idev->pending_connect->conn, dbus_message_new_method_return(idev->pending_connect->msg)); + /* Sending the Connected signal */ + path = dbus_message_get_path(idev->pending_connect->msg); + signal = dbus_message_new_signal(path, + INPUT_DEVICE_INTERFACE, "Connected"); + send_message_and_unref(idev->pending_connect->conn, signal); + close (ctl); goto cleanup; failed: |