* Re: [PATCH v4] Implement ATT handle indications
From: Claudio Takahasi @ 2011-03-10 14:16 UTC (permalink / raw)
To: Elvis Pfützenreuter; +Cc: linux-bluetooth
In-Reply-To: <1299765690-16322-1-git-send-email-epx@signove.com>
SGkgRWx2aXMsCgpJcyBpdCBhbGxvd2VkIHRvIGhhdmUgbm90aWZpY2F0aW9uIGFuZCBpbmRpY2F0
aW9uIGJpdHMgc2V0IHRvIHRoZSBzYW1lCmNoYXJhY3RlcmlzdGljPwpJZiBpdCBpcyBub3QgYWxs
b3dlZCB5b3UgY291bGQgc2ltcGxpZnkgdGhlIGxvZ2ljIGluc2lkZSB0aGUgImZvciIuCgpPbiBU
aHUsIE1hciAxMCwgMjAxMSBhdCAyOjAxIFBNLCBFbHZpcyBQZsO8dHplbnJldXRlciA8ZXB4QHNp
Z25vdmUuY29tPiB3cm90ZToKPiBUaGlzIHBhdGNoIHRha2VzIGFkdmFudGFnZSBvZiBnX2F0dHJp
Yl9zZW5kKCkgaW1wbGljaXQgZ3VhcmFudGVlIG9mCj4gcXVldWVpbmcgaS5lLiBpbmRpY2F0aW9u
IGlzIG9ubHkgc2VudCBpZiB0aGUgcHJldmlvdXMgb25lIGhhcyBiZWVuCj4gY29uZmlybWVkLCBz
byB3ZSBkb24ndCBuZWVkIHRvIG1haW50YWluIGFuIGV4cGxpY2l0IHF1ZXVlLgo+IC0tLQo+IMKg
c3JjL2F0dHJpYi1zZXJ2ZXIuYyB8IMKgIDE2ICsrKysrKysrKysrKysrKysKPiDCoDEgZmlsZXMg
Y2hhbmdlZCwgMTYgaW5zZXJ0aW9ucygrKSwgMCBkZWxldGlvbnMoLSkKPgo+IGRpZmYgLS1naXQg
YS9zcmMvYXR0cmliLXNlcnZlci5jIGIvc3JjL2F0dHJpYi1zZXJ2ZXIuYwo+IGluZGV4IGI5ODBi
MjguLmYxNTc0MjQgMTAwNjQ0Cj4gLS0tIGEvc3JjL2F0dHJpYi1zZXJ2ZXIuYwo+ICsrKyBiL3Ny
Yy9hdHRyaWItc2VydmVyLmMKPiBAQCAtODc1LDYgKzg3NSw4IEBAIHN0YXRpYyB2b2lkIGNoYW5u
ZWxfaGFuZGxlcihjb25zdCB1aW50OF90ICppcGR1LCB1aW50MTZfdCBsZW4sCj4gwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqBsZW5ndGggPSBmaW5kX2J5X3R5cGUoc3RhcnQsIGVuZCwgJnV1aWQsIHZh
bHVlLCB2bGVuLAo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgb3BkdSwgY2hhbm5lbC0+bXR1
KTsKPiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoGJyZWFrOwo+ICsgwqAgwqAgwqAgY2FzZSBBVFRf
T1BfSEFORExFX0NORjoKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHJldHVybjsKPiDCoCDCoCDC
oCDCoGNhc2UgQVRUX09QX1JFQURfTVVMVElfUkVROgo+IMKgIMKgIMKgIMKgY2FzZSBBVFRfT1Bf
UFJFUF9XUklURV9SRVE6Cj4gwqAgwqAgwqAgwqBjYXNlIEFUVF9PUF9FWEVDX1dSSVRFX1JFUToK
PiBAQCAtOTcyLDYgKzk3NCwyMCBAQCBzdGF0aWMgdm9pZCBhdHRyaWJfbm90aWZ5X2NsaWVudHMo
c3RydWN0IGF0dHJpYnV0ZSAqYXR0cikKPiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoGdfYXR0cmliX3NlbmQoY2hhbm5lbC0+YXR0cmliLCAwLCBwZHVbMF0sIHBkdSwgbGVuLAo+
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgTlVMTCwgTlVMTCwgTlVMTCk7Cj4gwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqB9Cj4gKwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgLyogSW5kaWNhdGlv
biAqLwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGdfc2xpc3RfZmluZF9jdXN0b20oY2hh
bm5lbC0+aW5kaWNhdGUsCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCBHVUlOVF9UT19QT0lOVEVSKGhhbmRsZSksIGhhbmRsZV9jbXAp
KSB7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1aW50OF90IHBkdVtBVFRf
TUFYX01UVV07Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1aW50MTZfdCBs
ZW47CgpUaGUgc2FtZSBkZWNsYXJhdGlvbnMocGR1IGFuZCBsZW4pIGV4aXN0ICBmb3IgTm90aWZp
Y2F0aW9uLiBJIHN1Z2dlc3QKbW92ZSB0byB0aGUgb3V0ZXIgc2NvcGUuCgpCUiwKQ2xhdWRpbwoK
PiArCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBsZW4gPSBlbmNfaW5kaWNh
dGlvbihhdHRyLCBwZHUsIGNoYW5uZWwtPm10dSk7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCBpZiAobGVuID09IDApCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCByZXR1cm47Cj4gKwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgZ19hdHRyaWJfc2VuZChjaGFubmVsLT5hdHRyaWIsIDAsIHBkdVswXSwgcGR1LCBs
ZW4sCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBOVUxMLCBOVUxMLCBOVUxMKTsKPiArIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIH0KPiDCoCDCoCDCoCDCoH0KPiDCoH0KPgo+IC0tCj4gMS43LjEK
Pgo+IC0tCj4gVG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQgdGhlIGxpbmUgInVu
c3Vic2NyaWJlIGxpbnV4LWJsdWV0b290aCIgaW4KPiB0aGUgYm9keSBvZiBhIG1lc3NhZ2UgdG8g
bWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZwo+IE1vcmUgbWFqb3Jkb21vIGluZm8gYXQgwqBodHRw
Oi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwKPgo=
^ permalink raw reply
* Re: [PATCH] Fix unloading of adapter drivers
From: Szymon Janc @ 2011-03-10 14:16 UTC (permalink / raw)
To: Johan Hedberg
Cc: linux-bluetooth@vger.kernel.org,
par-gunnar.p.hjalmdahl@stericsson.com,
henrik.possung@stericsson.com
In-Reply-To: <20110310134204.GA22155@jh-x301>
> Hi Szymon,
>
> On Thu, Mar 10, 2011, Szymon Janc wrote:
> > Call driver remove callback only if corresponding probe succeed.
> > ---
> > src/adapter.c | 41 +++++++++++++++++++++++++----------------
> > 1 files changed, 25 insertions(+), 16 deletions(-)
>
> The patch looks ok'ish, but don't you have to update the
> btd_unregister_adapter_driver function too? (so it also removes
> potential entries in the loaded_drivers list)
Hmm all drivers unregisters them self only when plugin is unloaded, but it might
be good to be prepare for more 'dynamic' drivers in future..
Will prepare v2 shortly.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH v2 2/4] Sim Access Profile Manager
From: Johan Hedberg @ 2011-03-10 14:05 UTC (permalink / raw)
To: Waldemar Rymarkiewicz; +Cc: linux-bluetooth, padovan, Marcel Holtmann
In-Reply-To: <1298549606-16594-3-git-send-email-waldemar.rymarkiewicz@tieto.com>
Hi Waldek,
On Thu, Feb 24, 2011, Waldemar Rymarkiewicz wrote:
> Add a SAP plugin main file and the plugin manager. Also include the SAP
> plugin in the Makefile.
> ---
> Makefile.am | 7 ++++
> acinclude.m4 | 6 ++++
> sap/main.c | 55 +++++++++++++++++++++++++++++++++
> sap/manager.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> sap/manager.h | 22 +++++++++++++
> sap/server.c | 48 +++++++++++++++++++++++++++++
> sap/server.h | 26 ++++++++++++++++
> 7 files changed, 257 insertions(+), 0 deletions(-)
> create mode 100644 sap/main.c
> create mode 100644 sap/manager.c
> create mode 100644 sap/manager.h
> create mode 100644 sap/server.c
> create mode 100644 sap/server.h
I've applied the first two patches, but the third one has some coding
style issues which I will comment on shortly.
Johan
^ permalink raw reply
* [PATCH v4] Implement ATT handle indications
From: Elvis Pfützenreuter @ 2011-03-10 14:01 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
This patch takes advantage of g_attrib_send() implicit guarantee of
queueing i.e. indication is only sent if the previous one has been
confirmed, so we don't need to maintain an explicit queue.
---
src/attrib-server.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/attrib-server.c b/src/attrib-server.c
index b980b28..f157424 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -875,6 +875,8 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
length = find_by_type(start, end, &uuid, value, vlen,
opdu, channel->mtu);
break;
+ case ATT_OP_HANDLE_CNF:
+ return;
case ATT_OP_READ_MULTI_REQ:
case ATT_OP_PREP_WRITE_REQ:
case ATT_OP_EXEC_WRITE_REQ:
@@ -972,6 +974,20 @@ static void attrib_notify_clients(struct attribute *attr)
g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
NULL, NULL, NULL);
}
+
+ /* Indication */
+ if (g_slist_find_custom(channel->indicate,
+ GUINT_TO_POINTER(handle), handle_cmp)) {
+ uint8_t pdu[ATT_MAX_MTU];
+ uint16_t len;
+
+ len = enc_indication(attr, pdu, channel->mtu);
+ if (len == 0)
+ return;
+
+ g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
+ NULL, NULL, NULL);
+ }
}
}
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v3] Implement ATT handle indications
From: Anderson Lizardo @ 2011-03-10 13:46 UTC (permalink / raw)
To: Elvis Pfützenreuter; +Cc: linux-bluetooth
In-Reply-To: <1299760873-15742-1-git-send-email-epx@signove.com>
Hi Elvis,
On Thu, Mar 10, 2011 at 8:41 AM, Elvis Pfützenreuter <epx@signove.com> wrote:
> ---
> src/attrib-server.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/src/attrib-server.c b/src/attrib-server.c
> index b980b28..ec221d1 100644
> --- a/src/attrib-server.c
> +++ b/src/attrib-server.c
> @@ -875,6 +875,8 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
> length = find_by_type(start, end, &uuid, value, vlen,
> opdu, channel->mtu);
> break;
> + case ATT_OP_HANDLE_CNF:
> + return;
> case ATT_OP_READ_MULTI_REQ:
> case ATT_OP_PREP_WRITE_REQ:
> case ATT_OP_EXEC_WRITE_REQ:
> @@ -972,6 +974,26 @@ static void attrib_notify_clients(struct attribute *attr)
> g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
> NULL, NULL, NULL);
> }
> +
> + /* Indication */
> + if (g_slist_find_custom(channel->indicate,
> + GUINT_TO_POINTER(handle), handle_cmp)) {
> + uint8_t pdu[ATT_MAX_MTU];
> + uint16_t len;
> +
> + len = enc_indication(attr, pdu, channel->mtu);
> + if (len == 0)
> + return;
> +
> + /*
> + g_attrib_send() implicitly guarantees that this
> + indication is sent only when the previous one has
> + been confirmed, so we don't need to keep a queue
> + */
I think the comment above can be moved to the commit message instead,
as it is a generic observation that does not apply just to this
g_attrib_send() call.
> +
> + g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
> + NULL, NULL, NULL);
> + }
> }
> }
>
> --
> 1.7.1
>
> --
> 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
>
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH] Fix unloading of adapter drivers
From: Johan Hedberg @ 2011-03-10 13:42 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1299759009-17407-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Thu, Mar 10, 2011, Szymon Janc wrote:
> Call driver remove callback only if corresponding probe succeed.
> ---
> src/adapter.c | 41 +++++++++++++++++++++++++----------------
> 1 files changed, 25 insertions(+), 16 deletions(-)
The patch looks ok'ish, but don't you have to update the
btd_unregister_adapter_driver function too? (so it also removes
potential entries in the loaded_drivers list)
Johan
^ permalink raw reply
* [PATCH v3] Implement ATT handle indications
From: Elvis Pfützenreuter @ 2011-03-10 12:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
---
src/attrib-server.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/attrib-server.c b/src/attrib-server.c
index b980b28..ec221d1 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -875,6 +875,8 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
length = find_by_type(start, end, &uuid, value, vlen,
opdu, channel->mtu);
break;
+ case ATT_OP_HANDLE_CNF:
+ return;
case ATT_OP_READ_MULTI_REQ:
case ATT_OP_PREP_WRITE_REQ:
case ATT_OP_EXEC_WRITE_REQ:
@@ -972,6 +974,26 @@ static void attrib_notify_clients(struct attribute *attr)
g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
NULL, NULL, NULL);
}
+
+ /* Indication */
+ if (g_slist_find_custom(channel->indicate,
+ GUINT_TO_POINTER(handle), handle_cmp)) {
+ uint8_t pdu[ATT_MAX_MTU];
+ uint16_t len;
+
+ len = enc_indication(attr, pdu, channel->mtu);
+ if (len == 0)
+ return;
+
+ /*
+ g_attrib_send() implicitly guarantees that this
+ indication is sent only when the previous one has
+ been confirmed, so we don't need to keep a queue
+ */
+
+ g_attrib_send(channel->attrib, 0, pdu[0], pdu, len,
+ NULL, NULL, NULL);
+ }
}
}
--
1.7.1
^ permalink raw reply related
* some questions about Bluez
From: loody @ 2011-03-10 12:33 UTC (permalink / raw)
To: linux-bluetooth
hi all:
I have some questions about bluetooth.
1. how many additional libs that I need to successfully compile bluez?
so far as I know are:
a. DBUS
b. GLIB
c. ALSA
d. GSTREAMER
e. USB
f. SNDFILE
g.CAPNG
am I right?
2. I try to compile Bluez to run on mips platform.
What I need is a simple tool which can tell me what kind of bluetooth
device around my usb bluetooth controller.
it seems I only need to enable USB lib above, right?
3. from configure, I found we can turn off features by setting
"--disable-xxxx", so I use below configure command for configuring
./configure --prefix=/media/sdb1/bluez-4.89.mips/build
--host=mipsel-linux-gnu --disable-optimization --disable-fortify
--disable-pie --disable-network --disable-serial --disable-input
--disable-audio --disable-service
but it still complain to me that he cannot find alsa header files and libs.
Thanks for your help in advance,
miloody
^ permalink raw reply
* [PATCH] Fix unloading of adapter drivers
From: Szymon Janc @ 2011-03-10 12:10 UTC (permalink / raw)
To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
Call driver remove callback only if corresponding probe succeed.
---
src/adapter.c | 41 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index b119fd1..c72017b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -144,6 +144,8 @@ struct btd_adapter {
GSList *powered_callbacks;
gboolean name_stored;
+
+ GSList *loaded_drivers;
};
static void adapter_set_pairable_timeout(struct btd_adapter *adapter,
@@ -2246,23 +2248,26 @@ static void probe_driver(struct btd_adapter *adapter, gpointer user_data)
if (!adapter->up)
return;
+ if (driver->probe == NULL)
+ return;
+
err = driver->probe(adapter);
- if (err < 0)
+
+ if (err < 0) {
error("%s: %s (%d)", driver->name, strerror(-err), -err);
+ return;
+ }
+
+ adapter->loaded_drivers = g_slist_prepend(adapter->loaded_drivers,
+ driver);
}
static void load_drivers(struct btd_adapter *adapter)
{
GSList *l;
- for (l = adapter_drivers; l; l = l->next) {
- struct btd_adapter_driver *driver = l->data;
-
- if (driver->probe == NULL)
- continue;
-
- probe_driver(adapter, driver);
- }
+ for (l = adapter_drivers; l; l = l->next)
+ probe_driver(adapter, l->data);
}
static void load_connections(struct btd_adapter *adapter)
@@ -2477,16 +2482,20 @@ static void reply_pending_requests(struct btd_adapter *adapter)
}
}
-static void unload_drivers(struct btd_adapter *adapter)
+
+static void remove_driver(gpointer data, gpointer user_data)
{
- GSList *l;
+ struct btd_adapter_driver *driver = data;
+ struct btd_adapter *adapter = user_data;
- for (l = adapter_drivers; l; l = l->next) {
- struct btd_adapter_driver *driver = l->data;
+ if (driver->remove)
+ driver->remove(adapter);
+}
- if (driver->remove)
- driver->remove(adapter);
- }
+static void unload_drivers(struct btd_adapter *adapter)
+{
+ g_slist_foreach(adapter->loaded_drivers, remove_driver, adapter);
+ g_slist_free(adapter->loaded_drivers);
}
static void set_mode_complete(struct btd_adapter *adapter)
--
1.7.0.4
on behalf of ST-Ericsson
^ permalink raw reply related
* Re: [PATCH v2 1/4] Add skeleton for Message Access Profile plugin
From: Johan Hedberg @ 2011-03-10 11:58 UTC (permalink / raw)
To: lkslawek; +Cc: linux-bluetooth
In-Reply-To: <1299755065-4816-1-git-send-email-lkslawek@gmail.com>
Hi Slawek,
On Thu, Mar 10, 2011, lkslawek@gmail.com wrote:
> This patch introduces skeleton of a plugin supporting server role side
> of Bluetooth SIG profile defining procedures for exchanging message
> objects.
>
> The plugin can be compiled with different backends used for accessing
> message repository. This can be selected during configure:
>
> ./configure --with-messages=backend_name
>
> When no backend is specified, the default dummy is chosen.
>
> There is also a new command line option to obexd needed to start Message
> Access service:
>
> obexd [...] --mas
> ---
> v2: fix copyright declarations
>
> .gitignore | 1 +
> Makefile.am | 10 +++++++++-
> configure.ac | 12 ++++++++++++
> plugins/mas.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> plugins/messages-dummy.c | 28 ++++++++++++++++++++++++++++
> plugins/messages.h | 22 ++++++++++++++++++++++
> src/main.c | 11 +++++++++--
> src/obex.h | 1 +
> 8 files changed, 124 insertions(+), 3 deletions(-)
> create mode 100644 plugins/mas.c
> create mode 100644 plugins/messages-dummy.c
> create mode 100644 plugins/messages.h
This patch has been pushed upstream, however I'll wait until we reach a
consensus on the coding style issues for the other patches before
proceeding with them.
Johan
^ permalink raw reply
* Re: [PATCH 2/4] Add actual service for Message Access Profile
From: Slawomir Bochenski @ 2011-03-10 11:28 UTC (permalink / raw)
To: lkslawek, linux-bluetooth
In-Reply-To: <20110310111408.GA18256@jh-x301>
On Thu, Mar 10, 2011 at 12:14 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Slawek,
>
> On Wed, Mar 02, 2011, lkslawek@gmail.com wrote:
>> + ret = obex_get_stream_start(os, name);
>> + if (ret < 0)
>> + goto fail;
>> +
>> + return 0;
>> +fail:
>> + return ret;
>> +}
>
> How about just "return obex_get_stream_start(os, name);"?
>
>> + ret = obex_put_stream_start(os, name);
>> + if (ret < 0)
>> + goto fail;
>> +
>> + return 0;
>> +fail:
>> + return ret;
>> +}
>
> Same here.
>
This is ready for upcoming change, where there is also applications
parameter parsing that can fail and return it's own error code.
>> + }
>> +
>> + return 0;
>> +}
>> +static struct obex_service_driver mas = {
>
> Missing empty line before "statis struct ...".
>
I will fix it.
>> static int mas_init(void)
>> {
>> + int err;
>> +
>> + err = obex_service_driver_register(&mas);
>> + if (err < 0)
>> + goto fail_mas_reg;
>> +
>> return 0;
>> +
>> +fail_mas_reg:
>> + return err;
>> }
>
> Just "return obex_service_driver_register(&mas);" should be enough.
This one makes more sense when you look at all patches in this set as a whole.
--
Slawomir Bochenski
^ permalink raw reply
* Re: [PATCH 2/4] Add actual service for Message Access Profile
From: Johan Hedberg @ 2011-03-10 11:14 UTC (permalink / raw)
To: lkslawek; +Cc: linux-bluetooth
In-Reply-To: <1299058614-8904-3-git-send-email-lkslawek@gmail.com>
Hi Slawek,
On Wed, Mar 02, 2011, lkslawek@gmail.com wrote:
> + ret = obex_get_stream_start(os, name);
> + if (ret < 0)
> + goto fail;
> +
> + return 0;
> +fail:
> + return ret;
> +}
How about just "return obex_get_stream_start(os, name);"?
> + ret = obex_put_stream_start(os, name);
> + if (ret < 0)
> + goto fail;
> +
> + return 0;
> +fail:
> + return ret;
> +}
Same here.
> + }
> +
> + return 0;
> +}
> +static struct obex_service_driver mas = {
Missing empty line before "statis struct ...".
> static int mas_init(void)
> {
> + int err;
> +
> + err = obex_service_driver_register(&mas);
> + if (err < 0)
> + goto fail_mas_reg;
> +
> return 0;
> +
> +fail_mas_reg:
> + return err;
> }
Just "return obex_service_driver_register(&mas);" should be enough.
Johan
^ permalink raw reply
* [PATCH v2 1/4] Add skeleton for Message Access Profile plugin
From: lkslawek @ 2011-03-10 11:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Slawomir Bochenski
From: Slawomir Bochenski <lkslawek@gmail.com>
This patch introduces skeleton of a plugin supporting server role side
of Bluetooth SIG profile defining procedures for exchanging message
objects.
The plugin can be compiled with different backends used for accessing
message repository. This can be selected during configure:
./configure --with-messages=backend_name
When no backend is specified, the default dummy is chosen.
There is also a new command line option to obexd needed to start Message
Access service:
obexd [...] --mas
---
v2: fix copyright declarations
.gitignore | 1 +
Makefile.am | 10 +++++++++-
configure.ac | 12 ++++++++++++
plugins/mas.c | 42 ++++++++++++++++++++++++++++++++++++++++++
plugins/messages-dummy.c | 28 ++++++++++++++++++++++++++++
plugins/messages.h | 22 ++++++++++++++++++++++
src/main.c | 11 +++++++++--
src/obex.h | 1 +
8 files changed, 124 insertions(+), 3 deletions(-)
create mode 100644 plugins/mas.c
create mode 100644 plugins/messages-dummy.c
create mode 100644 plugins/messages.h
diff --git a/.gitignore b/.gitignore
index 663240a..e3f5c3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,7 @@ src/obexd
src/obexd.service
plugins/phonebook.c
plugins/telephony.c
+plugins/messages.c
client/obex-client
client/obex-client.service
test/obex-test
diff --git a/Makefile.am b/Makefile.am
index d32d613..8d8fdc6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,9 @@ builtin_modules += pbap
builtin_sources += plugins/pbap.c plugins/phonebook.h \
plugins/vcard.h plugins/vcard.c
+builtin_modules += mas
+builtin_sources += plugins/mas.c plugins/messages.h
+
builtin_modules += irmc
builtin_sources += plugins/irmc.c
@@ -65,6 +68,7 @@ builtin_modules += syncevolution
builtin_sources += plugins/syncevolution.c
builtin_nodist += plugins/phonebook.c
+builtin_nodist += plugins/messages.c
libexec_PROGRAMS += src/obexd
@@ -137,7 +141,8 @@ CLEANFILES = $(service_DATA) $(builtin_files)
EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \
src/obexd.service.in client/obex-client.service.in \
plugins/phonebook-dummy.c plugins/phonebook-ebook.c \
- plugins/phonebook-tracker.c
+ plugins/phonebook-tracker.c \
+ plugins/messages-dummy.c
DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server
@@ -150,3 +155,6 @@ MAINTAINERCLEANFILES = Makefile.in \
plugins/phonebook.c: plugins/@PHONEBOOK_DRIVER@
$(AM_V_GEN)$(LN_S) @abs_top_srcdir@/$< $@
+
+plugins/messages.c: plugins/@MESSAGES_DRIVER@
+ $(AM_V_GEN)$(LN_S) @abs_top_srcdir@/$< $@
diff --git a/configure.ac b/configure.ac
index 9194843..fb349ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,18 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
CFLAGS="$CFLAGS -g"
fi
])
+
+messages_driver=dummy
+AC_ARG_WITH(messages, AC_HELP_STRING([--with-messages=DRIVER], [select messages driver]), [
+ if (test "${withval}" = "no"); then
+ messages_driver=dummy;
+ else
+ messages_driver=${withval};
+ fi
+])
+
+AC_SUBST([MESSAGES_DRIVER], [messages-${messages_driver}.c])
+
phonebook_driver=dummy
AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [
if (test "${withval}" = "no"); then
diff --git a/plugins/mas.c b/plugins/mas.c
new file mode 100644
index 0000000..cb6dda0
--- /dev/null
+++ b/plugins/mas.c
@@ -0,0 +1,42 @@
+/*
+ *
+ * OBEX Server
+ *
+ * Copyright (C) 2010-2011 Nokia Corporation
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "plugin.h"
+#include "log.h"
+
+#include "messages.h"
+
+static int mas_init(void)
+{
+ return 0;
+}
+
+static void mas_exit(void)
+{
+}
+
+OBEX_PLUGIN_DEFINE(mas, mas_init, mas_exit)
diff --git a/plugins/messages-dummy.c b/plugins/messages-dummy.c
new file mode 100644
index 0000000..1722306
--- /dev/null
+++ b/plugins/messages-dummy.c
@@ -0,0 +1,28 @@
+/*
+ *
+ * OBEX Server
+ *
+ * Copyright (C) 2010-2011 Nokia Corporation
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "messages.h"
diff --git a/plugins/messages.h b/plugins/messages.h
new file mode 100644
index 0000000..2a41ea7
--- /dev/null
+++ b/plugins/messages.h
@@ -0,0 +1,22 @@
+/*
+ *
+ * OBEX Server
+ *
+ * Copyright (C) 2010-2011 Nokia Corporation
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
diff --git a/src/main.c b/src/main.c
index 1e78615..8154e3b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,6 +84,7 @@ static gboolean option_irmc = FALSE;
static gboolean option_pcsuite = FALSE;
static gboolean option_symlinks = FALSE;
static gboolean option_syncevolution = FALSE;
+static gboolean option_mas = FALSE;
static gboolean parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
@@ -125,6 +126,8 @@ static GOptionEntry options[] = {
"Enable PC Suite Services server" },
{ "syncevolution", 'e', 0, G_OPTION_ARG_NONE, &option_syncevolution,
"Enable OBEX server for SyncEvolution" },
+ { "mas", 'm', 0, G_OPTION_ARG_NONE, &option_mas,
+ "Enable Message Access server" },
{ NULL },
};
@@ -212,9 +215,10 @@ int main(int argc, char *argv[])
if (option_opp == FALSE && option_ftp == FALSE &&
option_pbap == FALSE &&
option_irmc == FALSE &&
- option_syncevolution == FALSE) {
+ option_syncevolution == FALSE &&
+ option_mas == FALSE) {
fprintf(stderr, "No server selected (use either "
- "--opp, --ftp, --pbap, --irmc or --syncevolution)\n");
+ "--opp, --ftp, --pbap, --irmc, --mas, or --syncevolution)\n");
exit(EXIT_FAILURE);
}
@@ -278,6 +282,9 @@ int main(int argc, char *argv[])
obex_server_init(OBEX_SYNCEVOLUTION, NULL, TRUE, FALSE,
FALSE, NULL);
+ if (option_mas == TRUE)
+ obex_server_init(OBEX_MAS, NULL, TRUE, FALSE, FALSE, NULL);
+
if (!root_folder_setup(option_root, option_root_setup)) {
error("Unable to setup root folder %s", option_root);
exit(EXIT_FAILURE);
diff --git a/src/obex.h b/src/obex.h
index c3f6e3d..94274c2 100644
--- a/src/obex.h
+++ b/src/obex.h
@@ -36,6 +36,7 @@
#define OBEX_IRMC (1 << 5)
#define OBEX_PCSUITE (1 << 6)
#define OBEX_SYNCEVOLUTION (1 << 7)
+#define OBEX_MAS (1 << 8)
#define TARGET_SIZE 16
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 1/2] Extend Characteristic Write to support Write Without Response
From: Johan Hedberg @ 2011-03-10 9:21 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1299697431-7670-1-git-send-email-claudio.takahasi@openbossa.org>
Hi Claudio,
On Wed, Mar 09, 2011, Claudio Takahasi wrote:
> If callback is not informed, Write Command will be used to execute
> a Write Without Response sub-procedure. Error is not returned by the
> server no matter the result of the operation.
> ---
> attrib/gatt.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
Both patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] Adjust timeout LE and API
From: Johan Hedberg @ 2011-03-10 9:18 UTC (permalink / raw)
To: Marco Sinigaglia; +Cc: linux-bluetooth
In-Reply-To: <1299689985-6818-1-git-send-email-marco.sinigaglia@csr.com>
Hi Marco,
On Wed, Mar 09, 2011, Marco Sinigaglia wrote:
>
> The timeout value has been hardcoded on hci_send_req call and, instead, it should be passed from above (for ex from hci_le_set_scan_enable).
> This patch removes the hardcoded value from hci_send_req and it increases the timeout to 1000ms.
>
> v1-->v2: used git-format-patch
>
> Signed-off-by: Marco Sinigaglia <marco.sinigaglia@csr.com>
>
> ---
> lib/hci.c | 12 ++++++------
> lib/hci_lib.h | 6 +++---
> tools/hciconfig.c | 2 +-
> tools/hcitool.c | 6 +++---
> 4 files changed, 13 insertions(+), 13 deletions(-)
The patch finally applies and has been pushed upstream. However, I did
have to fix your commit message manually:
- Lines should be short enough to fit git log output on a 80
column wide terminal
- Patch version changes do not belong in the commit message. Put them
between the "---" and the "diff" line.
- No Signed-off-by line for user space patches
Johan
^ permalink raw reply
* Re: [PATCHv3 1/2] Use CID to infer transport type
From: Johan Hedberg @ 2011-03-10 9:09 UTC (permalink / raw)
To: Bruna Moreira; +Cc: linux-bluetooth
In-Reply-To: <1299269865-1259-1-git-send-email-bruna.moreira@openbossa.org>
Hi Bruna,
On Fri, Mar 04, 2011, Bruna Moreira wrote:
> Instead of comparing GIOChannel pointers, use the CID returned by
> bt_io_get() to infer the transport type. LE uses the fixed CID for GATT.
> ---
> src/attrib-server.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
Both patches have been pushes upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Increase AVDTP request timeout
From: Johan Hedberg @ 2011-03-10 9:06 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <AANLkTi=aBuDLD2qTa4p29CMdBHjBs_nos5YxC5F4T-fB@mail.gmail.com>
Hi Daniel,
On Tue, Mar 08, 2011, Daniel ??rstadius wrote:
> At least one headset with both A2DP and PBAP sends delayed responses
> to AVDTP requests when it is doing PBAP queries (typically at the
> beginning of the connection).
>
> Increasing the timer by two seconds to give the headset more time to
> reply, to avoid aborting the AVDTP connection.
> ---
> audio/avdtp.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] pand: Fix for TP_BNEP_CTRL_BV_01_C qualification test
From: Johan Hedberg @ 2011-03-10 8:52 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1299264115-10702-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
On Fri, Mar 04, 2011, Lukasz Rymanowski wrote:
> With this fix pand will correctly respond on
> unknown BNEP control command
> ---
> compat/bnep.c | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
Pushed upstream. Could you also create a matching patch for the network
plugin, please? (network/server.c bnep_setup function).
Johan
^ permalink raw reply
* Re: re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+"
From: Johan Hedberg @ 2011-03-10 7:32 UTC (permalink / raw)
To: Ed Tomlinson
Cc: Justin P. Mattock, Mikko Vinni, linux-bluetooth,
Gustavo F. Padovan
In-Reply-To: <201103092154.22796.edt@aei.ca>
Hi,
On Wed, Mar 09, 2011, Ed Tomlinson wrote:
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index 9c4541b..f690eb5 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -95,18 +95,17 @@ void hci_req_complete(struct hci_dev *hdev, __u16
> > cmd, int result)
> > {
> > BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);
> >
> > + if (hdev->req_status == HCI_REQ_PEND) {
> > + hdev->req_result = result;
> > + hdev->req_status = HCI_REQ_DONE;
> > + wake_up_interruptible(&hdev->req_wait_q);
> > + }
> > /* If the request has set req_last_cmd (typical for multi-HCI
> > * command requests) check if the completed command matches
> > * this, and if not just return. Single HCI command requests
> > * typically leave req_last_cmd as 0 */
> > if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
> > return;
> > -
> > - if (hdev->req_status == HCI_REQ_PEND) {
> > - hdev->req_result = result;
> > - hdev->req_status = HCI_REQ_DONE;
> > - wake_up_interruptible(&hdev->req_wait_q);
> > - }
> > }
> >
> > static void hci_req_cancel(struct hci_dev *hdev, int err)
> >
>
> Works here too - bluetooth comes up enabled. On to Linus?
All the patch does is it re-breaks the __hci_request function by
removing proper synchronization from it (again) and thereby hides the
real bug which is the kernel sending commands to the controller before
the HCI_Reset command has completed.
Johan
^ permalink raw reply
* Re: re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+"
From: Ed Tomlinson @ 2011-03-10 2:54 UTC (permalink / raw)
To: Justin P. Mattock
Cc: Mikko Vinni, Johan Hedberg, linux-bluetooth, Gustavo F. Padovan
In-Reply-To: <4D77EFEB.1020804@gmail.com>
On Wednesday 09 March 2011 16:23:55 Justin P. Mattock wrote:
>
> looking more into this issue I am noticing that it seems this might be a
> timing issue. I have tried adding msleep to the function but endedup
> having a system freeze(only because I am not sure how msleep
> works)udelay I have not played around with just yet.
>
> the below patch gets everything working for me:
>
>
> From 8065e37b546cdf6e42a5de4277e08ebba0a18637 Mon Sep 17 00:00:00 2001
> From: Justin P. Mattock <justinmattock@gmail.com>
> Date: Tue, 8 Mar 2011 22:01:19 -0800
> Subject: [PATCH] bluetooth_bug_fix_test_1
> Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
>
> ---
> net/bluetooth/hci_core.c | 11 +++++------
> 1 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 9c4541b..f690eb5 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -95,18 +95,17 @@ void hci_req_complete(struct hci_dev *hdev, __u16
> cmd, int result)
> {
> BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);
>
> + if (hdev->req_status == HCI_REQ_PEND) {
> + hdev->req_result = result;
> + hdev->req_status = HCI_REQ_DONE;
> + wake_up_interruptible(&hdev->req_wait_q);
> + }
> /* If the request has set req_last_cmd (typical for multi-HCI
> * command requests) check if the completed command matches
> * this, and if not just return. Single HCI command requests
> * typically leave req_last_cmd as 0 */
> if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
> return;
> -
> - if (hdev->req_status == HCI_REQ_PEND) {
> - hdev->req_result = result;
> - hdev->req_status = HCI_REQ_DONE;
> - wake_up_interruptible(&hdev->req_wait_q);
> - }
> }
>
> static void hci_req_cancel(struct hci_dev *hdev, int err)
>
Works here too - bluetooth comes up enabled. On to Linus?
Thanks
Ed
^ permalink raw reply
* Re: [bluetooth-next 04/15] Bluetooth: Add support for using the crypto subsystem
From: Vinicius Costa Gomes @ 2011-03-09 22:52 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <20110303174501.GA10733@piper>
On 14:45 Thu 03 Mar, Vinicius Costa Gomes wrote:
> Hi Marcel,
>
> On 14:28 Mon 28 Feb, Gustavo F. Padovan wrote:
> > Hi Vinicius,
> >
> > * Vinicius Gomes <vinicius.gomes@openbossa.org> [2011-02-27 21:49:39 -0300]:
> >
> > > Hi Gustavo,
> > >
> > > On Sun, Feb 27, 2011 at 5:20 PM, Gustavo F. Padovan
> > > <padovan@profusion.mobi> wrote:
> > > > Hi Vinicius,
> > > >
> > > > * Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-02-21 14:23:51 -0300]:
> > > >
> > > >> This will allow using the crypto subsystem for encrypting data. As SMP
> > > >> (Security Manager Protocol) is implemented almost entirely on the host
> > > >> side and the crypto module already implements the needed methods
> > > >> (AES-128), it makes sense to use it.
> > > >>
> > > >> This patch also adds a new Kconfig option to toggle the SMP support.
> > > >>
> > > >> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> > > >> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> > > >> ---
> > > >> include/net/bluetooth/hci_core.h | 2 ++
> > > >> net/bluetooth/Kconfig | 6 ++++++
> > > >> net/bluetooth/hci_core.c | 22 ++++++++++++++++++++++
> > > >> net/bluetooth/smp.c | 17 +++++++++++++++--
> > > >> 4 files changed, 45 insertions(+), 2 deletions(-)
> > > >>
> > > >> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > > >> index d5d8454..e8dbde8 100644
> > > >> --- a/include/net/bluetooth/hci_core.h
> > > >> +++ b/include/net/bluetooth/hci_core.h
> > > >> @@ -161,6 +161,8 @@ struct hci_dev {
> > > >>
> > > >> __u16 init_last_cmd;
> > > >>
> > > >> + struct crypto_blkcipher *tfm;
> > > >> +
> > > >> struct inquiry_cache inq_cache;
> > > >> struct hci_conn_hash conn_hash;
> > > >> struct list_head blacklist;
> > > >> diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
> > > >> index c6f9c2f..e9f40af 100644
> > > >> --- a/net/bluetooth/Kconfig
> > > >> +++ b/net/bluetooth/Kconfig
> > > >> @@ -22,6 +22,7 @@ menuconfig BT
> > > >> BNEP Module (Bluetooth Network Encapsulation Protocol)
> > > >> CMTP Module (CAPI Message Transport Protocol)
> > > >> HIDP Module (Human Interface Device Protocol)
> > > >> + SMP Module (Security Manager Protocol)
> > > >>
> > > >> Say Y here to compile Bluetooth support into the kernel or say M to
> > > >> compile it as module (bluetooth).
> > > >> @@ -35,11 +36,16 @@ config BT_L2CAP
> > > >> bool "L2CAP protocol support"
> > > >> depends on BT
> > > >> select CRC16
> > > >> + select CRYPTO_BLKCIPHER
> > > >> + select CRYPTO_AES
> > > >> help
> > > >> L2CAP (Logical Link Control and Adaptation Protocol) provides
> > > >> connection oriented and connection-less data transport. L2CAP
> > > >> support is required for most Bluetooth applications.
> > > >>
> > > >> + Also included is support for SMP (Security Manager Protocol) which
> > > >> + is the security layer on top of LE (Low Energy) links.
> > > >> +
> > > >> config BT_SCO
> > > >> bool "SCO links support"
> > > >> depends on BT
> > > >> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > > >> index b372fb8..ff67843 100644
> > > >> --- a/net/bluetooth/hci_core.c
> > > >> +++ b/net/bluetooth/hci_core.c
> > > >> @@ -42,6 +42,7 @@
> > > >> #include <linux/notifier.h>
> > > >> #include <linux/rfkill.h>
> > > >> #include <linux/timer.h>
> > > >> +#include <linux/crypto.h>
> > > >> #include <net/sock.h>
> > > >>
> > > >> #include <asm/system.h>
> > > >> @@ -60,6 +61,8 @@ static void hci_notify(struct hci_dev *hdev, int event);
> > > >>
> > > >> static DEFINE_RWLOCK(hci_task_lock);
> > > >>
> > > >> +static int enable_smp;
> > > >> +
> > > >> /* HCI device list */
> > > >> LIST_HEAD(hci_dev_list);
> > > >> DEFINE_RWLOCK(hci_dev_list_lock);
> > > >> @@ -1077,6 +1080,14 @@ static void hci_cmd_timer(unsigned long arg)
> > > >> tasklet_schedule(&hdev->cmd_task);
> > > >> }
> > > >>
> > > >> +static struct crypto_blkcipher *alloc_cypher(void)
> > > >> +{
> > > >> + if (enable_smp)
> > > >> + return crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
> > > >> +
> > > >> + return ERR_PTR(-ENOTSUPP);
> > > >> +}
> > > >> +
> > > >> /* Register HCI device */
> > > >> int hci_register_dev(struct hci_dev *hdev)
> > > >> {
> > > >> @@ -1155,6 +1166,11 @@ int hci_register_dev(struct hci_dev *hdev)
> > > >> if (!hdev->workqueue)
> > > >> goto nomem;
> > > >>
> > > >> + hdev->tfm = alloc_cypher();
> > > >> + if (IS_ERR(hdev->tfm))
> > > >> + BT_INFO("Failed to load transform for ecb(aes): %ld",
> > > >> + PTR_ERR(hdev->tfm));
> > > >> +
> > > >> hci_register_sysfs(hdev);
> > > >>
> > > >> hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
> > > >> @@ -1203,6 +1219,9 @@ int hci_unregister_dev(struct hci_dev *hdev)
> > > >> !test_bit(HCI_SETUP, &hdev->flags))
> > > >> mgmt_index_removed(hdev->id);
> > > >>
> > > >> + if (!IS_ERR(hdev->tfm))
> > > >> + crypto_free_blkcipher(hdev->tfm);
> > > >> +
> > > >> hci_notify(hdev, HCI_DEV_UNREG);
> > > >>
> > > >> if (hdev->rfkill) {
> > > >> @@ -2037,3 +2056,6 @@ static void hci_cmd_task(unsigned long arg)
> > > >> }
> > > >> }
> > > >> }
> > > >> +
> > > >> +module_param(enable_smp, bool, 0644);
> > > >> +MODULE_PARM_DESC(enable_smp, "Enable SMP support (LE only)");
> > > >
> > > > This all should be obviously inside smp.c
> > >
> > > I have a couple of points against it:
> > >
> > > 1. it's only used for one purpose, it says whether to try or not to
> > > allocate the block cypher, which is done during the adapter
> > > registration;
> > >
> > > 2. If the current way is ok, it would mean that I would need to export
> > > another method from smp.c, that was something that I tried to
> > > minimize;
> > >
> > > 3. and my weakest argument, seems that there are other similar uses,
> > > for example enable_mgmt.
> >
> > A similar example here is enable_ertm inside l2cap_core.c. It's a L2CAP
> > related option and should reside inside L2CAP code.
> >
> > >
> > > But if you think the code will be clearer moving that to smp.c, will
> > > be glad to change.
> >
> > I don't see the point on have it on hci code. SMP and Block cypher has
> > not much to do with HCI. I prefer it on smp.c
>
> Gustavo and I were talking on IRC and couldn't come to a solution, so
> we ask you for some input.
>
> So, just to give a little more context, the problem is that the crypto
> functions used in SMP depend on the allocation of a block cypher "transform",
> this allocation must happen during user context.
>
> The current solution is that the allocation is done in hci_core.c during the
> adapter registration, but only when the enable_smp module parameter is enabled.
> When the parameter is disabled the allocation method just returns an invalid
> pointer and everything happens the same as if the allocation has failed.
>
> Gustavo has a preference for an ondemand aproach, for example, using a
> workqueue for doing the allocation, and trying the allocation just when SMP is
> going to be used, e.g. when we receive the first SMP message or when some
> security level is activated for that socket.
>
> Any ideas?
Still no ideas?
>
> >
> > --
> > Gustavo F. Padovan
> > http://profusion.mobi
>
>
> Cheers,
> --
> Vinicius
--
Vinicius
^ permalink raw reply
* Re: re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+"
From: Justin P. Mattock @ 2011-03-09 21:23 UTC (permalink / raw)
To: Mikko Vinni
Cc: Johan Hedberg, linux-bluetooth, Ed Tomlinson, Gustavo F. Padovan
In-Reply-To: <359639.21781.qm@web161807.mail.bf1.yahoo.com>
looking more into this issue I am noticing that it seems this might be a
timing issue. I have tried adding msleep to the function but endedup
having a system freeze(only because I am not sure how msleep
works)udelay I have not played around with just yet.
the below patch gets everything working for me:
From 8065e37b546cdf6e42a5de4277e08ebba0a18637 Mon Sep 17 00:00:00 2001
From: Justin P. Mattock <justinmattock@gmail.com>
Date: Tue, 8 Mar 2011 22:01:19 -0800
Subject: [PATCH] bluetooth_bug_fix_test_1
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
---
net/bluetooth/hci_core.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9c4541b..f690eb5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -95,18 +95,17 @@ void hci_req_complete(struct hci_dev *hdev, __u16
cmd, int result)
{
BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);
+ if (hdev->req_status == HCI_REQ_PEND) {
+ hdev->req_result = result;
+ hdev->req_status = HCI_REQ_DONE;
+ wake_up_interruptible(&hdev->req_wait_q);
+ }
/* If the request has set req_last_cmd (typical for multi-HCI
* command requests) check if the completed command matches
* this, and if not just return. Single HCI command requests
* typically leave req_last_cmd as 0 */
if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
return;
-
- if (hdev->req_status == HCI_REQ_PEND) {
- hdev->req_result = result;
- hdev->req_status = HCI_REQ_DONE;
- wake_up_interruptible(&hdev->req_wait_q);
- }
}
static void hci_req_cancel(struct hci_dev *hdev, int err)
--
1.7.4.1
I have done multiple reboots warm/cold and the bluetooth connects
everytime with the above. If this seems to be a good solution let me
know, if its not then maybe udelay/msleep is better(or not!)
Justin P. Mattock
^ permalink raw reply related
* [PATCH 2/2] gatttool: Add Write Without Response option
From: Claudio Takahasi @ 2011-03-09 19:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <1299697431-7670-1-git-send-email-claudio.takahasi@openbossa.org>
Sub-procedure used to write a Characteristic Value to a server when
the client knows the Characteristic Value Handle and the client does
not need acknowledgement.
---
attrib/interactive.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 5fc0af5..d92caa8 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -530,7 +530,7 @@ static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
printf("Characteristic value was written successfully\n");
}
-static void cmd_char_write_req(int argcp, char **argvp)
+static void cmd_char_write(int argcp, char **argvp)
{
uint8_t *value;
size_t plen;
@@ -542,7 +542,7 @@ static void cmd_char_write_req(int argcp, char **argvp)
}
if (argcp < 3) {
- printf("Usage: char-write-req <handle> <new value>\n");
+ printf("Usage: %s <handle> <new value>\n", argvp[0]);
return;
}
@@ -558,7 +558,11 @@ static void cmd_char_write_req(int argcp, char **argvp)
return;
}
- gatt_write_char(attrib, handle, value, plen, char_write_req_cb, NULL);
+ if (g_strcmp0("char-write-req", argvp[0]) == 0)
+ gatt_write_char(attrib, handle, value, plen,
+ char_write_req_cb, NULL);
+ else
+ gatt_write_char(attrib, handle, value, plen, NULL, NULL);
g_free(value);
}
@@ -629,8 +633,10 @@ static struct {
"Characteristics Value/Descriptor Read by handle" },
{ "char-read-uuid", cmd_read_uuid, "<UUID> [start hnd] [end hnd]",
"Characteristics Value/Descriptor Read by UUID" },
- { "char-write-req", cmd_char_write_req, "<handle> <new value>",
+ { "char-write-req", cmd_char_write, "<handle> <new value>",
"Characteristic Value Write (Write Request)" },
+ { "char-write-cmd", cmd_char_write, "<handle> <new value>",
+ "Characteristic Value Write (No response)" },
{ "sec-level", cmd_sec_level, "[low | medium | high]",
"Set security level. Default: low" },
{ NULL, NULL, NULL}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 1/2] Extend Characteristic Write to support Write Without Response
From: Claudio Takahasi @ 2011-03-09 19:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
If callback is not informed, Write Command will be used to execute
a Write Without Response sub-procedure. Error is not returned by the
server no matter the result of the operation.
---
attrib/gatt.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/attrib/gatt.c b/attrib/gatt.c
index ae482f1..2b0d827 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -502,8 +502,12 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
uint8_t pdu[ATT_DEFAULT_LE_MTU];
guint16 plen;
- plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu));
- return g_attrib_send(attrib, 0, ATT_OP_WRITE_REQ, pdu, plen, func,
+ if (func)
+ plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu));
+ else
+ plen = enc_write_cmd(handle, value, vlen, pdu, sizeof(pdu));
+
+ return g_attrib_send(attrib, 0, pdu[0], pdu, plen, func,
user_data, NULL);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH v2] Adjust timeout LE and API
From: Marco Sinigaglia @ 2011-03-09 16:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Marco Sinigaglia
The timeout value has been hardcoded on hci_send_req call and, instead, it should be passed from above (for ex from hci_le_set_scan_enable).
This patch removes the hardcoded value from hci_send_req and it increases the timeout to 1000ms.
v1-->v2: used git-format-patch
Signed-off-by: Marco Sinigaglia <marco.sinigaglia@csr.com>
---
lib/hci.c | 12 ++++++------
lib/hci_lib.h | 6 +++---
tools/hciconfig.c | 2 +-
tools/hcitool.c | 6 +++---
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/hci.c b/lib/hci.c
index 02fc0cf..eb00730 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -2735,7 +2735,7 @@ int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock,
return 0;
}
-int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup)
+int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup, int to)
{
struct hci_request rq;
le_set_scan_enable_cp scan_cp;
@@ -2753,7 +2753,7 @@ int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup)
rq.rparam = &status;
rq.rlen = 1;
- if (hci_send_req(dd, &rq, 100) < 0)
+ if (hci_send_req(dd, &rq, to) < 0)
return -1;
if (status) {
@@ -2766,7 +2766,7 @@ int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup)
int hci_le_set_scan_parameters(int dd, uint8_t type,
uint16_t interval, uint16_t window,
- uint8_t own_type, uint8_t filter)
+ uint8_t own_type, uint8_t filter, int to)
{
struct hci_request rq;
le_set_scan_parameters_cp param_cp;
@@ -2787,7 +2787,7 @@ int hci_le_set_scan_parameters(int dd, uint8_t type,
rq.rparam = &status;
rq.rlen = 1;
- if (hci_send_req(dd, &rq, 100) < 0)
+ if (hci_send_req(dd, &rq, to) < 0)
return -1;
if (status) {
@@ -2798,7 +2798,7 @@ int hci_le_set_scan_parameters(int dd, uint8_t type,
return 0;
}
-int hci_le_set_advertise_enable(int dd, uint8_t enable)
+int hci_le_set_advertise_enable(int dd, uint8_t enable, int to)
{
struct hci_request rq;
le_set_advertise_enable_cp adv_cp;
@@ -2815,7 +2815,7 @@ int hci_le_set_advertise_enable(int dd, uint8_t enable)
rq.rparam = &status;
rq.rlen = 1;
- if (hci_send_req(dd, &rq, 100) < 0)
+ if (hci_send_req(dd, &rq, to) < 0)
return -1;
if (status) {
diff --git a/lib/hci_lib.h b/lib/hci_lib.h
index de3e636..725eb05 100644
--- a/lib/hci_lib.h
+++ b/lib/hci_lib.h
@@ -115,11 +115,11 @@ int hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to);
int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to);
int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to);
-int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup);
+int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup, int to);
int hci_le_set_scan_parameters(int dev_id, uint8_t type, uint16_t interval,
uint16_t window, uint8_t own_type,
- uint8_t filter);
-int hci_le_set_advertise_enable(int dev_id, uint8_t enable);
+ uint8_t filter, int to);
+int hci_le_set_advertise_enable(int dev_id, uint8_t enable, int to);
int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
uint8_t initiator_filter, uint8_t peer_bdaddr_type,
bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type,
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 05a8910..aa6d009 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -268,7 +268,7 @@ static void cmd_le_adv(int ctl, int hdev, char *opt)
rq.rparam = &status;
rq.rlen = 1;
- ret = hci_send_req(dd, &rq, 100);
+ ret = hci_send_req(dd, &rq, 1000);
hci_close_dev(dd);
diff --git a/tools/hcitool.c b/tools/hcitool.c
index e79d76b..05f4df8 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2467,13 +2467,13 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
}
err = hci_le_set_scan_parameters(dd, scan_type, interval, window,
- own_type, 0x00);
+ own_type, 0x00, 1000);
if (err < 0) {
perror("Set scan parameters failed");
exit(1);
}
- err = hci_le_set_scan_enable(dd, 0x01, 0x00);
+ err = hci_le_set_scan_enable(dd, 0x01, 0x00, 1000);
if (err < 0) {
perror("Enable scan failed");
exit(1);
@@ -2487,7 +2487,7 @@ static void cmd_lescan(int dev_id, int argc, char **argv)
exit(1);
}
- err = hci_le_set_scan_enable(dd, 0x00, 0x00);
+ err = hci_le_set_scan_enable(dd, 0x00, 0x00, 1000);
if (err < 0) {
perror("Disable scan failed");
exit(1);
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
^ 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