summaryrefslogtreecommitdiffstats
path: root/input/device.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-05-14 12:22:52 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-05-14 12:22:52 +0000
commit772f25e26e1d1c5982855eefd59b51c7e4aaab95 (patch)
treefe8df1faf16795e649407c6512dc1f8b096a0b2b /input/device.c
parent8cea4266a59e24df215febc4bfa4d98c4ad58e7c (diff)
Add GetAdapter() method to retrieve the source address
Diffstat (limited to 'input/device.c')
-rw-r--r--input/device.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/input/device.c b/input/device.c
index d9f95c4e..d85aae55 100644
--- a/input/device.c
+++ b/input/device.c
@@ -850,6 +850,27 @@ static DBusHandlerResult device_is_connected(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult device_get_adapter(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct device *idev = data;
+ DBusMessage *reply;
+ char addr[18];
+ const char *paddr = addr;
+
+ ba2str(&idev->src, addr);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &paddr,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult device_get_address(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -936,6 +957,7 @@ static DBusMethodVTable device_methods[] = {
{ "Connect", device_connect, "", "" },
{ "Disconnect", device_disconnect, "", "" },
{ "IsConnected", device_is_connected, "", "b" },
+ { "GetAdapter", device_get_adapter, "", "s" },
{ "GetAddress", device_get_address, "", "s" },
{ "GetName", device_get_name, "", "s" },
{ "GetProductId", device_get_product_id, "", "q" },