* Re: [PATCH 1/7] Bluetooth: Hold the lock inside l2cap_get_sock_by_addr()
From: Gustavo F. Padovan @ 2010-11-10 15:47 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Ville Tervo, linux-bluetooth@vger.kernel.org
In-Reply-To: <1289367595.9615.240.camel@aeonflux>
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2010-11-10 14:39:55 +0900]:
> Hi Gustavo,
>
> > > On Tue, Nov 02, 2010 at 04:03:12PM +0100, ext Gustavo F. Padovan wrote:
> > > > It also have to change the name of the function to
> > > > l2cap_get_sock_by_addr() because we do hold the lock inside it now.
> > > >
> > > > Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> > > > ---
> > > > net/bluetooth/l2cap.c | 17 ++++++-----------
> > > > 1 files changed, 6 insertions(+), 11 deletions(-)
> > > >
> > > > diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> > > > index 6f931cc..3d48867 100644
> > > > --- a/net/bluetooth/l2cap.c
> > > > +++ b/net/bluetooth/l2cap.c
> > > > @@ -728,15 +728,18 @@ static inline void l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, stru
> > > > }
> > > >
> > > > /* ---- Socket interface ---- */
> > > > -static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src)
> > > > +static struct sock *l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src)
> > > > {
> > > > struct sock *sk;
> > > > struct hlist_node *node;
> > > > +
> > > > + write_lock_bh(&l2cap_sk_list.lock);
> > >
> > > Code is only reading so read_lock_bh would be enough?
> >
> > Sure, I didn't looked to that, I just keept the same code that we were
> > using before. I'll fix it.
>
> we might also not just bother with read/write locks. Since they are not
> always the right thing to do. In a lot of cases a pure spinlock is just
> better. And in case of Bluetooth I think we would be just fine with
> using a pure spinlock. You might run some tests with this.
Better than spinlock is move everything to RCU, than we will just need a
mutex or spinlock in the write operations. Using a RCU is a lot simpler.
These patches are a clean up to add RCU to sk_list, so I propose to
upstream the new version of my patches and do the RCU change on top
of them.
After all these changes we will be ready for the l2cap.c split.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: [PATCH 1/4] Sim Access Profile API
From: Gustavo F. Padovan @ 2010-11-10 16:07 UTC (permalink / raw)
To: Waldemar.Rymarkiewicz
Cc: marcel, linux-bluetooth, suraj, johan.hedberg, joakim.xj.ceder
In-Reply-To: <99B09243E1A5DA4898CDD8B7001114480BD700C239@EXMB04.eu.tieto.com>
Hi Waldemar,
* Waldemar.Rymarkiewicz@tieto.com <Waldemar.Rymarkiewicz@tieto.com> [2010-11-10 13:12:53 +0200]:
> Hi Marcel,
>
> >> + void Disable()
> >> +
> >> + Shudown SAP server and remove the SDP record.
> >> +
> >> + Possible errors: org.bluez.Error.Failed
> >
> >I don't like this. If you have properties then just changing
> >the property should be enough. So a SetProperty is more appropriate.
>
> I see another option to get rid of 'Enabled' property and leave the methods. What would you say on that?
It's not a good a idea. We have been moving everything we can to a set
property operation instead of a method call. Do that as method is add
unnecessary code to BlueZ once we already have set property there.
>
> >> +
> >> + void Disconnect(boolean type)
> >> +
> >> + Disconnect SAP client from the server.
> >The 'type'
> >> + parameter indicates disconnection type.
> >> +
> >> + True - gracefull disconnection
> >> + False - immediate disconnection
> >> +
> >> + Possible errors: org.bluez.Error.Failed
> >
> >I don't like this style of method names at all. Using method
> >names like GracefulDisconnect and ImmediateDisconnect would be better.
>
> That's fine.
>
> >However I am not sure we should differentiate here at all. We
> >should always to the graceful disconnect. What will the
> >immediate disconnect bring us?
>
> That's actually intended for testing only. One of PTS test cases expects the tester to trigger immediate disconnect.
> In practce, it is only used when connection to sim card is lost, but this is obviously done internally.
So this shouldn't be in the API, no one is going to use it. You can
create something internally for the immediate disconnection that you go
and set manually inside the code. Make sure to comment in the code why
you are adding this there. That can also be a option in some of the
bluetooth config files. Let's see what others think here.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: [PATCH 1/3] Bluetooth: Simplify remote features callback function logic
From: Gustavo F. Padovan @ 2010-11-10 16:24 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth, Johan Hedberg
In-Reply-To: <1289401913-22982-1-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
* johan.hedberg@gmail.com <johan.hedberg@gmail.com> [2010-11-10 17:11:51 +0200]:
> From: Johan Hedberg <johan.hedberg@nokia.com>
>
> The current remote and remote extended features event callbacks logic
> can be made simpler by using a label and goto statements instead of the
> current multiple levels of nested if statements.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
> ---
> net/bluetooth/hci_event.c | 91 +++++++++++++++++++++++----------------------
> 1 files changed, 47 insertions(+), 44 deletions(-)
Applied to bluetooth-next-2.6, thanks.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: [PATCHv4 0/2] Fix kernel crash in rfcomm/l2cap
From: Gustavo F. Padovan @ 2010-11-10 16:32 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: Marcel Holtmann, linux-bluetooth
In-Reply-To: <1289402694.23417.2.camel@Nokia-N900>
Hi Andrei,
* Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com> [2010-11-10 17:24:=
54 +0200]:
> Hi Marcel,
>=20
> > Hi Andrei,
> >=20
> > > Yet another version of patches fixing kernel crash in RFCOMM / L2CAP.
> > > *v4: taken Gustavo comments about timer HZ -> HZ/5
> > >=20
> > > Do not delete l2cap channel and socket sk when sk is owned by user.
> > > To delete l2cap channel standard timer is used.
> > >=20
> > > lock_sock and release_sock do not hold a normal spinlock directly but=
=20
> > > instead hold the owner field. This means bh_lock_sock can still execu=
te
> > > even if the socket is "locked". More info can be found here:
> > > http://www.linuxfoundation.org/collaborate/workgroups/networking/sock=
etlocks
> > >=20
> > > When sending following sequence:
> > > ...
> > > No.=A0 =A0 =A0 =A0 Time=A0 =A0 =A0 =A0 =A0 =A0 =A0 Source=A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Destination=A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =20
> > > Protocol Info 89 1.951202=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
RFCOMM=A0 =A0 Rcvd DISC DLCI=3D20
> > > 90 1.951324=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RFCOMM=A0 =A0=
Sent UA DLCI=3D20
> > > 91 1.959381=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 HCI_EVT=A0 =
=A0 Number of Completed Packets
> > > 92 1.966461=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RFCOMM=A0 =A0=
Rcvd DISC DLCI=3D0
> > > 93 1.966492=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 L2CAP=A0 =A0 =
=A0 Rcvd Disconnect Request
> > > 94 1.972595=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 L2CAP=A0 =A0 =
=A0 Sent Disconnect Response
> > >=20
> > > ...
> > >=20
> > > krfcommd kernel thread is preempted with l2cap tasklet which remove
> > > l2cap_conn (L2CAP connection handler structure). Then rfcomm thread
> > > tries to send RFCOMM UA which is reply to RFCOMM DISC and when
> > > de-referencing l2cap_conn crash happens.
> >=20
> > so I assume you have tested this extensively with various RFCOMM corner
> > cases like incoming RFCOMM. Since a lot of profiles require proper
> > disconnects and we have to ensure that our reference counting is
> > correct.
>=20
> We have the slightly modified patch applied for a several months. No regr=
ession found.
>=20
> Regards,
> Andrei
>=20
> >=20
> > Other then that it seems fine to me.
> >=20
> > Acked-by: Marcel Holtmann <marcel@holtmann.org>
Applied to bluetooth-next-2,6, thanks.
--=20
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: [PATCH 3/6] Bluetooth: Use LE buffers for LE traffic
From: Claudio Takahasi @ 2010-11-10 16:53 UTC (permalink / raw)
To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AgaWYgKChoZGV2LT5zY29fY250ICs9IGNv
dW50KSA+IGhkZXYtPnNjb19wa3RzKQo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgaGRldi0+c2NvX2NudCArPSBjb3VudDsKPiArIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChoZGV2LT5zY29fY250ID4gaGRldi0+
c2NvX3BrdHMpCj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqBoZGV2LT5zY29fY250ID0gaGRldi0+c2NvX3BrdHM7Cj4gwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB9Cj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB9Cj4g
LS0KPiAxLjcuMQo+Cg==
^ permalink raw reply
* [PATCH 1/7] Fix invalid memory access when EIR field length is zero
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
From: Bruna Moreira <bruna.moreira@openbossa.org>
---
src/adapter.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 31014e5..2f79e1c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2970,21 +2970,20 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
size_t uuid16_count = 0;
size_t uuid32_count = 0;
size_t uuid128_count = 0;
- uint8_t *uuid16;
- uint8_t *uuid32;
- uint8_t *uuid128;
+ uint8_t *uuid16 = 0;
+ uint8_t *uuid32 = 0;
+ uint8_t *uuid128 = 0;
uuid_t service;
unsigned int i;
while (len < EIR_DATA_LENGTH - 1) {
- uint8_t type = eir_data[1];
uint8_t field_len = eir_data[0];
/* Check for the end of EIR */
if (field_len == 0)
break;
- switch (type) {
+ switch (eir_data[1]) {
case EIR_UUID16_SOME:
case EIR_UUID16_ALL:
uuid16_count = field_len / 2;
--
1.7.0.4
^ permalink raw reply related
* [PATCH 2/7] Refactor get_eir_uuids() to get EIR data length parameter
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
get_eir_uuids() will be reused to parse LE advertising data as well, as
they share the same format. But for Advertising, maximum data length is
different (31 bytes vs. 240 bytes for EIR), and the radio is not
required to send the non-significant (zero-filled) bytes.
adapter_emit_device_found() now also accepts a EIR data length
parameter, so it can be reused for LE and can propagate the exact data
length.
---
src/adapter.c | 17 ++++++++++-------
src/adapter.h | 2 +-
src/event.c | 2 +-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 2f79e1c..4d23db0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2962,7 +2962,8 @@ static void emit_device_found(const char *path, const char *address,
g_dbus_send_message(connection, signal);
}
-static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
+static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
+ size_t *uuid_count)
{
uint16_t len = 0;
char **uuids;
@@ -2976,7 +2977,10 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
uuid_t service;
unsigned int i;
- while (len < EIR_DATA_LENGTH - 1) {
+ if (eir_data == NULL || eir_length == 0)
+ return NULL;
+
+ while (len < eir_length - 1) {
uint8_t field_len = eir_data[0];
/* Check for the end of EIR */
@@ -3006,7 +3010,7 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
}
/* Bail out if got incorrect length */
- if (len > EIR_DATA_LENGTH)
+ if (len > eir_length)
return NULL;
total = uuid16_count + uuid32_count + uuid128_count;
@@ -3056,7 +3060,7 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
}
void adapter_emit_device_found(struct btd_adapter *adapter,
- struct remote_dev_info *dev, uint8_t *eir_data)
+ struct remote_dev_info *dev, uint8_t *eir_data, size_t eir_length)
{
struct btd_device *device;
char peer_addr[18], local_addr[18];
@@ -3086,8 +3090,7 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
alias = g_strdup(dev->alias);
/* Extract UUIDs from extended inquiry response if any*/
- if (eir_data != NULL)
- uuids = get_eir_uuids(eir_data, &uuid_count);
+ uuids = get_eir_uuids(eir_data, eir_length, &uuid_count);
emit_device_found(adapter->path, paddr,
"Address", DBUS_TYPE_STRING, &paddr,
@@ -3147,7 +3150,7 @@ done:
adapter->found_devices = g_slist_sort(adapter->found_devices,
(GCompareFunc) dev_rssi_cmp);
- adapter_emit_device_found(adapter, dev, eir_data);
+ adapter_emit_device_found(adapter, dev, eir_data, EIR_DATA_LENGTH);
}
int adapter_remove_found_device(struct btd_adapter *adapter, bdaddr_t *bdaddr)
diff --git a/src/adapter.h b/src/adapter.h
index 8019cfc..89b07d7 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -124,7 +124,7 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
name_status_t name_status, uint8_t *eir_data);
int adapter_remove_found_device(struct btd_adapter *adapter, bdaddr_t *bdaddr);
void adapter_emit_device_found(struct btd_adapter *adapter,
- struct remote_dev_info *dev, uint8_t *eir_data);
+ struct remote_dev_info *dev, uint8_t *eir_data, size_t eir_length);
void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode);
void adapter_setname_complete(bdaddr_t *local, uint8_t status);
void adapter_update_tx_power(bdaddr_t *bdaddr, uint8_t status, void *ptr);
diff --git a/src/event.c b/src/event.c
index 971bb35..a057306 100644
--- a/src/event.c
+++ b/src/event.c
@@ -510,7 +510,7 @@ void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
if (dev_info) {
g_free(dev_info->name);
dev_info->name = g_strdup(name);
- adapter_emit_device_found(adapter, dev_info, NULL);
+ adapter_emit_device_found(adapter, dev_info, NULL, 0);
}
if (device)
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3/7] Refactoring adapter_update_found_devices() function
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
From: Bruna Moreira <bruna.moreira@openbossa.org>
The common code from adapter_update_found_devices() was moved to
update_found_devices().
---
src/adapter.c | 52 +++++++++++++++++++++++++++++++---------------------
1 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 4d23db0..c54d035 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3108,12 +3108,11 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
g_strfreev(uuids);
}
-void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
- int8_t rssi, uint32_t class, const char *name,
- const char *alias, gboolean legacy,
- name_status_t name_status, uint8_t *eir_data)
+static gboolean update_found_devices(struct btd_adapter *adapter,
+ bdaddr_t *bdaddr, int8_t rssi, struct remote_dev_info **dev_info)
{
struct remote_dev_info *dev, match;
+ gboolean found;
memset(&match, 0, sizeof(struct remote_dev_info));
bacpy(&match.bdaddr, bdaddr);
@@ -3121,30 +3120,41 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
dev = adapter_search_found_devices(adapter, &match);
if (dev) {
+ found = TRUE;
/* Out of range list update */
adapter->oor_devices = g_slist_remove(adapter->oor_devices,
- dev);
-
- if (rssi == dev->rssi)
- return;
-
- goto done;
+ dev);
+ } else {
+ found = FALSE;
+ dev = g_new0(struct remote_dev_info, 1);
+ bacpy(&dev->bdaddr, bdaddr);
+ adapter->found_devices = g_slist_prepend(adapter->found_devices,
+ dev);
}
- dev = g_new0(struct remote_dev_info, 1);
+ *dev_info = dev;
- bacpy(&dev->bdaddr, bdaddr);
- dev->class = class;
- if (name)
- dev->name = g_strdup(name);
- if (alias)
- dev->alias = g_strdup(alias);
- dev->legacy = legacy;
- dev->name_status = name_status;
+ return found;
+}
- adapter->found_devices = g_slist_prepend(adapter->found_devices, dev);
+void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
+ int8_t rssi, uint32_t class, const char *name,
+ const char *alias, gboolean legacy,
+ name_status_t name_status, uint8_t *eir_data)
+{
+ struct remote_dev_info *dev;
+
+ if (!update_found_devices(adapter, bdaddr, rssi, &dev)) {
+ dev->class = class;
+ if (name)
+ dev->name = g_strdup(name);
+ if (alias)
+ dev->alias = g_strdup(alias);
+ dev->legacy = legacy;
+ dev->name_status = name_status;
+ } else if (dev->rssi == rssi)
+ return;
-done:
dev->rssi = rssi;
adapter->found_devices = g_slist_sort(adapter->found_devices,
--
1.7.0.4
^ permalink raw reply related
* [PATCH 4/7] Initial advertising data parsing implementation
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
From: Bruna Moreira <bruna.moreira@openbossa.org>
Implement adapter_update_adv() function to parse advertising data
received by btd_event_adv() function. Add some fields for advertising
data in remote_device_info struct.
---
plugins/hciops.c | 9 +++------
src/adapter.c | 23 +++++++++++++++++++++++
src/adapter.h | 5 +++++
src/event.c | 13 +++++++++++++
src/event.h | 1 +
5 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index fc99275..dc7a657 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -1011,7 +1011,7 @@ static inline void le_metaevent(int index, void *ptr)
{
evt_le_meta_event *meta = ptr;
le_advertising_info *info;
- uint8_t *rssi, num, i;
+ uint8_t num, i;
DBG("LE Meta Event");
@@ -1022,11 +1022,8 @@ static inline void le_metaevent(int index, void *ptr)
info = (le_advertising_info *) (meta->data + 1);
for (i = 0; i < num; i++) {
- /* RSSI is last byte of the advertising report event */
- rssi = info->data + info->length;
- btd_event_inquiry_result(&BDADDR(index), &info->bdaddr, 0,
- *rssi, NULL);
- info = (le_advertising_info *) (rssi + 1);
+ btd_event_adv(&BDADDR(index), info);
+ info = (le_advertising_info *) (info->data + info->length + 1);
}
}
diff --git a/src/adapter.c b/src/adapter.c
index c54d035..6b94a43 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3137,6 +3137,28 @@ static gboolean update_found_devices(struct btd_adapter *adapter,
return found;
}
+void adapter_update_adv(struct btd_adapter *adapter, le_advertising_info *info)
+{
+ struct remote_dev_info *dev;
+ bdaddr_t bdaddr;
+ int8_t rssi = 0;
+
+ rssi = *(info->data + info->length);
+ bdaddr = info->bdaddr;
+
+ if (!update_found_devices(adapter, &bdaddr, rssi, &dev)) {
+ dev->le = TRUE;
+ dev->evt_type = info->evt_type;
+ bacpy(&dev->bdaddr, &info->bdaddr);
+ } else if (dev->rssi == rssi)
+ return;
+
+ dev->rssi = rssi;
+
+ adapter->found_devices = g_slist_sort(adapter->found_devices,
+ (GCompareFunc) dev_rssi_cmp);
+}
+
void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
int8_t rssi, uint32_t class, const char *name,
const char *alias, gboolean legacy,
@@ -3145,6 +3167,7 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
struct remote_dev_info *dev;
if (!update_found_devices(adapter, bdaddr, rssi, &dev)) {
+ dev->le = FALSE;
dev->class = class;
if (name)
dev->name = g_strdup(name);
diff --git a/src/adapter.h b/src/adapter.h
index 89b07d7..766b079 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -69,6 +69,10 @@ struct remote_dev_info {
char *alias;
dbus_bool_t legacy;
name_status_t name_status;
+ gboolean le;
+ /* LE adv data */
+ uint8_t evt_type;
+ uint8_t bdaddr_type;
};
struct hci_dev {
@@ -118,6 +122,7 @@ int adapter_get_discover_type(struct btd_adapter *adapter);
gboolean adapter_is_ready(struct btd_adapter *adapter);
struct remote_dev_info *adapter_search_found_devices(struct btd_adapter *adapter,
struct remote_dev_info *match);
+void adapter_update_adv(struct btd_adapter *adapter, le_advertising_info *info);
void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
int8_t rssi, uint32_t class, const char *name,
const char *alias, gboolean legacy,
diff --git a/src/event.c b/src/event.c
index a057306..8b03bc3 100644
--- a/src/event.c
+++ b/src/event.c
@@ -322,6 +322,19 @@ static char *extract_eir_name(uint8_t *data, uint8_t *type)
return NULL;
}
+void btd_event_adv(bdaddr_t *local, le_advertising_info *info)
+{
+ struct btd_adapter *adapter;
+
+ adapter = manager_find_adapter(local);
+ if (adapter == NULL) {
+ error("No matching adapter found");
+ return;
+ }
+
+ adapter_update_adv(adapter, info);
+}
+
void btd_event_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
int8_t rssi, uint8_t *data)
{
diff --git a/src/event.h b/src/event.h
index 4a7b9c9..44e1462 100644
--- a/src/event.h
+++ b/src/event.h
@@ -23,6 +23,7 @@
*/
int btd_event_request_pin(bdaddr_t *sba, struct hci_conn_info *ci);
+void btd_event_adv(bdaddr_t *local, le_advertising_info *info);
void btd_event_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, int8_t rssi, uint8_t *data);
void btd_event_set_legacy_pairing(bdaddr_t *local, bdaddr_t *peer, gboolean legacy);
void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 5/7] Advertising data: extract local name
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
From: Bruna Moreira <bruna.moreira@openbossa.org>
Move extract_eir_name() to glib-helper.c file and rename function to
bt_extract_eir_name(). The local name is extracted from the advertising
data.
---
src/adapter.c | 7 +++++++
src/event.c | 23 +----------------------
src/glib-helper.c | 22 ++++++++++++++++++++++
src/glib-helper.h | 1 +
4 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 6b94a43..95fcbda 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3142,6 +3142,7 @@ void adapter_update_adv(struct btd_adapter *adapter, le_advertising_info *info)
struct remote_dev_info *dev;
bdaddr_t bdaddr;
int8_t rssi = 0;
+ uint8_t type = 0x00;
rssi = *(info->data + info->length);
bdaddr = info->bdaddr;
@@ -3157,6 +3158,12 @@ void adapter_update_adv(struct btd_adapter *adapter, le_advertising_info *info)
adapter->found_devices = g_slist_sort(adapter->found_devices,
(GCompareFunc) dev_rssi_cmp);
+
+ if (info->length) {
+ char *tmp_name = bt_extract_eir_name(info->data, &type);
+ if (tmp_name)
+ dev->name = tmp_name;
+ }
}
void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
diff --git a/src/event.c b/src/event.c
index 8b03bc3..57bdf60 100644
--- a/src/event.c
+++ b/src/event.c
@@ -301,27 +301,6 @@ void btd_event_simple_pairing_complete(bdaddr_t *local, bdaddr_t *peer,
device_simple_pairing_complete(device, status);
}
-static char *extract_eir_name(uint8_t *data, uint8_t *type)
-{
- if (!data || !type)
- return NULL;
-
- if (data[0] == 0)
- return NULL;
-
- *type = data[1];
-
- switch (*type) {
- case 0x08:
- case 0x09:
- if (!g_utf8_validate((char *) (data + 2), data[0] - 1, NULL))
- return strdup("");
- return strndup((char *) (data + 2), data[0] - 1);
- }
-
- return NULL;
-}
-
void btd_event_adv(bdaddr_t *local, le_advertising_info *info)
{
struct btd_adapter *adapter;
@@ -410,7 +389,7 @@ void btd_event_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
} else
legacy = TRUE;
- tmp_name = extract_eir_name(data, &name_type);
+ tmp_name = bt_extract_eir_name(data, &name_type);
if (tmp_name) {
if (name_type == 0x09) {
write_device_name(local, peer, tmp_name);
diff --git a/src/glib-helper.c b/src/glib-helper.c
index 9d76626..33668d7 100644
--- a/src/glib-helper.c
+++ b/src/glib-helper.c
@@ -43,6 +43,7 @@
#include <glib.h>
#include "glib-helper.h"
+#include "sdpd.h"
/* Number of seconds to keep a sdp_session_t in the cache */
#define CACHE_TIMEOUT 2
@@ -576,3 +577,24 @@ GSList *bt_string2list(const gchar *str)
return l;
}
+
+char *bt_extract_eir_name(uint8_t *data, uint8_t *type)
+{
+ if (!data || !type)
+ return NULL;
+
+ if (data[0] == 0)
+ return NULL;
+
+ *type = data[1];
+
+ switch (*type) {
+ case EIR_NAME_SHORT:
+ case EIR_NAME_COMPLETE:
+ if (!g_utf8_validate((char *) (data + 2), data[0] - 1, NULL))
+ return strdup("");
+ return strndup((char *) (data + 2), data[0] - 1);
+ }
+
+ return NULL;
+}
diff --git a/src/glib-helper.h b/src/glib-helper.h
index e89c2c6..dfe4123 100644
--- a/src/glib-helper.h
+++ b/src/glib-helper.h
@@ -38,3 +38,4 @@ char *bt_name2string(const char *string);
int bt_string2uuid(uuid_t *uuid, const char *string);
gchar *bt_list2string(GSList *list);
GSList *bt_string2list(const gchar *str);
+char *bt_extract_eir_name(uint8_t *data, uint8_t *type);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 6/7] Extract service UUIDs from advertising data
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
From: Bruna Moreira <bruna.moreira@openbossa.org>
Make get_eir_uuids() return a GSList of strings, so it can be reused to
extract UUIDs from LE advertising data. The bt_strlist2array() helper
function was created to convert a GSList into a plain array of strings
(needed to send through D-Bus).
---
src/adapter.c | 64 ++++++++++++++++++++++++++++++++++++++++++--------------
src/adapter.h | 1 +
2 files changed, 49 insertions(+), 16 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 95fcbda..b263096 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -202,6 +202,8 @@ static void dev_info_free(struct remote_dev_info *dev)
{
g_free(dev->name);
g_free(dev->alias);
+ g_slist_foreach(dev->services, (GFunc) g_free, NULL);
+ g_slist_free(dev->services);
g_free(dev);
}
@@ -2962,11 +2964,20 @@ static void emit_device_found(const char *path, const char *address,
g_dbus_send_message(connection, signal);
}
-static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
- size_t *uuid_count)
+static char **strlist2array(GSList *list)
+{
+ char *tmp, **array;
+
+ tmp = bt_list2string(list);
+ array = g_strsplit(tmp, " ", 0);
+ g_free(tmp);
+
+ return array;
+}
+
+static GSList *get_eir_uuids(uint8_t *eir_data, size_t eir_length, GSList *list)
{
uint16_t len = 0;
- char **uuids;
size_t total;
size_t uuid16_count = 0;
size_t uuid32_count = 0;
@@ -2975,10 +2986,11 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
uint8_t *uuid32 = 0;
uint8_t *uuid128 = 0;
uuid_t service;
+ char *uuid_str;
unsigned int i;
if (eir_data == NULL || eir_length == 0)
- return NULL;
+ return list;
while (len < eir_length - 1) {
uint8_t field_len = eir_data[0];
@@ -3011,15 +3023,12 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
/* Bail out if got incorrect length */
if (len > eir_length)
- return NULL;
+ return list;
total = uuid16_count + uuid32_count + uuid128_count;
- *uuid_count = total;
if (!total)
- return NULL;
-
- uuids = g_new0(char *, total + 1);
+ return list;
/* Generate uuids in SDP format (EIR data is Little Endian) */
service.type = SDP_UUID16;
@@ -3028,7 +3037,12 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
val16 = (val16 << 8) + uuid16[0];
service.value.uuid16 = val16;
- uuids[i] = bt_uuid2string(&service);
+ uuid_str = bt_uuid2string(&service);
+ if (g_slist_find_custom(list, uuid_str,
+ (GCompareFunc) strcmp) == NULL)
+ list = g_slist_append(list, uuid_str);
+ else
+ g_free(uuid_str);
uuid16 += 2;
}
@@ -3041,7 +3055,12 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
val32 = (val32 << 8) + uuid32[k];
service.value.uuid32 = val32;
- uuids[i] = bt_uuid2string(&service);
+ uuid_str = bt_uuid2string(&service);
+ if (g_slist_find_custom(list, uuid_str,
+ (GCompareFunc) strcmp) == NULL)
+ list = g_slist_append(list, uuid_str);
+ else
+ g_free(uuid_str);
uuid32 += 4;
}
@@ -3052,11 +3071,16 @@ static char **get_eir_uuids(uint8_t *eir_data, size_t eir_length,
for (k = 0; k < 16; k++)
service.value.uuid128.data[k] = uuid128[16 - k - 1];
- uuids[i] = bt_uuid2string(&service);
+ uuid_str = bt_uuid2string(&service);
+ if (g_slist_find_custom(list, uuid_str,
+ (GCompareFunc) strcmp) == NULL)
+ list = g_slist_append(list, uuid_str);
+ else
+ g_free(uuid_str);
uuid128 += 16;
}
- return uuids;
+ return list;
}
void adapter_emit_device_found(struct btd_adapter *adapter,
@@ -3069,7 +3093,7 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
dbus_int16_t rssi = dev->rssi;
char *alias;
char **uuids = NULL;
- size_t uuid_count = 0;
+ size_t uuid_count;
ba2str(&dev->bdaddr, peer_addr);
ba2str(&adapter->bdaddr, local_addr);
@@ -3089,8 +3113,16 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
} else
alias = g_strdup(dev->alias);
- /* Extract UUIDs from extended inquiry response if any*/
- uuids = get_eir_uuids(eir_data, eir_length, &uuid_count);
+ /* Extract UUIDs from extended inquiry response if any */
+ dev->services = get_eir_uuids(eir_data, eir_length, dev->services);
+ uuid_count = g_slist_length(dev->services);
+
+ if (dev->services) {
+ uuids = strlist2array(dev->services);
+ g_slist_foreach(dev->services, (GFunc) g_free, NULL);
+ g_slist_free(dev->services);
+ dev->services = NULL;
+ }
emit_device_found(adapter->path, paddr,
"Address", DBUS_TYPE_STRING, &paddr,
diff --git a/src/adapter.h b/src/adapter.h
index 766b079..84d691b 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -71,6 +71,7 @@ struct remote_dev_info {
name_status_t name_status;
gboolean le;
/* LE adv data */
+ GSList *services;
uint8_t evt_type;
uint8_t bdaddr_type;
};
--
1.7.0.4
^ permalink raw reply related
* [PATCH 7/7] Emit "DeviceFound" signal for LE devices
From: Anderson Lizardo @ 2010-11-10 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
In-Reply-To: <1289411487-6113-1-git-send-email-anderson.lizardo@openbossa.org>
From: Bruna Moreira <bruna.moreira@openbossa.org>
The adapter_emit_device_found() function was modified to emit
DeviceFound signal for LE devices as well.
---
src/adapter.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index b263096..dab9087 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3102,6 +3102,27 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
if (device)
paired = device_is_paired(device);
+ /* Extract UUIDs from extended inquiry response if any */
+ dev->services = get_eir_uuids(eir_data, eir_length, dev->services);
+ uuid_count = g_slist_length(dev->services);
+
+ if (dev->services)
+ uuids = strlist2array(dev->services);
+
+ if (dev->le) {
+ emit_device_found(adapter->path, paddr,
+ "Address", DBUS_TYPE_STRING, &paddr,
+ "RSSI", DBUS_TYPE_INT16, &rssi,
+ "Name", DBUS_TYPE_STRING, &dev->name,
+ "Paired", DBUS_TYPE_BOOLEAN, &paired,
+ "UUIDs", DBUS_TYPE_ARRAY, &uuids, uuid_count,
+ NULL);
+
+ g_strfreev(uuids);
+
+ return;
+ }
+
icon = class_to_icon(dev->class);
if (!dev->alias) {
@@ -3113,12 +3134,7 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
} else
alias = g_strdup(dev->alias);
- /* Extract UUIDs from extended inquiry response if any */
- dev->services = get_eir_uuids(eir_data, eir_length, dev->services);
- uuid_count = g_slist_length(dev->services);
-
if (dev->services) {
- uuids = strlist2array(dev->services);
g_slist_foreach(dev->services, (GFunc) g_free, NULL);
g_slist_free(dev->services);
dev->services = NULL;
@@ -3196,6 +3212,10 @@ void adapter_update_adv(struct btd_adapter *adapter, le_advertising_info *info)
if (tmp_name)
dev->name = tmp_name;
}
+
+ /* FIXME: check if other information was changed before emitting the
+ * signal */
+ adapter_emit_device_found(adapter, dev, info->data, info->length);
}
void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
--
1.7.0.4
^ permalink raw reply related
* Re: RFC: btusb firmware load help
From: Bala Shanmugam @ 2010-11-10 18:32 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Shanmugamkamatchi Balashanmugam, Luis Rodriguez, Johannes Berg,
linux-bluetooth, linux-kernel@vger.kernel.org,
linux-wireless@vger.kernel.org, Deepak Dhamdhere, Sree Durbha
In-Reply-To: <4CADF6BF.6070305@atheros.com>
Hi Marcel,
On 10/7/2010 10:05 PM, Bala Shanmugam wrote:
> On 10/7/2010 8:54 PM, Marcel Holtmann wrote:
>> Hi Bala,
>>
>>> Thanks Johannes. This would be better option to change PID in firmware
>>> as blacklisting 3002 might create problems for 3011 chipsets.
>>> Will try and let you people know.
>> The misbehaving 3002 needs to be blacklisted in btusb.c anyway. However
>> after loading the firmware to 3002 device, it should change its PID to
>> something else.
>>
>> I am still trying to figure out if this is one stage firmware loading or
>> a two stage firmware loading. This is all pretty unclear and nobody has
>> answered this clearly so far.
>>
>> Regards
>>
>> Marcel
>>
>>
> Marcel,
>
> eeprom based 3011 chips comes up with PID 3000 giving control to DFU
> driver [ath3k]. ath3k downloads the
> firmware changing PID to 3002. Now btusb gets control.
>
> In sflash based devices to reduce windows suspend/resume time we had a
> small firmware in flash which
> enables the device to get detected as Generic Bluetooth USB device with
> PID 3002. So control reaches btusb when device is plugged in, leaving
> no option for us to load the actual firmware.
>
> Solution would be to blacklist 3002 in btusb, enable ath3k to get
> control for both the devices, download the firmware and change PID to
> 3003 so that control with come to btusb.
>
> Thanks for your time.
>
> Regards,
> Bala.
As you suggested we blacklisted PID 3002 in btusb and loaded firmware
using ath3k and it worked.
Thanks.
Many of our customers are using their own PIDs and blacklisting 3002
won't work for them.
Can we blacklist all the PIDs used by different customers?
We have another device similar to above one, it doesn't do a USB reset
after downloading firmware.
This is basically to reduce bring-up and suspend/resume time.
Can we add an infrastructure in btusb to download configuration or
firmware for these devices?
If not can you please suggest a solution for this device.
Thanks in advance.
Regards,
Bala.
^ permalink raw reply
* Re: RFC: btusb firmware load help
From: Luis R. Rodriguez @ 2010-11-10 18:46 UTC (permalink / raw)
To: Kevin Hayes, Deepak Dhamdhere, Helen Chu
Cc: Marcel Holtmann, Shanmugamkamatchi Balashanmugam, Luis Rodriguez,
Johannes Berg, linux-bluetooth, linux-kernel@vger.kernel.org,
linux-wireless@vger.kernel.org, Sree Durbha
In-Reply-To: <B7132A25476D334D9130FE7532F2A56314B58158FF@SC1EXMB-MBCL.global.atheros.com>
On Tue, Oct 12, 2010 at 6:38 AM, Kevin Hayes <kevin@atheros.com> wrote:
> Yes, it is a good idea to let the downloadable firmware set a new PID, along with the
> blacklist on the 3002 PID for the first go round. I emphasize, it is the downloaded
> firmware that will be required to do the PID swizzling, not the sflash firmware. And I
> agree we should have a map of the PIDs in use and what they are used for, once
> we get through this immediate fixing phase.
FWIW, since we actually have customers already using this I took
Bala's original patch and put it into compat-wirelesss-2.6.36 and the
current bleeding edge compat-wireless so we can get customers at least
something working in the mean time. Of course this means we'll need to
support this patch should any issues come up ;).
The proper patch didn't make it to 2.6.37, hoping this will get
resolved for 2.6.38.
Luis
^ permalink raw reply
* [PATCH] Print LE link type on hcitool
From: Sheldon Demario @ 2010-11-10 18:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
---
lib/hci.h | 1 +
tools/hcitool.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/hci.h b/lib/hci.h
index 0cb120f..b51280b 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -205,6 +205,7 @@ enum {
#define SCO_LINK 0x00
#define ACL_LINK 0x01
#define ESCO_LINK 0x02
+#define LE_LINK 0x03
/* LMP features */
#define LMP_3SLOT 0x01
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 1a53a38..570df10 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -72,6 +72,8 @@ static char *type2str(uint8_t type)
return "ACL";
case ESCO_LINK:
return "eSCO";
+ case LE_LINK:
+ return "LE";
default:
return "Unknown";
}
--
1.6.2.rc2
^ permalink raw reply related
* Re: [PATCH 3/3] Bluetooth: Automate remote name requests
From: Luiz Augusto von Dentz @ 2010-11-10 21:11 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth, Johan Hedberg
In-Reply-To: <1289401913-22982-3-git-send-email-johan.hedberg@gmail.com>
Hi,
On Wed, Nov 10, 2010 at 5:11 PM, <johan.hedberg@gmail.com> wrote:
> From: Johan Hedberg <johan.hedberg@nokia.com>
>
> In Bluetooth there are no automatic updates of remote device names when
> they get changed on the remote side. Instead, it is a good idea to do a
> manual name request when a new connection gets created (for whatever
> reason) since at this point it is very cheap (no costly baseband
> connection creation needed just for the sake of the name request).
>
> So far userspace has been responsible for this extra name request but
> tighter control is needed in order not to flood Bluetooth controllers
> with two many commands during connection creation. It has been shown
> that some controllers simply fail to function correctly if they get too
> many (almost) simultaneous commands during connection creation. The
> simplest way to acheive better control of these commands is to move
> their sending completely to the kernel side.
>
> This patch inserts name requests into the sequence of events that the
> kernel performs during connection creation. It does this after the
> remote features have been successfully requested and before any pending
> authentication requests are performed. The code will work sub-optimally
> with userspace versions that still do the name requesting themselves (it
> shouldn't break anything though) so it is recommended to combine this
> with a userspace software version that doesn't have automated name
> requests.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
> ---
> net/bluetooth/hci_event.c | 74 ++++++++++++++++++++++++++++++++++----------
> 1 files changed, 57 insertions(+), 17 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 45569f2..cef970f 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -677,9 +677,8 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
> hci_dev_unlock(hdev);
> }
>
> -static int request_outgoing_auth(struct hci_dev *hdev, bdaddr_t *bdaddr)
> +static int outgoing_auth_needed(struct hci_dev *hdev, bdaddr_t *bdaddr)
> {
> - struct hci_cp_auth_requested cp;
> struct hci_conn *conn;
>
> conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr);
> @@ -698,15 +697,43 @@ static int request_outgoing_auth(struct hci_dev *hdev, bdaddr_t *bdaddr)
> conn->sec_level != BT_SECURITY_HIGH)
> return 0;
>
> - cp.handle = __cpu_to_le16(conn->handle);
> - hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
> -
> return 1;
> }
>
> +static int request_auth(struct hci_dev *hdev, bdaddr_t *bdaddr)
> +{
> + struct hci_cp_auth_requested cp;
> + struct hci_conn *conn;
> +
> + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr);
> + if (!conn)
> + return -ENOTCONN;
> +
> + cp.handle = __cpu_to_le16(conn->handle);
> + return hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
> +}
> +
> static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
> {
> + struct hci_cp_remote_name_req *cp;
> +
> BT_DBG("%s status 0x%x", hdev->name, status);
> +
> + /* If successful wait for the name req complete event before
> + * checking for the need to do authentication */
> + if (!status)
> + return;
> +
> + cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ);
> + if (!cp)
> + return;
> +
> + hci_dev_lock(hdev);
> +
> + if (outgoing_auth_needed(hdev, &cp->bdaddr))
> + request_auth(hdev, &cp->bdaddr);
> +
> + hci_dev_unlock(hdev);
> }
>
> static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status)
> @@ -1117,9 +1144,18 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
>
> static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> + struct hci_ev_remote_name *ev = (void *) skb->data;
> +
> BT_DBG("%s", hdev->name);
>
> hci_conn_check_pending(hdev);
> +
> + hci_dev_lock(hdev);
> +
> + if (outgoing_auth_needed(hdev, &ev->bdaddr))
> + request_auth(hdev, &ev->bdaddr);
> +
> + hci_dev_unlock(hdev);
> }
>
> static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
> @@ -1183,7 +1219,6 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
> {
> struct hci_ev_remote_features *ev = (void *) skb->data;
> struct hci_conn *conn;
> - int auth_requested;
>
> BT_DBG("%s status %d", hdev->name, ev->status);
>
> @@ -1208,12 +1243,15 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
> goto unlock;
> }
>
> - if (!ev->status)
> - auth_requested = request_outgoing_auth(hdev, &conn->dst);
> - else
> - auth_requested = 0;
> + if (!ev->status) {
> + struct hci_cp_remote_name_req cp;
> + memset(&cp, 0, sizeof(cp));
> + bacpy(&cp.bdaddr, &conn->dst);
> + cp.pscan_rep_mode = 0x02;
> + hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
> + }
>
> - if (!auth_requested) {
> + if (!outgoing_auth_needed(hdev, &conn->dst)) {
> conn->state = BT_CONNECTED;
> hci_proto_connect_cfm(conn, ev->status);
> hci_conn_put(conn);
> @@ -1671,7 +1709,6 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
> {
> struct hci_ev_remote_ext_features *ev = (void *) skb->data;
> struct hci_conn *conn;
> - int auth_requested;
>
> BT_DBG("%s", hdev->name);
>
> @@ -1693,12 +1730,15 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
> if (conn->state != BT_CONFIG)
> goto unlock;
>
> - if (!ev->status)
> - auth_requested = request_outgoing_auth(hdev, &conn->dst);
> - else
> - auth_requested = 0;
> + if (!ev->status) {
> + struct hci_cp_remote_name_req cp;
> + memset(&cp, 0, sizeof(cp));
> + bacpy(&cp.bdaddr, &conn->dst);
> + cp.pscan_rep_mode = 0x02;
> + hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
> + }
>
> - if (!auth_requested) {
> + if (!outgoing_auth_needed(hdev, &conn->dst)) {
> conn->state = BT_CONNECTED;
> hci_proto_connect_cfm(conn, ev->status);
> hci_conn_put(conn);
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Acked-by: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
--
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply
* [PATCH] Adding a new option to specify medium security level for gatttool
From: Sheldon Demario @ 2010-11-10 21:21 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
---
TODO | 6 ------
attrib/gatttool.c | 11 +++++++++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/TODO b/TODO
index c0a25f1..49a9e76 100644
--- a/TODO
+++ b/TODO
@@ -123,12 +123,6 @@ ATT/GATT
Priority: Low
Complexity: C1
-- Add command line support to use medium instead of (default) low
- security level with gatttool (--sec-level)
-
- Priority: Low
- Complexity: C1
-
- Implement Server characteristic Configuration support in the attribute
server to manage characteristic value broadcasting. There is a single
instance of the Server Characteristic Configuration for all clients.
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index b9f5138..929ee5d 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -54,6 +54,7 @@ static int opt_end = 0xffff;
static int opt_handle = -1;
static int opt_mtu = 0;
static int opt_psm = 0x1f;
+static gboolean opt_medium_sec = FALSE;
static gboolean opt_primary = FALSE;
static gboolean opt_characteristics = FALSE;
static gboolean opt_char_read = FALSE;
@@ -84,6 +85,7 @@ static GIOChannel *do_connect(gboolean le)
GIOChannel *chan;
bdaddr_t sba, dba;
GError *err = NULL;
+ BtIOSecLevel sec_level;
/* This check is required because currently setsockopt() returns no
* errors for MTU values smaller than the allowed minimum. */
@@ -109,13 +111,15 @@ static GIOChannel *do_connect(gboolean le)
} else
bacpy(&sba, BDADDR_ANY);
+ sec_level = opt_medium_sec ? BT_IO_SEC_MEDIUM : BT_IO_SEC_LOW;
+
if (le)
chan = bt_io_connect(BT_IO_L2CAP, connect_cb, NULL, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR, &sba,
BT_IO_OPT_DEST_BDADDR, &dba,
BT_IO_OPT_CID, GATT_CID,
BT_IO_OPT_OMTU, opt_mtu,
- BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+ BT_IO_OPT_SEC_LEVEL, sec_level,
BT_IO_OPT_INVALID);
else
chan = bt_io_connect(BT_IO_L2CAP, connect_cb, NULL, NULL, &err,
@@ -123,7 +127,7 @@ static GIOChannel *do_connect(gboolean le)
BT_IO_OPT_DEST_BDADDR, &dba,
BT_IO_OPT_PSM, opt_psm,
BT_IO_OPT_OMTU, opt_mtu,
- BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+ BT_IO_OPT_SEC_LEVEL, sec_level,
BT_IO_OPT_INVALID);
if (err) {
@@ -519,6 +523,9 @@ static GOptionEntry options[] = {
"Specify the MTU size", "MTU" },
{ "psm", 'p', 0, G_OPTION_ARG_INT, &opt_psm,
"Specify the PSM for GATT/ATT over BR/EDR", "PSM" },
+ { "sec-medium", 's', 0, G_OPTION_ARG_NONE, &opt_medium_sec,
+ "Use medium instead of default low security level",
+ NULL},
{ NULL },
};
--
1.6.2.rc2
^ permalink raw reply related
* Re: [PATCH 1/4] Sim Access Profile API
From: Luiz Augusto von Dentz @ 2010-11-10 21:46 UTC (permalink / raw)
To: Gustavo F. Padovan
Cc: Waldemar.Rymarkiewicz, marcel, linux-bluetooth, suraj,
johan.hedberg, joakim.xj.ceder
In-Reply-To: <20101110160757.GC3275@vigoh>
Hi,
On Wed, Nov 10, 2010 at 6:07 PM, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
> Hi Waldemar,
>
> * Waldemar.Rymarkiewicz@tieto.com <Waldemar.Rymarkiewicz@tieto.com> [2010=
-11-10 13:12:53 +0200]:
>
>> Hi Marcel,
>>
>> >> + =A0 =A0 =A0 =A0 =A0void Disable()
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Shudown SAP server and remove th=
e SDP record.
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Possible errors: org.bluez.Error=
.Failed
>> >
>> >I don't like this. If you have properties then just changing
>> >the property should be enough. So a SetProperty is more appropriate.
>>
>> I see another option to get rid of 'Enabled' property and leave the meth=
ods. What would you say on that?
>
> It's not a good a idea. We have been moving everything we can to a set
> property operation instead of a method call. Do that as method is add
> unnecessary code to BlueZ once we already have set property there.
>
>>
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0void Disconnect(boolean type)
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Disconnect SAP client from the s=
erver.
>> >The 'type'
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0parameter indicates disconnectio=
n type.
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0True =A0- gracefull disconnectio=
n
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0False - immediate disconnection
>> >> +
>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Possible errors: org.bluez.Error=
.Failed
>> >
>> >I don't like this style of method names at all. Using method
>> >names like GracefulDisconnect and ImmediateDisconnect would be better.
>>
>> That's fine.
>>
>> >However I am not sure we should differentiate here at all. We
>> >should always to the graceful disconnect. What will the
>> >immediate disconnect bring us?
>>
>> That's actually intended for testing only. One of PTS test cases expects=
the tester to trigger immediate disconnect.
>> In practce, it is only used when connection to sim card is lost, but thi=
s is obviously done internally.
>
>
> So this shouldn't be in the API, no one is going to use it. You can
> create something internally for the immediate disconnection that you go
> and set manually inside the code. Make sure to comment in the code why
> you are adding this there. That can also be a option in some of the
> bluetooth config files. Let's see what others think here.
Actually this looks a lot like virtual cable unplug that PTS wants to
hid, it is just crap that nobody use, so maybe e.g.
--enable-pts-bullshit would actually make sense to activate the
nonsense that pts wants, well it is still annoying to recompile just
to run PTS tests. For hid the virtual cable unplug can be emulate via
RemoveDevice, so maybe it make sense to do a immediate disconnect in
such case for sap too, but this is still inconvenient since you have
to repair after doing it.
--=20
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply
* [PATCH] Use reference counting of the device object while discovering services
From: Claudio Takahasi @ 2010-11-10 21:55 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
---
attrib/client.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/attrib/client.c b/attrib/client.c
index 1f2c217..955e623 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -158,6 +158,7 @@ static void gatt_service_free(void *user_data)
g_slist_free(gatt->primary);
g_attrib_unref(gatt->attrib);
g_free(gatt->path);
+ btd_device_unref(gatt->dev);
g_free(gatt);
}
@@ -1335,7 +1336,7 @@ int attrib_client_register(struct btd_device *device, int psm)
device_get_address(device, &dba);
gatt = g_new0(struct gatt_service, 1);
- gatt->dev = device;
+ gatt->dev = btd_device_ref(device);
gatt->listen = FALSE;
gatt->path = g_strdup(path);
bacpy(&gatt->sba, &sba);
--
1.7.3.2
^ permalink raw reply related
* [PATCH] Fix possible memory leak of the GIOChannel in the attribute server
From: Claudio Takahasi @ 2010-11-10 21:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <1289426161-10045-1-git-send-email-claudio.takahasi@openbossa.org>
---
src/attrib-server.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 1fc1c18..f644091 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -609,6 +609,20 @@ int attrib_server_init(void)
return -1;
}
+ record = server_record_new();
+ if (record == NULL) {
+ error("Unable to create GATT service record");
+ goto failed;
+ }
+
+ if (add_record_to_server(BDADDR_ANY, record) < 0) {
+ error("Failed to register GATT service record");
+ sdp_record_free(record);
+ goto failed;
+ }
+
+ sdp_handle = record->handle;
+
/* LE socket */
le_io = bt_io_listen(BT_IO_L2CAP, NULL, confirm_event,
NULL, NULL, &gerr,
@@ -623,21 +637,13 @@ int attrib_server_init(void)
/* Doesn't have LE support, continue */
}
- record = server_record_new();
- if (record == NULL) {
- error("Unable to create GATT service record");
- return -1;
- }
-
- if (add_record_to_server(BDADDR_ANY, record) < 0) {
- error("Failed to register GATT service record");
- sdp_record_free(record);
- return -1;
- }
+ return 0;
- sdp_handle = record->handle;
+failed:
+ g_io_channel_unref(l2cap_io);
+ l2cap_io = NULL;
- return 0;
+ return -1;
}
void attrib_server_exit(void)
--
1.7.3.2
^ permalink raw reply related
* [PATCH] Add a new configuration option to disable Low Energy support
From: Claudio Takahasi @ 2010-11-10 21:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <1289426161-10045-1-git-send-email-claudio.takahasi@openbossa.org>
Disable LE interleave discovery and attribute server over LE link.
Option required to force disabling Low energy support for LE capable
adapters.
---
src/adapter.c | 2 +-
src/attrib-server.c | 4 ++++
src/hcid.h | 1 +
src/main.c | 7 +++++++
src/main.conf | 7 ++++++-
5 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 31014e5..0741550 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2082,7 +2082,7 @@ static int adapter_setup(struct btd_adapter *adapter, const char *mode)
if (dev->features[7] & LMP_INQ_TX_PWR)
adapter_ops->read_inq_tx_pwr(adapter->dev_id);
- if (dev->features[4] & LMP_LE) {
+ if (dev->features[4] & LMP_LE && main_opts.le) {
uint8_t simul = (dev->features[6] & LMP_LE_BREDR) ? 0x01 : 0x00;
err = adapter_ops->write_le_host(adapter->dev_id, 0x01, simul);
if (err < 0) {
diff --git a/src/attrib-server.c b/src/attrib-server.c
index f644091..375b731 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -40,6 +40,7 @@
#include "glib-helper.h"
#include "btio.h"
#include "sdpd.h"
+#include "hcid.h"
#include "att.h"
#include "gattrib.h"
@@ -623,6 +624,9 @@ int attrib_server_init(void)
sdp_handle = record->handle;
+ if (!main_opts.le)
+ return 0;
+
/* LE socket */
le_io = bt_io_listen(BT_IO_L2CAP, NULL, confirm_event,
NULL, NULL, &gerr,
diff --git a/src/hcid.h b/src/hcid.h
index 48d489a..a9484a6 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -56,6 +56,7 @@ struct main_opts {
gboolean name_resolv;
gboolean debug_keys;
gboolean attrib_server;
+ gboolean le;
uint8_t scan;
uint8_t mode;
diff --git a/src/main.c b/src/main.c
index adbb374..9abdd60 100644
--- a/src/main.c
+++ b/src/main.c
@@ -222,6 +222,13 @@ static void parse_config(GKeyFile *config)
else
main_opts.attrib_server = boolean;
+ boolean = g_key_file_get_boolean(config, "General",
+ "EnableLE", &err);
+ if (err)
+ g_clear_error(&err);
+ else
+ main_opts.le = boolean;
+
main_opts.link_mode = HCI_LM_ACCEPT;
main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF |
diff --git a/src/main.conf b/src/main.conf
index f92bf42..c03f135 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -56,6 +56,11 @@ NameResolving = true
# that they were created for.
DebugKeys = false
+# Enable Low Energy support if the dongle supports. Default is false.
+# Enable/Disable interleave discovery and attribute server over LE.
+EnableLE = false
+
# Enable the GATT Attribute Server. Default is false, because it is only
-# useful for testing.
+# useful for testing. Attribute server is not enabled over LE if EnableLE
+# is false.
AttributeServer = false
--
1.7.3.2
^ permalink raw reply related
* Re: [PATCH 3/6] Bluetooth: Use LE buffers for LE traffic
From: Ville Tervo @ 2010-11-11 5:53 UTC (permalink / raw)
To: ext Claudio Takahasi; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <AANLkTiktxkQQXH2m2+s-zyfyWh-jUT9rwjU+GPyPWyhS@mail.gmail.com>
Hi Claudio,
On Wed, Nov 10, 2010 at 05:53:02PM +0100, ext Claudio Takahasi wrote:
> Hi Ville,
>
> On Mon, Oct 25, 2010 at 10:21 AM, Ville Tervo <ville.tervo@nokia.com> wrote:
> > BLuetooth chips may have separate buffers for
> > LE traffic. This patch add support to use LE
> > buffers provided by the chip.
> >
> > Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> > ---
> > include/net/bluetooth/hci.h | 1 +
> > include/net/bluetooth/hci_core.h | 5 +++
> > net/bluetooth/hci_conn.c | 5 +++
> > net/bluetooth/hci_core.c | 74 +++++++++++++++++++++++++++++++++++--
> > net/bluetooth/hci_event.c | 40 +++++++++++++++++++-
> > 5 files changed, 119 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index 02055b9..2103731 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -189,6 +189,7 @@ enum {
> >
> > #define LMP_EV4 0x01
> > #define LMP_EV5 0x02
> > +#define LMP_LE 0x40
> >
> > #define LMP_SNIFF_SUBR 0x02
> > #define LMP_EDR_ESCO_2M 0x20
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index 2b7f94a..e2d857a 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -103,15 +103,19 @@ struct hci_dev {
> > atomic_t cmd_cnt;
> > unsigned int acl_cnt;
> > unsigned int sco_cnt;
> > + unsigned int le_cnt;
> >
> > unsigned int acl_mtu;
> > unsigned int sco_mtu;
> > + unsigned int le_mtu;
> > unsigned int acl_pkts;
> > unsigned int sco_pkts;
> > + unsigned int le_pkts;
> >
> > unsigned long cmd_last_tx;
> > unsigned long acl_last_tx;
> > unsigned long sco_last_tx;
> > + unsigned long le_last_tx;
> >
> > struct workqueue_struct *workqueue;
> >
> > @@ -473,6 +477,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
> > #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
> > #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
> > #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
> > +#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
> >
> > /* ----- HCI protocols ----- */
> > struct hci_proto {
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index 0944c0c..ddc2e5e 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -324,6 +324,11 @@ int hci_conn_del(struct hci_conn *conn)
> >
> > /* Unacked frames */
> > hdev->acl_cnt += conn->sent;
> > + } else if (conn->type == LE_LINK) {
> > + if (hdev->le_pkts)
> > + hdev->le_cnt += conn->sent;
> > + else
> > + hdev->acl_cnt += conn->sent;
> > } else {
> > struct hci_conn *acl = conn->link;
> > if (acl) {
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index bc2a052..45c78c2 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -254,6 +254,14 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
> > hci_send_cmd(hdev, HCI_OP_WRITE_CA_TIMEOUT, 2, ¶m);
> > }
> >
> > +static void hci_le_init_req(struct hci_dev *hdev, unsigned long opt)
> > +{
> > + BT_DBG("%s", hdev->name);
> > +
> > + /* Read LE buffer size */
> > + hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);
> > +}
> > +
> > static void hci_scan_req(struct hci_dev *hdev, unsigned long opt)
> > {
> > __u8 scan = opt;
> > @@ -509,6 +517,10 @@ int hci_dev_open(__u16 dev)
> > ret = __hci_request(hdev, hci_init_req, 0,
> > msecs_to_jiffies(HCI_INIT_TIMEOUT));
> >
> > + if (lmp_le_capable(hdev))
> > + ret = __hci_request(hdev, hci_le_init_req, 0,
> > + msecs_to_jiffies(HCI_INIT_TIMEOUT));
> > +
> > clear_bit(HCI_INIT, &hdev->flags);
> > }
> >
> > @@ -645,7 +657,7 @@ int hci_dev_reset(__u16 dev)
> > hdev->flush(hdev);
> >
> > atomic_set(&hdev->cmd_cnt, 1);
> > - hdev->acl_cnt = 0; hdev->sco_cnt = 0;
> > + hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0;
> >
> > if (!test_bit(HCI_RAW, &hdev->flags))
> > ret = __hci_request(hdev, hci_reset_req, 0,
> > @@ -1456,8 +1468,25 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
> > }
> >
> > if (conn) {
> > - int cnt = (type == ACL_LINK ? hdev->acl_cnt : hdev->sco_cnt);
> > - int q = cnt / num;
> > + int cnt, q;
> > +
> > + switch (conn->type) {
> > + case ACL_LINK:
> > + cnt = hdev->acl_cnt;
> > + break;
> > + case SCO_LINK:
> > + case ESCO_LINK:
> > + cnt = hdev->sco_cnt;
> > + break;
> > + case LE_LINK:
> > + cnt = hdev->le_mtu ? hdev->le_cnt : hdev->acl_cnt;
> > + break;
> > + default:
> > + cnt = 0;
> > + BT_ERR("Unknown link type");
> > + }
> > +
> > + q = cnt / num;
> > *quote = q ? q : 1;
> > } else
> > *quote = 0;
> > @@ -1556,6 +1585,40 @@ static inline void hci_sched_esco(struct hci_dev *hdev)
> > }
> > }
> >
> > +static inline void hci_sched_le(struct hci_dev *hdev)
> > +{
> > + struct hci_conn *conn;
> > + struct sk_buff *skb;
> > + int quote, cnt;
> > +
> > + BT_DBG("%s", hdev->name);
> > +
> > + if (!test_bit(HCI_RAW, &hdev->flags)) {
> > + /* ACL tx timeout must be longer than maximum
> > + * link supervision timeout (40.9 seconds) */
> > + if (!hdev->le_cnt &&
> > + time_after(jiffies, hdev->le_last_tx + HZ * 45))
> > + hci_acl_tx_to(hdev);
> > + }
>
> It seems that the ACL tx timeout is causing some problems: BR/EDR and
> LE connections are not working properly on macbooks! Don't ask me why
> on macbooks only! But I double checked. I tested your branch and also
> bluetooth-next + LE patches and both are not working as expected. I
> didn't have time to investigate it, do you have any clue?
>
> For BR/EDR I am receiving "killing stalled ACL connection" messages
> for all connections.
>
Yes you are right. I found this also yesterday and I have a patch to fix it
already. I'll clean it up and submit later today.
--
Ville
^ permalink raw reply
* [PATCH 1/3] Split up pbap object and pbap session
From: Dmitriy Paliy @ 2010-11-11 7:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
Pbap object and session are splitted in this patch. Reason is that
obex firstly makes disconnect of service_data, which corresponds to
session in pbap, and than it closes object, which also corresponds
to session in pbap.
When the session is disconnected, it also deallocates memory. When
obex closes the object, it is trying to dereference the deallocated
memory in order to free pbap->buffer data.
Here object and session are separated, while pointers are created to
make one-to-one mapping. Pbap object is created in vobject_..._open
functions. Session and object are handled separately when freed.
---
plugins/pbap.c | 89 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 60 insertions(+), 29 deletions(-)
diff --git a/plugins/pbap.c b/plugins/pbap.c
index a40563c..7b9f1ff 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -141,8 +141,13 @@ struct pbap_session {
struct apparam_field *params;
char *folder;
uint32_t find_handle;
- GString *buffer;
struct cache cache;
+ struct pbap_object *obj;
+};
+
+struct pbap_object {
+ GString *buffer;
+ struct pbap_session *session;
};
static const uint8_t PBAP_TARGET[TARGET_SIZE] = {
@@ -239,9 +244,9 @@ static void phonebook_size_result(const char *buffer, size_t bufsize,
hdr->len = PHONEBOOKSIZE_LEN;
memcpy(hdr->val, &phonebooksize, sizeof(phonebooksize));
- pbap->buffer = g_string_new_len(aparam, sizeof(aparam));
+ pbap->obj->buffer = g_string_new_len(aparam, sizeof(aparam));
- obex_object_set_io_flags(pbap, G_IO_IN, 0);
+ obex_object_set_io_flags(pbap->obj, G_IO_IN, 0);
}
static void query_result(const char *buffer, size_t bufsize, int vcards,
@@ -252,17 +257,17 @@ static void query_result(const char *buffer, size_t bufsize, int vcards,
DBG("");
if (vcards <= 0) {
- obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ obex_object_set_io_flags(pbap->obj, G_IO_ERR, -ENOENT);
return;
}
- if (!pbap->buffer)
- pbap->buffer = g_string_new_len(buffer, bufsize);
+ if (!pbap->obj->buffer)
+ pbap->obj->buffer = g_string_new_len(buffer, bufsize);
else
- pbap->buffer = g_string_append_len(pbap->buffer, buffer,
+ pbap->obj->buffer = g_string_append_len(pbap->obj->buffer, buffer,
bufsize);
- obex_object_set_io_flags(pbap, G_IO_IN, 0);
+ obex_object_set_io_flags(pbap->obj, G_IO_IN, 0);
}
static void cache_entry_notify(const char *id, uint32_t handle,
@@ -394,7 +399,7 @@ static void cache_ready_notify(void *user_data)
hdr->len = PHONEBOOKSIZE_LEN;
memcpy(hdr->val, &size, sizeof(size));
- pbap->buffer = g_string_new_len(aparam, sizeof(aparam));
+ pbap->obj->buffer = g_string_new_len(aparam, sizeof(aparam));
goto done;
}
@@ -408,29 +413,29 @@ static void cache_ready_notify(void *user_data)
if (sorted == NULL) {
pbap->cache.valid = TRUE;
- obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ obex_object_set_io_flags(pbap->obj, G_IO_ERR, -ENOENT);
return;
}
/* Computing offset considering first entry of the phonebook */
l = g_slist_nth(sorted, pbap->params->liststartoffset);
- pbap->buffer = g_string_new(VCARD_LISTING_BEGIN);
+ pbap->obj->buffer = g_string_new(VCARD_LISTING_BEGIN);
for (; l && max; l = l->next, max--) {
const struct cache_entry *entry = l->data;
- g_string_append_printf(pbap->buffer, VCARD_LISTING_ELEMENT,
+ g_string_append_printf(pbap->obj->buffer, VCARD_LISTING_ELEMENT,
entry->handle, entry->name);
}
- pbap->buffer = g_string_append(pbap->buffer, VCARD_LISTING_END);
+ pbap->obj->buffer = g_string_append(pbap->obj->buffer, VCARD_LISTING_END);
g_slist_free(sorted);
done:
if (!pbap->cache.valid) {
pbap->cache.valid = TRUE;
- obex_object_set_io_flags(pbap, G_IO_IN, 0);
+ obex_object_set_io_flags(pbap->obj, G_IO_IN, 0);
}
}
@@ -446,15 +451,14 @@ static void cache_entry_done(void *user_data)
id = cache_find(&pbap->cache, pbap->find_handle);
if (id == NULL) {
- DBG("Entry %d not found on cache", pbap->find_handle);
- obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ obex_object_set_io_flags(pbap->obj, G_IO_ERR, -ENOENT);
return;
}
ret = phonebook_get_entry(pbap->folder, id, pbap->params,
query_result, pbap);
if (ret < 0)
- obex_object_set_io_flags(pbap, G_IO_ERR, ret);
+ obex_object_set_io_flags(pbap->obj, G_IO_ERR, ret);
}
static struct apparam_field *parse_aparam(const uint8_t *buffer, uint32_t hlen)
@@ -549,6 +553,7 @@ static void *pbap_connect(struct obex_session *os, int *err)
pbap = g_new0(struct pbap_session, 1);
pbap->folder = g_strdup("/");
pbap->find_handle = PHONEBOOK_INVALID_HANDLE;
+ pbap->obj = NULL;
if (err)
*err = 0;
@@ -692,10 +697,23 @@ static struct obex_service_driver pbap = {
.chkput = pbap_chkput
};
+static void *vobject_create(void *user_data)
+{
+ struct pbap_session *pbap = user_data;
+ struct pbap_object *obj;
+
+ obj = g_new0(struct pbap_object, 1);
+ obj->session = pbap;
+ pbap->obj = obj;
+
+ return obj;
+}
+
static void *vobject_pull_open(const char *name, int oflag, mode_t mode,
void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
+ struct pbap_object *obj;
phonebook_cb cb;
int ret;
@@ -718,10 +736,13 @@ static void *vobject_pull_open(const char *name, int oflag, mode_t mode,
cb = query_result;
ret = phonebook_pull(name, pbap->params, cb, pbap);
+
if (ret < 0)
goto fail;
- return pbap;
+ obj = vobject_create(pbap);
+
+ return obj;
fail:
if (err)
@@ -734,6 +755,7 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,
void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
+ struct pbap_object *obj;
int ret;
DBG("name %s context %p valid %d", name, context, pbap->cache.valid);
@@ -755,7 +777,7 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,
* Valid cache and empty buffer mean that cache was already
* created within a single session, but no data is available.
*/
- if (!pbap->buffer) {
+ if (!pbap->obj->buffer) {
ret = -ENOENT;
goto fail;
}
@@ -771,7 +793,9 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,
goto fail;
done:
- return pbap;
+ obj = vobject_create(pbap);
+
+ return obj;
fail:
if (err)
@@ -784,6 +808,7 @@ static void *vobject_vcard_open(const char *name, int oflag, mode_t mode,
void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
+ struct pbap_object *obj;
const char *id;
uint32_t handle;
int ret;
@@ -820,7 +845,9 @@ done:
if (ret < 0)
goto fail;
- return pbap;
+ obj = vobject_create(pbap);
+
+ return obj;
fail:
if (err)
@@ -832,12 +859,13 @@ fail:
static ssize_t vobject_pull_read(void *object, void *buf, size_t count,
uint8_t *hi)
{
- struct pbap_session *pbap = object;
+ struct pbap_object *obj = object;
+ struct pbap_session *pbap = obj->session;
- DBG("buffer %p maxlistcount %d", pbap->buffer,
+ DBG("buffer %p maxlistcount %d", obj->buffer,
pbap->params->maxlistcount);
- if (!pbap->buffer)
+ if (!obj->buffer)
return -EAGAIN;
/* PhoneBookSize */
@@ -847,13 +875,14 @@ static ssize_t vobject_pull_read(void *object, void *buf, size_t count,
/* Stream data */
*hi = OBEX_HDR_BODY;
- return string_read(pbap->buffer, buf, count);
+ return string_read(obj->buffer, buf, count);
}
static ssize_t vobject_list_read(void *object, void *buf, size_t count,
uint8_t *hi)
{
- struct pbap_session *pbap = object;
+ struct pbap_object *obj = object;
+ struct pbap_session *pbap = obj->session;
DBG("valid %d maxlistcount %d", pbap->cache.valid,
pbap->params->maxlistcount);
@@ -867,13 +896,13 @@ static ssize_t vobject_list_read(void *object, void *buf, size_t count,
else
*hi = OBEX_HDR_BODY;
- return string_read(pbap->buffer, buf, count);
+ return string_read(obj->buffer, buf, count);
}
static ssize_t vobject_vcard_read(void *object, void *buf, size_t count,
uint8_t *hi)
{
- struct pbap_session *pbap = object;
+ struct pbap_object *pbap = object;
DBG("buffer %p", pbap->buffer);
@@ -886,13 +915,15 @@ static ssize_t vobject_vcard_read(void *object, void *buf, size_t count,
static int vobject_close(void *object)
{
- struct pbap_session *pbap = object;
+ struct pbap_object *pbap = object;
if (pbap->buffer) {
string_free(pbap->buffer);
pbap->buffer = NULL;
}
+ g_free(pbap);
+
return 0;
}
--
1.7.0.4
^ permalink raw reply related
* [PATCH 2/3] Code clean up: pbap->params = params removed
From: Dmitriy Paliy @ 2010-11-11 7:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1289460972-2971-1-git-send-email-dmitriy.paliy@nokia.com>
pbap->params = params; removed due to the fact that this assignment is
already used in the same function.
---
plugins/pbap.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 7b9f1ff..af60741 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -617,7 +617,6 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
if (path == NULL)
return -EBADR;
- pbap->params = params;
ret = obex_get_stream_start(os, path);
g_free(path);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3/3] Code clean up: cache->folder removed
From: Dmitriy Paliy @ 2010-11-11 7:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
In-Reply-To: <1289460972-2971-1-git-send-email-dmitriy.paliy@nokia.com>
cache->folder is not used anywhere and therefore removed.
---
plugins/pbap.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/plugins/pbap.c b/plugins/pbap.c
index af60741..660b17d 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -125,7 +125,6 @@ struct aparam_header {
struct cache {
gboolean valid;
uint32_t index;
- char *folder;
GSList *entries;
};
@@ -219,7 +218,6 @@ static const char *cache_find(struct cache *cache, uint32_t handle)
static void cache_clear(struct cache *cache)
{
- g_free(cache->folder);
g_slist_foreach(cache->entries, (GFunc) cache_entry_free, NULL);
g_slist_free(cache->entries);
cache->entries = NULL;
--
1.7.0.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox