Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/3] Remove connectable checking when creating a device
@ 2011-05-04 14:13 Anderson Lizardo
  2011-05-04 14:13 ` [PATCH 2/3] Remove advertise event type from adapter functions Anderson Lizardo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anderson Lizardo @ 2011-05-04 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

From: Claudio Takahasi <claudio.takahasi@openbossa.org>

Kernel advertising cache will be used to infer the LE address type
and if it is connectable. For kernels without cache patches, only
LE public address is supported and if the remote is non-connectable,
the connection will fail after the L2CAP timeout(~40s).

Note: currently, CreateDevice misbehaves when LE Create Connection
command times out for any reason (e.g. peer device left connectable
mode). This is being investigated and will be fixed in a separate patch.
---
 src/adapter.c |   30 +++---------------------------
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8dbd62c..82002e7 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -71,9 +71,6 @@
 #define EIR_SIM_HOST                0x10 /* Simultaneous LE and BR/EDR to Same
 					    Device Capable (Host) */
 
-#define ADV_TYPE_IND		0x00
-#define ADV_TYPE_DIRECT_IND	0x01
-
 #define IO_CAPABILITY_DISPLAYONLY	0x00
 #define IO_CAPABILITY_DISPLAYYESNO	0x01
 #define IO_CAPABILITY_KEYBOARDONLY	0x02
@@ -1652,21 +1649,9 @@ static device_type_t flags2type(uint8_t flags)
 		return DEVICE_TYPE_DUALMODE;
 }
 
-static gboolean event_is_connectable(uint8_t type)
-{
-	switch (type) {
-	case ADV_TYPE_IND:
-	case ADV_TYPE_DIRECT_IND:
-		return TRUE;
-	default:
-		return FALSE;
-	}
-}
-
 static struct btd_device *create_device_internal(DBusConnection *conn,
 						struct btd_adapter *adapter,
-						const gchar *address,
-						gboolean force, int *err)
+						const gchar *address, int *err)
 {
 	struct remote_dev_info *dev, match;
 	struct btd_device *device;
@@ -1682,14 +1667,6 @@ static struct btd_device *create_device_internal(DBusConnection *conn,
 	else
 		type = DEVICE_TYPE_BREDR;
 
-	if (!force && type == DEVICE_TYPE_LE &&
-					!event_is_connectable(dev->evt_type)) {
-		if (err)
-			*err = -ENOTCONN;
-
-		return NULL;
-	}
-
 	device = adapter_create_device(conn, adapter, address, type);
 	if (!device && err)
 		*err = -ENOMEM;
@@ -1721,7 +1698,7 @@ static DBusMessage *create_device(DBusConnection *conn,
 
 	DBG("%s", address);
 
-	device = create_device_internal(conn, adapter, address, TRUE, &err);
+	device = create_device_internal(conn, adapter, address, &err);
 	if (!device)
 		goto failed;
 
@@ -1802,8 +1779,7 @@ static DBusMessage *create_paired_device(DBusConnection *conn,
 
 	device = adapter_find_device(adapter, address);
 	if (!device) {
-		device = create_device_internal(conn, adapter, address,
-								FALSE, &err);
+		device = create_device_internal(conn, adapter, address, &err);
 		if (!device)
 			return btd_error_failed(msg, strerror(-err));
 	}
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-05  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 14:13 [PATCH 1/3] Remove connectable checking when creating a device Anderson Lizardo
2011-05-04 14:13 ` [PATCH 2/3] Remove advertise event type from adapter functions Anderson Lizardo
2011-05-04 14:13 ` [PATCH 3/3] Remove flags2type() function Anderson Lizardo
2011-05-05  9:16 ` [PATCH 1/3] Remove connectable checking when creating a device Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox