Diff between 09044e631d4a5563b11d606b94066cf04a06848a and 5d609076acb05e22fdeaf2d7798c14f7519f72be

Changed Files

File Additions Deletions Status
obexd/plugins/bluetooth.c +17 -0 modified
obexd/src/transport.h +1 -0 modified

Full Patch

diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index 613b2a5..e547857 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -562,9 +562,26 @@ static void bluetooth_stop(void *data)
 	g_slist_free_full(ios, stop);
 }
 
+static int bluetooth_getpeername(GIOChannel *io, char **name)
+{
+	GError *gerr = NULL;
+	char address[18];
+
+	bt_io_get(io, BT_IO_RFCOMM, &gerr,
+			BT_IO_OPT_DEST, address,
+			BT_IO_OPT_INVALID);
+	if (gerr)
+		return -EINVAL;
+
+	*name = g_strdup(address);
+
+	return 0;
+}
+
 static struct obex_transport_driver driver = {
 	.name = "bluetooth",
 	.start = bluetooth_start,
+	.getpeername = bluetooth_getpeername,
 	.stop = bluetooth_stop
 };
 
diff --git a/obexd/src/transport.h b/obexd/src/transport.h
index 320fafb..b81615b 100644
--- a/obexd/src/transport.h
+++ b/obexd/src/transport.h
@@ -25,6 +25,7 @@ struct obex_transport_driver {
 	const char *name;
 	uint16_t service;
 	void *(*start) (struct obex_server *server, int *err);
+	int (*getpeername) (GIOChannel *io, char **name);
 	void (*stop) (void *data);
 };