[PATCH obexd 06/14] Add protocol member to distinguish OBEX Protocol.

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

 



---
 plugins/bluetooth.c |   14 ++++++++++----
 src/service.h       |    7 +++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 632e148..6eb4048 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -456,10 +456,14 @@ static int request_service_authorization(struct bluetooth_service *service,

 	if (connection == NULL || any->path == NULL)
 		return -1;
-
-	bt_io_get(io, BT_IO_RFCOMM, &err,
-			BT_IO_OPT_SOURCE, source,
-			BT_IO_OPT_INVALID);
+	if(service->driver->protocol == RFCOMM_OBEX)
+		bt_io_get(io, BT_IO_RFCOMM, &err,
+				BT_IO_OPT_SOURCE, source,
+				BT_IO_OPT_INVALID);
+	else
+		bt_io_get(io, BT_IO_L2CAP, &err,
+				BT_IO_OPT_SOURCE, source,
+				BT_IO_OPT_INVALID);
 	if (err) {
 		error("%s", err->message);
 		g_error_free(err);
@@ -505,6 +509,7 @@ static void confirm_event(GIOChannel *io, void *user_data)
 		error("bluetooth: Unable to find service");
 		goto drop;
 	}
+	service->driver->protocol = RFCOMM_OBEX;

 	if (service->driver->service != OBEX_OPP) {
 		if (request_service_authorization(service, io, address) < 0)
@@ -550,6 +555,7 @@ static void l2cap_confirm_event(GIOChannel *io, void *user_data)
 		error("bluetooth: Unable to find service");
 		goto drop;
 	}
+	service->driver->protocol = L2CAP_OBEX;
 	if (service->driver->service != OBEX_OPP) {
 		if (request_service_authorization(service, io, address) < 0)
 			goto drop;
diff --git a/src/service.h b/src/service.h
index 313b1f2..465be82 100644
--- a/src/service.h
+++ b/src/service.h
@@ -21,11 +21,18 @@
  *
  */

+typedef enum {
+	RFCOMM_OBEX,
+	L2CAP_OBEX
+} Obex_Protocol;
+
+
 struct obex_service_driver {
 	const char *name;
 	uint16_t service;
 	uint8_t channel;
 	uint16_t psm;
+	Obex_Protocol protocol;
 	const uint8_t *target;
 	unsigned int target_size;
 	const uint8_t *who;
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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