* [PATCH BlueZ 5/8] unit/test-gobex-transfer: Add /gobex/test_packet_get_req_suspend_resume
From: Luiz Augusto von Dentz @ 2014-02-14 15:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: patrick.ohly
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds a test to call g_obex_suspend and latter g_obex_resume while
SRM is enabled.
---
unit/test-gobex-transfer.c | 81 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 77 insertions(+), 4 deletions(-)
diff --git a/unit/test-gobex-transfer.c b/unit/test-gobex-transfer.c
index 7c9fd43..0d26111 100644
--- a/unit/test-gobex-transfer.c
+++ b/unit/test-gobex-transfer.c
@@ -106,6 +106,9 @@ static guint8 get_req_first_srm_wait[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x27
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0,
G_OBEX_HDR_SRMP, 0x01 };
+static guint8 get_req_srm_wait[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x05,
+ G_OBEX_HDR_SRMP, 0x01 };
+
static guint8 get_req_last[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x03, };
static guint8 get_rsp_first_app[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0x0A,
@@ -124,6 +127,8 @@ static guint8 get_rsp_first_srm_wait_next[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
G_OBEX_HDR_SRMP, 0x02,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+static guint8 get_rsp_srm_wait[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+ 0x00, 0x03 };
static guint8 get_rsp_zero[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0xff,
G_OBEX_HDR_BODY, 0x00, 0xfc };
static guint8 get_rsp_zero_wait_next[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
@@ -191,7 +196,13 @@ static void transfer_complete(GObex *obex, GError *err, gpointer user_data)
static gboolean resume_obex(gpointer user_data)
{
- g_obex_resume(user_data);
+ struct test_data *d = user_data;
+
+ if (!g_main_loop_is_running(d->mainloop))
+ return FALSE;
+
+ g_obex_resume(d->obex);
+
return FALSE;
}
@@ -232,7 +243,7 @@ static gssize provide_eagain(void *buf, gsize len, gpointer user_data)
}
if (d->provide_delay > 0) {
- g_timeout_add(d->provide_delay, resume_obex, d->obex);
+ g_timeout_add(d->provide_delay, resume_obex, d);
d->provide_delay = 0;
return -EAGAIN;
}
@@ -260,7 +271,7 @@ static gssize provide_data(void *buf, gsize len, gpointer user_data)
if (d->provide_delay > 0) {
g_obex_suspend(d->obex);
- g_timeout_add(d->provide_delay, resume_obex, d->obex);
+ g_timeout_add(d->provide_delay, resume_obex, d);
}
d->total += sizeof(body_data);
@@ -852,6 +863,66 @@ static void test_packet_get_req_wait(void)
g_assert_no_error(d.err);
}
+static gboolean rcv_seq_delay(const void *buf, gsize len, gpointer user_data)
+{
+ struct test_data *d = user_data;
+
+ if (d->provide_delay > 0) {
+ g_obex_suspend(d->obex);
+ g_idle_add(resume_obex, d);
+ d->provide_delay = 0;
+ }
+
+ return TRUE;
+}
+
+static void test_packet_get_req_suspend_resume(void)
+{
+ GIOChannel *io;
+ GIOCondition cond;
+ guint io_id, timer_id;
+ GObex *obex;
+ struct test_data d = { 0, NULL, {
+ { get_req_first_srm, sizeof(get_req_first_srm) },
+ { get_req_srm_wait, sizeof(get_req_srm_wait) },
+ { get_req_srm_wait, sizeof(get_req_srm_wait) },
+ { get_req_last, sizeof(get_req_last) } }, {
+ { get_rsp_first_srm, sizeof(get_rsp_first_srm) },
+ { get_rsp_srm_wait, sizeof(get_rsp_srm_wait) },
+ { get_rsp_srm_wait, sizeof(get_rsp_srm_wait) },
+ { get_rsp_last, sizeof(get_rsp_last) } } };
+
+ create_endpoints(&obex, &io, SOCK_SEQPACKET);
+ d.obex = obex;
+ d.provide_delay = 1;
+
+ cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
+ io_id = g_io_add_watch(io, cond, test_io_cb, &d);
+
+ d.mainloop = g_main_loop_new(NULL, FALSE);
+
+ timer_id = g_timeout_add_seconds(1, test_timeout, &d);
+
+ g_obex_get_req(obex, rcv_seq_delay, transfer_complete, &d, &d.err,
+ G_OBEX_HDR_TYPE, hdr_type, sizeof(hdr_type),
+ G_OBEX_HDR_NAME, "file.txt",
+ G_OBEX_HDR_INVALID);
+ g_assert_no_error(d.err);
+
+ g_main_loop_run(d.mainloop);
+
+ g_assert_cmpuint(d.count, ==, 4);
+
+ g_main_loop_unref(d.mainloop);
+
+ g_source_remove(timer_id);
+ g_io_channel_unref(io);
+ g_source_remove(io_id);
+ g_obex_unref(obex);
+
+ g_assert_no_error(d.err);
+}
+
static void test_packet_get_req_wait_next(void)
{
GIOChannel *io;
@@ -1549,7 +1620,7 @@ static gboolean rcv_data_delay(const void *buf, gsize len, gpointer user_data)
if (d->provide_delay > 0) {
g_obex_suspend(d->obex);
- g_timeout_add(d->provide_delay, resume_obex, d->obex);
+ g_timeout_add(d->provide_delay, resume_obex, d);
}
return TRUE;
@@ -2253,6 +2324,8 @@ int main(int argc, char *argv[])
g_test_add_func("/gobex/test_packet_get_req", test_packet_get_req);
g_test_add_func("/gobex/test_packet_get_req_wait",
test_packet_get_req_wait);
+ g_test_add_func("/gobex/test_packet_get_req_suspend_resume",
+ test_packet_get_req_suspend_resume);
g_test_add_func("/gobex/test_packet_get_req_wait_next",
test_packet_get_req_wait_next);
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 4/8] tools/obexctl: Add resume command
From: Luiz Augusto von Dentz @ 2014-02-14 15:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: patrick.ohly
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Add support for resume command which can be used to resume ongoing
transfers.
---
tools/obexctl.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tools/obexctl.c b/tools/obexctl.c
index 000e44d..fc051d7 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -636,6 +636,46 @@ static void cmd_suspend(int argc, char *argv[])
g_dbus_proxy_get_path(proxy));
}
+static void resume_reply(DBusMessage *message, void *user_data)
+{
+ DBusError error;
+
+ dbus_error_init(&error);
+
+ if (dbus_set_error_from_message(&error, message) == TRUE) {
+ rl_printf("Failed to resume: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Resume successful\n");
+}
+
+static void cmd_resume(int argc, char *argv[])
+{
+ GDBusProxy *proxy;
+
+ if (argc < 2) {
+ rl_printf("Missing transfer address argument\n");
+ return;
+ }
+
+ proxy = find_transfer(argv[1]);
+ if (!proxy) {
+ rl_printf("Transfer %s not available\n", argv[1]);
+ return;
+ }
+
+ if (g_dbus_proxy_method_call(proxy, "Resume", NULL, resume_reply,
+ NULL, NULL) == FALSE) {
+ rl_printf("Failed to resume transfer\n");
+ return;
+ }
+
+ rl_printf("Attempting to resume transfer %s\n",
+ g_dbus_proxy_get_path(proxy));
+}
+
static GDBusProxy *find_opp(const char *path)
{
GSList *l;
@@ -1897,6 +1937,7 @@ static const struct {
{ "info", "<object>", cmd_info, "Object information" },
{ "cancel", "<transfer>", cmd_cancel, "Cancel transfer" },
{ "suspend", "<transfer>", cmd_suspend, "Suspend transfer" },
+ { "resume", "<transfer>", cmd_resume, "Resume transfer" },
{ "send", "<file>", cmd_send, "Send file" },
{ "cd", "<path>", cmd_cd, "Change current folder" },
{ "ls", NULL, cmd_ls, "List current folder" },
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 3/8] tools/obexctl: Add suspend command
From: Luiz Augusto von Dentz @ 2014-02-14 15:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: patrick.ohly
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Add support for suspend command which can be used to suspend ongoing
transfers.
---
tools/obexctl.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tools/obexctl.c b/tools/obexctl.c
index f0d5438..000e44d 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -596,6 +596,46 @@ static void cmd_cancel(int argc, char *argv[])
g_dbus_proxy_get_path(proxy));
}
+static void suspend_reply(DBusMessage *message, void *user_data)
+{
+ DBusError error;
+
+ dbus_error_init(&error);
+
+ if (dbus_set_error_from_message(&error, message) == TRUE) {
+ rl_printf("Failed to suspend: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Suspend successful\n");
+}
+
+static void cmd_suspend(int argc, char *argv[])
+{
+ GDBusProxy *proxy;
+
+ if (argc < 2) {
+ rl_printf("Missing transfer address argument\n");
+ return;
+ }
+
+ proxy = find_transfer(argv[1]);
+ if (!proxy) {
+ rl_printf("Transfer %s not available\n", argv[1]);
+ return;
+ }
+
+ if (g_dbus_proxy_method_call(proxy, "Suspend", NULL, suspend_reply,
+ NULL, NULL) == FALSE) {
+ rl_printf("Failed to suspend transfer\n");
+ return;
+ }
+
+ rl_printf("Attempting to suspend transfer %s\n",
+ g_dbus_proxy_get_path(proxy));
+}
+
static GDBusProxy *find_opp(const char *path)
{
GSList *l;
@@ -1856,6 +1896,7 @@ static const struct {
{ "select", "<session>", cmd_select, "Select default session" },
{ "info", "<object>", cmd_info, "Object information" },
{ "cancel", "<transfer>", cmd_cancel, "Cancel transfer" },
+ { "suspend", "<transfer>", cmd_suspend, "Suspend transfer" },
{ "send", "<file>", cmd_send, "Send file" },
{ "cd", "<path>", cmd_cd, "Change current folder" },
{ "ls", NULL, cmd_ls, "List current folder" },
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 2/8] obexd/transfer: Add Transfer.Resume method
From: Luiz Augusto von Dentz @ 2014-02-14 15:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: patrick.ohly
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This method can be used to resume ongoing transfers.
---
obexd/client/transfer.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 813d20b..6295b83 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -223,6 +223,30 @@ static DBusMessage *obc_transfer_suspend(DBusConnection *connection,
return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
}
+static DBusMessage *obc_transfer_resume(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct obc_transfer *transfer = user_data;
+ const char *sender;
+
+ sender = dbus_message_get_sender(message);
+ if (g_strcmp0(transfer->owner, sender) != 0)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".NotAuthorized",
+ "Not Authorized");
+
+ if (transfer->xfer == 0)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".NotInProgress",
+ "Not in progress");
+
+ g_obex_resume(transfer->obex);
+
+ transfer_set_status(transfer, TRANSFER_STATUS_ACTIVE);
+
+ return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
+}
+
static gboolean name_exists(const GDBusPropertyTable *property, void *data)
{
struct obc_transfer *transfer = data;
@@ -339,6 +363,7 @@ static gboolean get_session(const GDBusPropertyTable *property,
static const GDBusMethodTable obc_transfer_methods[] = {
{ GDBUS_METHOD("Suspend", NULL, NULL, obc_transfer_suspend) },
+ { GDBUS_METHOD("Resume", NULL, NULL, obc_transfer_resume) },
{ GDBUS_ASYNC_METHOD("Cancel", NULL, NULL,
obc_transfer_cancel) },
{ }
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 1/8] obexd/transfer: Add Transfer.Suspend method
From: Luiz Augusto von Dentz @ 2014-02-14 15:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: patrick.ohly
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This method can be used to suspend ongoing transfers.
---
obexd/client/transfer.c | 60 ++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 47 insertions(+), 13 deletions(-)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 5a8d4f2..813d20b 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -60,6 +60,7 @@ struct transfer_callback {
enum {
TRANSFER_STATUS_QUEUED = 0,
TRANSFER_STATUS_ACTIVE,
+ TRANSFER_STATUS_SUSPENDED,
TRANSFER_STATUS_COMPLETE,
TRANSFER_STATUS_ERROR
};
@@ -187,6 +188,41 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
return NULL;
}
+static void transfer_set_status(struct obc_transfer *transfer, uint8_t status)
+{
+ if (transfer->status == status)
+ return;
+
+ transfer->status = status;
+
+ g_dbus_emit_property_changed(transfer->conn, transfer->path,
+ TRANSFER_INTERFACE, "Status");
+}
+
+static DBusMessage *obc_transfer_suspend(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct obc_transfer *transfer = user_data;
+ const char *sender;
+
+ sender = dbus_message_get_sender(message);
+ if (g_strcmp0(transfer->owner, sender) != 0)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".NotAuthorized",
+ "Not Authorized");
+
+ if (transfer->xfer == 0)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".NotInProgress",
+ "Not in progress");
+
+ g_obex_suspend(transfer->obex);
+
+ transfer_set_status(transfer, TRANSFER_STATUS_SUSPENDED);
+
+ return g_dbus_create_reply(message, DBUS_TYPE_INVALID);
+}
+
static gboolean name_exists(const GDBusPropertyTable *property, void *data)
{
struct obc_transfer *transfer = data;
@@ -269,6 +305,8 @@ static const char *status2str(uint8_t status)
return "queued";
case TRANSFER_STATUS_ACTIVE:
return "active";
+ case TRANSFER_STATUS_SUSPENDED:
+ return "suspended";
case TRANSFER_STATUS_COMPLETE:
return "complete";
case TRANSFER_STATUS_ERROR:
@@ -300,6 +338,7 @@ static gboolean get_session(const GDBusPropertyTable *property,
}
static const GDBusMethodTable obc_transfer_methods[] = {
+ { GDBUS_METHOD("Suspend", NULL, NULL, obc_transfer_suspend) },
{ GDBUS_ASYNC_METHOD("Cancel", NULL, NULL,
obc_transfer_cancel) },
{ }
@@ -549,14 +588,6 @@ static gboolean get_xfer_progress(const void *buf, gsize len,
return TRUE;
}
-static void transfer_set_status(struct obc_transfer *transfer, uint8_t status)
-{
- transfer->status = status;
-
- g_dbus_emit_property_changed(transfer->conn, transfer->path,
- TRANSFER_INTERFACE, "Status");
-}
-
static void xfer_complete(GObex *obex, GError *err, gpointer user_data)
{
struct obc_transfer *transfer = user_data;
@@ -634,13 +665,15 @@ static void get_xfer_progress_first(GObex *obex, GError *err, GObexPacket *rsp,
return;
}
- if (!g_obex_srm_active(obex)) {
- req = g_obex_packet_new(G_OBEX_OP_GET, TRUE, G_OBEX_HDR_INVALID);
+ if (g_obex_srm_active(obex) ||
+ transfer->status == TRANSFER_STATUS_SUSPENDED)
+ return;
- transfer->xfer = g_obex_get_req_pkt(obex, req, get_xfer_progress,
+ req = g_obex_packet_new(G_OBEX_OP_GET, TRUE, G_OBEX_HDR_INVALID);
+
+ transfer->xfer = g_obex_get_req_pkt(obex, req, get_xfer_progress,
xfer_complete, transfer,
&err);
- }
}
static gssize put_xfer_progress(void *buf, gsize len, gpointer user_data)
@@ -689,7 +722,8 @@ static gboolean report_progress(gpointer data)
return FALSE;
}
- if (transfer->status != TRANSFER_STATUS_ACTIVE)
+ if (transfer->status != TRANSFER_STATUS_ACTIVE &&
+ transfer->status != TRANSFER_STATUS_SUSPENDED)
transfer_set_status(transfer, TRANSFER_STATUS_ACTIVE);
g_dbus_emit_property_changed(transfer->conn, transfer->path,
--
1.8.5.3
^ permalink raw reply related
* Re: Help in getting BlueZ version - 5.14 running please
From: tony @ 2014-02-14 13:27 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <CABBYNZKTveir=GZ0VjPt=WmpbDUCk9MzVH+R-5cvd=NGS7TxCQ@mail.gmail.com>
Thank you for the information. Yes, my kernel is 3.2. I shall try blueZ
4.101. Hopefully that wont have any dependency on the kernel version?
Thanks,
Tony
On 14/02/14 11:59, Luiz Augusto von Dentz wrote:
>
> On Feb 13, 2014 10:13 PM, "tony" <tony.makkiel@convergeddevices.net
> <mailto:tony.makkiel@convergeddevices.net>> wrote:
> >
> > Hi,
> > I am trying to familiarize with blueZ commands. I can scan
> devices and see HCI commands and events using hcidump. But am having
> some problems which I have been trying to figure out the past two days.
> Any suggestions or pointers will be much appreciated.
> >
> > 1) I found a lot of forums talking about creating connection. But
> couldn't find any which says how to accept connection. I am trying to
> accept an A2DP connection. The peer device is sending an AVDTP Connect
> request but don't know how to make blueZ respond. Can somebody please help?
> >
> > 2) I tried to start bluetooth daemon by running
> >>
> >> ../src/bluetoothd -n -d
> >> bluetoothd[4440]: Bluetooth daemon 5.14
> >> bluetoothd[4440]: Failed to access management interface
> >> bluetoothd[4440]: Adapter handling initialization failed
>
> Looks like you don't have mgmt interface enabled in your kernel,
> probably because it is too old for using with BlueZ 5 which require at
> least 3.4 but nowadays it is probably recommended to use 3.10 or latter.
>
> >
> > The kernel modules I have are
> >
> >> lsmod | grep blue
> >> bluetooth 158447 7 rfcomm,bnep,btusb
> >
> >
> > Should I be running any other command before bluetoothd?
> >
> > 3) I am get problem in getting the python scripts in the test folder.
> > For example when I try to run simple-agent it throws up dbus error as
> below. I tried googling from which I understand some people had the same
> error with 5.13 as well. The dbus version I have is 1.6.4 (I had to
> upgrade from 1.4 to build blueZ)
> >
> >
> >> ./simple-agent hci0 00:1B:DC:07:2E:95
> >> Traceback (most recent call last):
> >> File "./simple-agent", line 158, in <module>
> >> obj = bus.get_object(BUS_NAME, "/org/bluez");
> >> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in
> get_object
> >> follow_name_owner_changes=follow_name_owner_changes)
> >> File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248,
> in __init__
> >> self._named_service = conn.activate_name_owner(bus_name)
> >> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in
> activate_name_owner
> >> self.start_service_by_name(bus_name)
> >> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in
> start_service_by_name
> >> 'su', (bus_name, flags)))
> >> File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line
> 651, in call_blocking
> >> message, timeout)
> >> dbus.exceptions.DBusException:
> org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with
> unknown return code 1
> >
> >
> > Thank you for any suggestions or pointers in advance.
> >
> > Tony
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> linux-bluetooth" in
> > the body of a message to majordomo@vger.kernel.org
> <mailto:majordomo@vger.kernel.org>
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH] bluetooth: Do not free priv until timer handler hasn't actually stopped using it
From: Kirill Tkhai @ 2014-02-14 12:10 UTC (permalink / raw)
To: Michael Knudsen
Cc: linux-bluetooth, Marcel Holtmann, Gustavo Padovan, Johan Hedberg
In-Reply-To: <52FE0582.3010702@samsung.com>
В Птн, 14/02/2014 в 13:01 +0100, Michael Knudsen пишет:
> On 02/14/2014 12:35 PM, Kirill Tkhai wrote:
> > Function del_timer() does not guarantee that timer was really deleted.
> > If the timer handler is beeing executed at the moment, the function
> > just returns. So, it's possible to use already freed memory in the handler:
>
> This is not enough. The timer must be deleted in bcsp_close() before
> hu->priv is set to NULL as the timer code dereferences hu->priv.
>
> There is a similar issue in hci_h5.c where the timer must be stopped
> before purging h5->unack.
>
> -m.
Good, consider my email as reported-by. Please, fix that if you get on
well with bluetooth stack. I am far from it.
Kirill
^ permalink raw reply
* Re: [PATCH] bluetooth: Do not free priv until timer handler hasn't actually stopped using it
From: Michael Knudsen @ 2014-02-14 12:01 UTC (permalink / raw)
To: Kirill Tkhai, linux-bluetooth
Cc: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
In-Reply-To: <1392377748.5384.28.camel@tkhai>
On 02/14/2014 12:35 PM, Kirill Tkhai wrote:
> Function del_timer() does not guarantee that timer was really deleted.
> If the timer handler is beeing executed at the moment, the function
> just returns. So, it's possible to use already freed memory in the handler:
This is not enough. The timer must be deleted in bcsp_close() before
hu->priv is set to NULL as the timer code dereferences hu->priv.
There is a similar issue in hci_h5.c where the timer must be stopped
before purging h5->unack.
-m.
^ permalink raw reply
* [PATCH] bluetooth: Do not free priv until timer handler hasn't actually stopped using it
From: Kirill Tkhai @ 2014-02-14 11:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
Function del_timer() does not guarantee that timer was really deleted.
If the timer handler is beeing executed at the moment, the function
just returns. So, it's possible to use already freed memory in the handler:
[ref: Documentation/DocBook/kernel-locking.tmpl]
This was found using grep and compile-tested only.
Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
CC: Marcel Holtmann <marcel@holtmann.org>
CC: Gustavo Padovan <gustavo@padovan.org>
CC: Johan Hedberg <johan.hedberg@gmail.com>
---
drivers/bluetooth/hci_bcsp.c | 2 +-
drivers/bluetooth/hci_h5.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 0bc87f7..d796a6d 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -722,7 +722,7 @@ static int bcsp_close(struct hci_uart *hu)
skb_queue_purge(&bcsp->unack);
skb_queue_purge(&bcsp->rel);
skb_queue_purge(&bcsp->unrel);
- del_timer(&bcsp->tbcsp);
+ del_timer_sync(&bcsp->tbcsp);
kfree(bcsp);
return 0;
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index f6f4974..9f007f6 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -210,7 +210,7 @@ static int h5_close(struct hci_uart *hu)
skb_queue_purge(&h5->rel);
skb_queue_purge(&h5->unrel);
- del_timer(&h5->timer);
+ del_timer_sync(&h5->timer);
kfree(h5);
^ permalink raw reply related
* Re: [PATCH] android: Fix memory leak: uuid free
From: Szymon Janc @ 2014-02-14 10:36 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1392214927-2715-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wednesday 12 of February 2014 16:22:07 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Free uuid before exiting.
> ---
> android/bluetooth.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 5de3401..b818e88 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1557,6 +1557,8 @@ int bt_adapter_add_record(sdp_record_t *rec, uint8_t svc_hint)
>
> sdp_uuid2strn(uuid, uuid_str, sizeof(uuid_str));
> DBG("UUID %s already added", uuid_str);
> +
> + bt_free(uuid);
> return -EALREADY;
> }
Applied, thanks.
--
Best regards,
Szymon Janc
^ permalink raw reply
* Re: [PATCH BlueZ 01/12] android/hal-ipc-api: Add Remote Features notification
From: Szymon Janc @ 2014-02-14 10:34 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1392304728-5061-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Thursday 13 of February 2014 17:18:37 Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
> android/hal-ipc-api.txt | 14 ++++++++++++--
> android/hal-msg.h | 6 ++++++
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index c1609c9..70f947d 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -1300,8 +1300,18 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
> Valid type values : 0x00 = Interim
> 0x01 = Changed
>
> - Opcode 0x81 - Get Play Status notification
> - Opcode 0x82 - List Player Application Attributes notification
> + Opcode 0x81 - Remote Features notification
> +
> + Notification parameters: Remote address (6 octets)
> + Features (1 octet)
> +
> + Valid features values : 0x00 = None
> + 0x01 = Metadata
> + 0x02 = Absolute Volume
> + 0x03 = Browse
> +
> + Opcode 0x82 - Get Play Status notification
> + Opcode 0x83 - List Player Application Attributes notification
> ...
>
>
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index ca1f6b5..f6cdf58 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -881,3 +881,9 @@ struct hal_cmd_avrcp_register_notification {
> uint8_t len;
> uint8_t data[0];
> } __attribute__((packed));
> +
> +#define HAL_EV_AVRCP_REMOTE_FEATURES 0x81
> +struct hal_ev_avrcp_remote_features {
> + uint8_t bdaddr[6];
> + uint8_t features;
> +} __attribute__((packed));
>
All patches applied, thanks.
--
Best regards,
Szymon Janc
^ permalink raw reply
* [PATCH] btusb.c add IMC Networks id 13d3:3404 (bcm20702A0) - retry
From: Jurgen Kramer @ 2014-02-14 9:32 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 919 bytes --]
>From 343f62050b33972929db749aee296e98332600d6 Mon Sep 17 00:00:00 2001
From: Jurgen Kramer <gtmkramer@xs4all.nl>
Date: Fri, 14 Feb 2014 10:22:51 +0100
Subject: [PATCH] btusb.c add IMC Networks id 13d3:3404 (bcm20702A0)
---
drivers/bluetooth/btusb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3980fd1..5dce16d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -106,6 +106,7 @@ static const struct usb_device_id btusb_table[] = {
{ USB_DEVICE(0x04ca, 0x2003) },
{ USB_DEVICE(0x0489, 0xe042) },
{ USB_DEVICE(0x413c, 0x8197) },
+ { USB_DEVICE(0x13d3, 0x3404) },
/* Foxconn - Hon Hai */
{ USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
--
1.8.5.3
Signed-off-by: Jurgen Kramer <gtm.kramer@xs4all.nl>
Retry. I've included the relevant part of the
requested /sys/kernel/debug/usb/devices output.
Jurgen
[-- Attachment #2: sys-kernel-debug-usb-devices-0x13d3-0x3404.txt --]
[-- Type: text/plain, Size: 1651 bytes --]
T: Bus=01 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3404 Rev= 1.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=240A649F8246
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
^ permalink raw reply related
* Re: [PATCH] android: Fix memory leak: uuid free
From: Andrei Emeltchenko @ 2014-02-14 9:01 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392214927-2715-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
On Wed, Feb 12, 2014 at 04:22:07PM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Free uuid before exiting.
ping
> ---
> android/bluetooth.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 5de3401..b818e88 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1557,6 +1557,8 @@ int bt_adapter_add_record(sdp_record_t *rec, uint8_t svc_hint)
>
> sdp_uuid2strn(uuid, uuid_str, sizeof(uuid_str));
> DBG("UUID %s already added", uuid_str);
> +
> + bt_free(uuid);
> return -EALREADY;
> }
>
> --
> 1.8.3.2
>
> --
> 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
^ permalink raw reply
* Re: [RFCv3] android/avrcp: Decouple AVRCP logic from btio
From: Andrei Emeltchenko @ 2014-02-14 9:00 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392304807-19488-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
On Thu, Feb 13, 2014 at 05:20:07PM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> The patch makes AVRCP to be channel-agnostic so that it might be used in
> unit tests. The idea is that all AVRCP logic would come to avrcp-lib and
> channel stuff got to avrcp.
ping
> ---
> android/Android.mk | 1 +
> android/Makefile.am | 1 +
> android/avrcp-lib.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> android/avrcp-lib.h | 29 ++++++++++++++++++++
> android/avrcp.c | 28 ++++++++++++-------
> 5 files changed, 128 insertions(+), 9 deletions(-)
> create mode 100644 android/avrcp-lib.c
> create mode 100644 android/avrcp-lib.h
>
> diff --git a/android/Android.mk b/android/Android.mk
> index 20602f3..72676e1 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
> bluez/android/avdtp.c \
> bluez/android/a2dp.c \
> bluez/android/avctp.c \
> + bluez/android/avrcp-lib.c \
> bluez/android/avrcp.c \
> bluez/android/pan.c \
> bluez/android/handsfree.c \
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 1913b42..07cc851 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -36,6 +36,7 @@ android_bluetoothd_SOURCES = android/main.c \
> android/avdtp.h android/avdtp.c \
> android/a2dp.h android/a2dp.c \
> android/avctp.h android/avctp.c \
> + android/avrcp-lib.h android/avrcp-lib.c \
> android/avrcp.h android/avrcp.c \
> android/socket.h android/socket.c \
> android/pan.h android/pan.c \
> diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
> new file mode 100644
> index 0000000..b2b1b82
> --- /dev/null
> +++ b/android/avrcp-lib.c
> @@ -0,0 +1,78 @@
> +/*
> + *
> + * BlueZ - Bluetooth protocol stack for Linux
> + *
> + * Copyright (C) 2014 Intel Corporation. All rights reserved.
> + *
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; 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 <stdbool.h>
> +#include <glib.h>
> +
> +#include "lib/bluetooth.h"
> +
> +#include "src/log.h"
> +
> +#include "avctp.h"
> +#include "avrcp-lib.h"
> +
> +struct avrcp {
> + struct avctp *session;
> +};
> +
> +void avrcp_free(void *data)
> +{
> + struct avrcp *session = data;
> +
> + if (session->session)
> + avctp_shutdown(session->session);
> +
> + g_free(session);
> +}
> +
> +struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu,
> + uint16_t version)
> +{
> + struct avrcp *session;
> +
> + session = g_new0(struct avrcp, 1);
> +
> + session->session = avctp_new(fd, imtu, omtu, version);
> + if (!session->session) {
> + g_free(session);
> + return NULL;
> + }
> +
> + return session;
> +}
> +
> +void avrcp_set_destroy_cb(struct avrcp *session, avctp_destroy_cb_t cb,
> + void *user_data)
> +{
> + avctp_set_destroy_cb(session->session, cb, user_data);
> +}
> +
> +int avrcp_init_uinput(struct avrcp *session, const char *name,
> + const char *address)
> +{
> + return avctp_init_uinput(session->session, name, address);
> +}
> diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
> new file mode 100644
> index 0000000..8490722
> --- /dev/null
> +++ b/android/avrcp-lib.h
> @@ -0,0 +1,29 @@
> +/*
> + *
> + * BlueZ - Bluetooth protocol stack for Linux
> + *
> + * Copyright (C) 2014 Intel Corporation. All rights reserved.
> + *
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + */
> +
> +struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
> +void avrcp_free(void *data);
> +void avrcp_set_destroy_cb(struct avrcp *session, avctp_destroy_cb_t cb,
> + void *user_data);
> +int avrcp_init_uinput(struct avrcp *session, const char *name,
> + const char *address);
> diff --git a/android/avrcp.c b/android/avrcp.c
> index b8304f5..a2bb1df 100644
> --- a/android/avrcp.c
> +++ b/android/avrcp.c
> @@ -38,6 +38,7 @@
> #include "hal-msg.h"
> #include "ipc.h"
> #include "avctp.h"
> +#include "avrcp-lib.h"
>
> #define L2CAP_PSM_AVCTP 0x17
>
> @@ -53,7 +54,7 @@ static GIOChannel *server = NULL;
>
> struct avrcp_device {
> bdaddr_t dst;
> - struct avctp *session;
> + struct avrcp *session;
> GIOChannel *io;
> };
>
> @@ -133,7 +134,7 @@ static void avrcp_device_free(void *data)
> struct avrcp_device *dev = data;
>
> if (dev->session)
> - avctp_shutdown(dev->session);
> + avrcp_free(dev->session);
>
> if (dev->io) {
> g_io_channel_shutdown(dev->io, FALSE, NULL);
> @@ -168,6 +169,17 @@ static int device_cmp(gconstpointer s, gconstpointer user_data)
> return bacmp(&dev->dst, dst);
> }
>
> +static struct avrcp_device *avrcp_find(const bdaddr_t *dst)
> +{
> + GSList *l;
> +
> + l = g_slist_find_custom(devices, dst, device_cmp);
> + if (!l)
> + return NULL;
> +
> + return l->data;
> +}
> +
> static void disconnect_cb(void *data)
> {
> struct avrcp_device *dev = data;
> @@ -222,17 +234,17 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
> }
>
> fd = g_io_channel_unix_get_fd(chan);
> - dev->session = avctp_new(fd, imtu, omtu, 0x0100);
>
> + dev->session = avrcp_new(fd, imtu, omtu, 0x0100);
> if (!dev->session) {
> avrcp_device_free(dev);
> return;
> }
>
> - avctp_set_destroy_cb(dev->session, disconnect_cb, dev);
> + avrcp_set_destroy_cb(dev->session, disconnect_cb, dev);
>
> /* FIXME: get the real name of the device */
> - avctp_init_uinput(dev->session, "bluetooth", address);
> + avrcp_init_uinput(dev->session, "bluetooth", address);
>
> g_io_channel_set_close_on_unref(chan, FALSE);
>
> @@ -331,12 +343,10 @@ void bt_avrcp_connect(const bdaddr_t *dst)
> {
> struct avrcp_device *dev;
> char addr[18];
> - GSList *l;
>
> DBG("");
>
> - l = g_slist_find_custom(devices, dst, device_cmp);
> - if (l)
> + if (avrcp_find(dst))
> return;
>
> dev = avrcp_device_new(dst);
> @@ -363,7 +373,7 @@ void bt_avrcp_disconnect(const bdaddr_t *dst)
> dev = l->data;
>
> if (dev->session) {
> - avctp_shutdown(dev->session);
> + avrcp_free(dev->session);
> return;
> }
>
> --
> 1.8.3.2
>
> --
> 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
^ permalink raw reply
* [PATCH] Bluetooth: Officially enable LE CoC support
From: johan.hedberg @ 2014-02-14 5:40 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
Now that the LE Connection oriented Channel support has undergone a
decent amount of testing we can make it officially supported. This patch
removes the enable_lecoc debugfs switch which was previously needed to
enable support for LE CoC.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/l2cap_core.c | 11 -----------
net/bluetooth/l2cap_sock.c | 29 -----------------------------
2 files changed, 40 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 66fbac91eaed..6e6b3a9c8e6d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5544,17 +5544,6 @@ static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn,
{
int err = 0;
- if (!enable_lecoc) {
- switch (cmd->code) {
- case L2CAP_LE_CONN_REQ:
- case L2CAP_LE_CONN_RSP:
- case L2CAP_LE_CREDITS:
- case L2CAP_DISCONN_REQ:
- case L2CAP_DISCONN_RSP:
- return -EINVAL;
- }
- }
-
switch (cmd->code) {
case L2CAP_COMMAND_REJ:
l2cap_le_command_rej(conn, cmd, cmd_len, data);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 27d3d6d48b6e..b247f9d27fed 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -36,8 +36,6 @@
#include "smp.h"
-bool enable_lecoc;
-
static struct bt_sock_list l2cap_sk_list = {
.lock = __RW_LOCK_UNLOCKED(l2cap_sk_list.lock)
};
@@ -111,8 +109,6 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
}
if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
- if (!enable_lecoc && la.l2_psm)
- return -EINVAL;
/* We only allow ATT user space socket */
if (la.l2_cid &&
la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
@@ -229,8 +225,6 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
return -EINVAL;
if (bdaddr_type_is_le(la.l2_bdaddr_type)) {
- if (!enable_lecoc && la.l2_psm)
- return -EINVAL;
/* We only allow ATT user space socket */
if (la.l2_cid &&
la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
@@ -578,11 +572,6 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
break;
case BT_SNDMTU:
- if (!enable_lecoc) {
- err = -EPROTONOSUPPORT;
- break;
- }
-
if (!bdaddr_type_is_le(chan->src_type)) {
err = -EINVAL;
break;
@@ -598,11 +587,6 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
break;
case BT_RCVMTU:
- if (!enable_lecoc) {
- err = -EPROTONOSUPPORT;
- break;
- }
-
if (!bdaddr_type_is_le(chan->src_type)) {
err = -EINVAL;
break;
@@ -919,11 +903,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
break;
case BT_SNDMTU:
- if (!enable_lecoc) {
- err = -EPROTONOSUPPORT;
- break;
- }
-
if (!bdaddr_type_is_le(chan->src_type)) {
err = -EINVAL;
break;
@@ -936,11 +915,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
break;
case BT_RCVMTU:
- if (!enable_lecoc) {
- err = -EPROTONOSUPPORT;
- break;
- }
-
if (!bdaddr_type_is_le(chan->src_type)) {
err = -EINVAL;
break;
@@ -1643,6 +1617,3 @@ void l2cap_cleanup_sockets(void)
bt_sock_unregister(BTPROTO_L2CAP);
proto_unregister(&l2cap_proto);
}
-
-module_param(enable_lecoc, bool, 0644);
-MODULE_PARM_DESC(enable_lecoc, "Enable support for LE CoC");
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCH 00/24] rfcomm fixes
From: Alexander Holler @ 2014-02-13 21:48 UTC (permalink / raw)
To: Peter Hurley, Marcel Holtmann
Cc: Gustavo F. Padovan, Johan Hedberg, Gianluca Anzolin,
Andrey Vihrov, Sander Eikelenboom,
bluez mailin list (linux-bluetooth@vger.kernel.org), linux-kernel
In-Reply-To: <52FC13F0.8040809@hurleysoftware.com>
Am 13.02.2014 01:38, schrieb Peter Hurley:
> Hi Marcel,
>
> On 02/12/2014 05:58 PM, Marcel Holtmann wrote:
>> we might also want to add some end-to-end test cases to rfcomm-tester
>> that covers this behavior.
Sounds great. Such would have found the problem with disappearing remote
bt (rfcomm) devices since 3.8 likely earlier than I did (which was
around 3.10 if I remember correctly).
Regards,
Alexander Holler
^ permalink raw reply
* Re: [PATCH 00/24] rfcomm fixes
From: Alexander Holler @ 2014-02-13 21:41 UTC (permalink / raw)
To: Peter Hurley, Marcel Holtmann
Cc: Gustavo Padovan, Johan Hedberg, Gianluca Anzolin, Andrey Vihrov,
Sander Eikelenboom, linux-bluetooth, linux-kernel
In-Reply-To: <1391997564-1805-1-git-send-email-peter@hurleysoftware.com>
Am 10.02.2014 02:59, schrieb Peter Hurley:
> Marcel,
>
> This patch series addresses a number of previously unknown issues
> with the RFCOMM tty device implementation, in addition to
> addressing the locking regression recently reported [1].
>
> As Gianluca suggested and I agree, this series first reverts
> 3 of the 4 patches of 3.14-rc1 for bluetooth/rfcomm/tty.c.
Oh, looks like you've spend quiet some time to fix rfcomm.
Thanks a lot for that!
I've just tested this series on top of 3.13.2 where I already have
Gianluca 4 patches applied. Test machines were one AMD (x86_64) (bluez
4.x) and one ARM(v5) (bluez 5.x) box and I could not find any problems
during my short tests (disconnecting/turning of both local and remote
and reconnecting).
I haven't had any debug options turned on and haven't looked at the
patches at all, but maybe this is already enough to add a
Tested-By: Alexander Holler <holler@ahsoftware.de>
So feel free to add that if someone thinks it makes sense based on my
short test description above and it isn't already too late.
Thanks again,
Alexander Holler
^ permalink raw reply
* Re: [PATCH] adapter: Handle MGMT_SETTING_LE change
From: Petri Gynther @ 2014-02-13 20:45 UTC (permalink / raw)
To: Johan Hedberg, linux-bluetooth
In-Reply-To: <20140213124134.GA13866@x220.p-661hnu-f1>
Hi Johan,
On Thu, Feb 13, 2014 at 4:41 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Petri,
>
> On Wed, Feb 12, 2014, Petri Gynther wrote:
>> On some BLE-capable adapters, BLE is not enabled by default. When BLE is
>> enabled after the adapter is already powered up, we need to call
>> trigger_passive_scanning() so that paired BLE devices (e.g. HoG devices)
>> are able to reconnect back to host.
>
> No dual-mode adapter should have LE enabled by default and we do have
> the following piece of code that gets run for any newly discovered
> adapter:
>
> if ((adapter->supported_settings & MGMT_SETTING_LE) &&
> !(adapter->current_settings & MGMT_SETTING_LE))
> set_mode(adapter, MGMT_OP_SET_LE, 0x01);
>
> So the commit message is a bit confusing to me. How exactly do you end
> up reproducing this scenario? I could imagine this maybe happening if
> bluetoothd crashes and gets restarted when the adapter state is already
> powered on. Either way you should explain this in the commit message.
>
I have two boards with two different dual-mode adapters that exhibit
this behavior at every boot.
The init sequence is:
1. /etc/init.d/S09drivers
modprobe all BlueZ kernel drivers
2. /etc/init.d/S31bluez
hciconfig hci0 reset
hciconfig hci0 up
bdaddr -i hci0 <new BD address for adapter>
hciconfig hci0 reset
hciconfig hci0 up
...
bluetoothd -n -d 2>&1 | <log-collector> &
...
bluez-agent 2>&1 | <log-collector> &
So, bluetoothd starts with hci0 already up. With this init sequence,
bluetoothd log always shows BLE getting enabled (setting 0x200)
*after* the adapter is already powered up (setting 0x1). So, it is
necessary to call trigger_passive_scanning() at that point, since it
didn't get called at adapter_start() when BLE wasn't yet enabled.
bluetoothd[917]: src/adapter.c:adapter_register() Adapter
/org/bluez/hci0 registered
bluetoothd[917]: src/adapter.c:set_dev_class() sending set device
class command for index 0
bluetoothd[917]: src/adapter.c:set_name() sending set local name
command for index 0
bluetoothd[917]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[917]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[917]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[917]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[917]: src/adapter.c:adapter_start() adapter /org/bluez/hci0
has been enabled
bluetoothd[917]: src/adapter.c:load_link_keys_complete() link keys
loaded for hci0
bluetoothd[917]: src/adapter.c:load_ltks_complete() LTKs loaded for hci0
bluetoothd[917]: src/adapter.c:get_connections_complete() Connection count: 0
bluetoothd[917]: src/adapter.c:local_name_changed_callback() Name: system-name
bluetoothd[917]: src/adapter.c:local_name_changed_callback() Short name:
bluetoothd[917]: src/adapter.c:local_name_changed_callback() Current
alias: system-name
bluetoothd[917]: src/attrib-server.c:attrib_db_update() handle=0x0006
bluetoothd[917]: src/adapter.c:new_settings_callback() Settings: 0x000000c1
bluetoothd[917]: src/adapter.c:settings_changed() Changed settings: 0x00000040
bluetoothd[917]: src/adapter.c:new_settings_callback() Settings:
0x000002c1 <=== MGMT_SETTING_LE=1
bluetoothd[917]: src/adapter.c:settings_changed() Changed settings: 0x00000200
===> need to call trigger_passive_scanning() here
bluetoothd[917]: src/adapter.c:new_settings_callback() Settings: 0x000002d1
bluetoothd[917]: src/adapter.c:settings_changed() Changed settings: 0x00000010
bluetoothd[917]: src/adapter.c:new_settings_callback() Settings: 0x000002d3
bluetoothd[917]: src/adapter.c:settings_changed() Changed settings: 0x00000002
>> --- a/src/adapter.c
>> +++ b/src/adapter.c
>> @@ -405,6 +405,7 @@ static void store_adapter_info(struct btd_adapter *adapter)
>> static void trigger_pairable_timeout(struct btd_adapter *adapter);
>> static void adapter_start(struct btd_adapter *adapter);
>> static void adapter_stop(struct btd_adapter *adapter);
>> +static void trigger_passive_scanning(struct btd_adapter *adapter);
>
> Since we try to avoid forward declarations like this whenever possible, did you
> investigate what would be needed to not need it here. I.e. is it really
> a lot of dependent functions that would need to be moved further up
> together with trigger_passive_scanning() or is there even a circular
> dependency somewhere that makes the forward declaration inevitable?
>
I'll investigate this.
>> + if (changed_mask & MGMT_SETTING_LE) {
>> + if ((adapter->current_settings & MGMT_SETTING_POWERED) &&
>> + (adapter->current_settings & MGMT_SETTING_LE)) {
>> + trigger_passive_scanning(adapter);
>> + }
>> + }
>
> The { } isn't needed for the internal if-statement.
I'll fix this.
>
> Johan
^ permalink raw reply
* Help in getting BlueZ version - 5.14 running please
From: tony @ 2014-02-13 19:43 UTC (permalink / raw)
To: linux-bluetooth
Hi,
I am trying to familiarize with blueZ commands. I can scan
devices and see HCI commands and events using hcidump. But am having
some problems which I have been trying to figure out the past two days.
Any suggestions or pointers will be much appreciated.
1) I found a lot of forums talking about creating connection. But
couldn't find any which says how to accept connection. I am trying to
accept an A2DP connection. The peer device is sending an AVDTP Connect
request but don't know how to make blueZ respond. Can somebody please help?
2) I tried to start bluetooth daemon by running
> ../src/bluetoothd -n -d
> bluetoothd[4440]: Bluetooth daemon 5.14
> bluetoothd[4440]: Failed to access management interface
> bluetoothd[4440]: Adapter handling initialization failed
The kernel modules I have are
> lsmod | grep blue
> bluetooth 158447 7 rfcomm,bnep,btusb
Should I be running any other command before bluetoothd?
3) I am get problem in getting the python scripts in the test folder.
For example when I try to run simple-agent it throws up dbus error as
below. I tried googling from which I understand some people had the same
error with 5.13 as well. The dbus version I have is 1.6.4 (I had to
upgrade from 1.4 to build blueZ)
> ./simple-agent hci0 00:1B:DC:07:2E:95
> Traceback (most recent call last):
> File "./simple-agent", line 158, in <module>
> obj = bus.get_object(BUS_NAME, "/org/bluez");
> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
> follow_name_owner_changes=follow_name_owner_changes)
> File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
> self._named_service = conn.activate_name_owner(bus_name)
> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
> self.start_service_by_name(bus_name)
> File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
> 'su', (bus_name, flags)))
> File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
> message, timeout)
> dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
Thank you for any suggestions or pointers in advance.
Tony
^ permalink raw reply
* Re: [PATCH 04/24] tty: Fix ref counting for port krefs
From: Greg Kroah-Hartman @ 2014-02-13 18:36 UTC (permalink / raw)
To: Peter Hurley
Cc: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, Gianluca Anzolin,
Alexander Holler, Andrey Vihrov, Sander Eikelenboom,
linux-bluetooth, linux-kernel, Jiri Slaby
In-Reply-To: <1391997564-1805-5-git-send-email-peter@hurleysoftware.com>
On Sun, Feb 09, 2014 at 08:59:04PM -0500, Peter Hurley wrote:
> The tty core supports two models for handling tty_port lifetimes;
> the tty_port can use the kref supplied by tty_port (which will
> automatically destruct the tty_port when the ref count drops to
> zero) or it can destruct the tty_port manually.
>
> For tty drivers that choose to use the port kref to manage the
> tty_port lifetime, it is not possible to safely acquire a port
> reference conditionally. If the last reference is released after
> evaluating the condition but before acquiring the reference, a
> bogus reference will be held while the tty_port destruction
> commences.
>
> Rather, only acquire a port reference if the ref count is non-zero
> and allow the caller to distinguish if a reference has successfully
> been acquired.
>
> Cc: Jiri Slaby <jslaby@suse.cz>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Add hci_h4p driver
From: Pali Rohár @ 2014-02-13 15:33 UTC (permalink / raw)
To: Pavel Machek, Marcel Holtmann, Sebastian Reichel
Cc: Ивайло Димитров,
Gustavo F. Padovan, Johan Hedberg, linux-kernel,
linux-bluetooth@vger.kernel.org development
In-Reply-To: <201401082236.25135@pali>
2014-01-08 22:36 GMT+01:00 Pali Roh=C3=A1r <pali.rohar@gmail.com>:
> On Monday 30 December 2013 15:52:51 Sebastian Reichel wrote:
>> > > > +MODULE_DESCRIPTION("Bluetooth h4 driver with nokia
>> > > > extensions"); +MODULE_LICENSE("GPL");
>> > > > +MODULE_AUTHOR("Ville Tervo");
>> > > > +MODULE_FIRMWARE(FW_NAME_TI1271_PRELE);
>> > > > +MODULE_FIRMWARE(FW_NAME_TI1271_LE);
>> > > > +MODULE_FIRMWARE(FW_NAME_TI1271);
>> > > > +MODULE_FIRMWARE(FW_NAME_BCM2048);
>> > > > +MODULE_FIRMWARE(FW_NAME_CSR);
>> > >
>> > > Do we actually have all these firmware files still
>> > > available. If not, then focus on the ones we have.
>> >
>> > Firmware files are available for download from nemo project:
>> >
>> > https://api.merproject.org/public/source/nemo:devel:hw:ti:om
>> > ap3:n900/bcm-bt-firmware/bcm-bt-firmware-0.21rc3.tar.bz2
>> > https://api.merproject.org/public/source/nemo:devel:hw:ti:o
>> > map3:n950-n9/ti-wl1273-bt-firmware/bt-firmware-ti1273_0.23+0
>> > m6.tar.gz
>>
>> Would be nice to have them added to the linux-firmware.git.
>>
>> -- Sebastian
>
> Can somebody send firmware files for inclusion to linux-firmware?
>
> --
> Pali Roh=C3=A1r
> pali.rohar@gmail.com
Now when driver is queued for staging, can somebody add firmware files
to linux-firmware repository? Note that without firmware files, driver
not working...
--=20
Pali Roh=C3=A1r
pali.rohar@gmail.com
^ permalink raw reply
* [RFCv3] android/avrcp: Decouple AVRCP logic from btio
From: Andrei Emeltchenko @ 2014-02-13 15:20 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The patch makes AVRCP to be channel-agnostic so that it might be used in
unit tests. The idea is that all AVRCP logic would come to avrcp-lib and
channel stuff got to avrcp.
---
android/Android.mk | 1 +
android/Makefile.am | 1 +
android/avrcp-lib.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
android/avrcp-lib.h | 29 ++++++++++++++++++++
android/avrcp.c | 28 ++++++++++++-------
5 files changed, 128 insertions(+), 9 deletions(-)
create mode 100644 android/avrcp-lib.c
create mode 100644 android/avrcp-lib.h
diff --git a/android/Android.mk b/android/Android.mk
index 20602f3..72676e1 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
bluez/android/avdtp.c \
bluez/android/a2dp.c \
bluez/android/avctp.c \
+ bluez/android/avrcp-lib.c \
bluez/android/avrcp.c \
bluez/android/pan.c \
bluez/android/handsfree.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index 1913b42..07cc851 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -36,6 +36,7 @@ android_bluetoothd_SOURCES = android/main.c \
android/avdtp.h android/avdtp.c \
android/a2dp.h android/a2dp.c \
android/avctp.h android/avctp.c \
+ android/avrcp-lib.h android/avrcp-lib.c \
android/avrcp.h android/avrcp.c \
android/socket.h android/socket.c \
android/pan.h android/pan.c \
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
new file mode 100644
index 0000000..b2b1b82
--- /dev/null
+++ b/android/avrcp-lib.c
@@ -0,0 +1,78 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; 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 <stdbool.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+
+#include "src/log.h"
+
+#include "avctp.h"
+#include "avrcp-lib.h"
+
+struct avrcp {
+ struct avctp *session;
+};
+
+void avrcp_free(void *data)
+{
+ struct avrcp *session = data;
+
+ if (session->session)
+ avctp_shutdown(session->session);
+
+ g_free(session);
+}
+
+struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu,
+ uint16_t version)
+{
+ struct avrcp *session;
+
+ session = g_new0(struct avrcp, 1);
+
+ session->session = avctp_new(fd, imtu, omtu, version);
+ if (!session->session) {
+ g_free(session);
+ return NULL;
+ }
+
+ return session;
+}
+
+void avrcp_set_destroy_cb(struct avrcp *session, avctp_destroy_cb_t cb,
+ void *user_data)
+{
+ avctp_set_destroy_cb(session->session, cb, user_data);
+}
+
+int avrcp_init_uinput(struct avrcp *session, const char *name,
+ const char *address)
+{
+ return avctp_init_uinput(session->session, name, address);
+}
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
new file mode 100644
index 0000000..8490722
--- /dev/null
+++ b/android/avrcp-lib.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
+void avrcp_free(void *data);
+void avrcp_set_destroy_cb(struct avrcp *session, avctp_destroy_cb_t cb,
+ void *user_data);
+int avrcp_init_uinput(struct avrcp *session, const char *name,
+ const char *address);
diff --git a/android/avrcp.c b/android/avrcp.c
index b8304f5..a2bb1df 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -38,6 +38,7 @@
#include "hal-msg.h"
#include "ipc.h"
#include "avctp.h"
+#include "avrcp-lib.h"
#define L2CAP_PSM_AVCTP 0x17
@@ -53,7 +54,7 @@ static GIOChannel *server = NULL;
struct avrcp_device {
bdaddr_t dst;
- struct avctp *session;
+ struct avrcp *session;
GIOChannel *io;
};
@@ -133,7 +134,7 @@ static void avrcp_device_free(void *data)
struct avrcp_device *dev = data;
if (dev->session)
- avctp_shutdown(dev->session);
+ avrcp_free(dev->session);
if (dev->io) {
g_io_channel_shutdown(dev->io, FALSE, NULL);
@@ -168,6 +169,17 @@ static int device_cmp(gconstpointer s, gconstpointer user_data)
return bacmp(&dev->dst, dst);
}
+static struct avrcp_device *avrcp_find(const bdaddr_t *dst)
+{
+ GSList *l;
+
+ l = g_slist_find_custom(devices, dst, device_cmp);
+ if (!l)
+ return NULL;
+
+ return l->data;
+}
+
static void disconnect_cb(void *data)
{
struct avrcp_device *dev = data;
@@ -222,17 +234,17 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
}
fd = g_io_channel_unix_get_fd(chan);
- dev->session = avctp_new(fd, imtu, omtu, 0x0100);
+ dev->session = avrcp_new(fd, imtu, omtu, 0x0100);
if (!dev->session) {
avrcp_device_free(dev);
return;
}
- avctp_set_destroy_cb(dev->session, disconnect_cb, dev);
+ avrcp_set_destroy_cb(dev->session, disconnect_cb, dev);
/* FIXME: get the real name of the device */
- avctp_init_uinput(dev->session, "bluetooth", address);
+ avrcp_init_uinput(dev->session, "bluetooth", address);
g_io_channel_set_close_on_unref(chan, FALSE);
@@ -331,12 +343,10 @@ void bt_avrcp_connect(const bdaddr_t *dst)
{
struct avrcp_device *dev;
char addr[18];
- GSList *l;
DBG("");
- l = g_slist_find_custom(devices, dst, device_cmp);
- if (l)
+ if (avrcp_find(dst))
return;
dev = avrcp_device_new(dst);
@@ -363,7 +373,7 @@ void bt_avrcp_disconnect(const bdaddr_t *dst)
dev = l->data;
if (dev->session) {
- avctp_shutdown(dev->session);
+ avrcp_free(dev->session);
return;
}
--
1.8.3.2
^ permalink raw reply related
* [PATCH BlueZ 12/12] android/hal-ipc-api: Add Passthrough Command notification
From: Luiz Augusto von Dentz @ 2014-02-13 15:18 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392304728-5061-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 5 +++++
android/hal-msg.h | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 99ecede..ee3bd76 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1380,6 +1380,11 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid type values: Same as in Register Notification
+ Opcode 0x8c - Passthrough Command notification
+
+ Notification parameters: ID (1 octet)
+ State (1 octet)
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 0561894..6504408 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -938,3 +938,9 @@ struct hal_ev_avrcp_volume_changed {
uint8_t volume;
uint8_t type;
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_PASSTHROUGH_CMD 0x8c
+struct hal_ev_avrcp_passthrough_cmd {
+ uint8_t id;
+ uint8_t state;
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 11/12] android/hal-ipc-api: Add Volume Changed notification
From: Luiz Augusto von Dentz @ 2014-02-13 15:18 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392304728-5061-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 7 +++++++
android/hal-msg.h | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 535e880..99ecede 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1373,6 +1373,13 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid event values: Same as in Register Notification
+ Opcode 0x8b - Volume Changed notification
+
+ Notification parameters: Volume (1 octet)
+ Type (1 octet)
+
+ Valid type values: Same as in Register Notification
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index a7df71a..0561894 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -932,3 +932,9 @@ struct hal_ev_avrcp_register_notification {
uint8_t event;
uint32_t param;
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_VOLUME_CHANGED 0x8b
+struct hal_ev_avrcp_volume_changed {
+ uint8_t volume;
+ uint8_t type;
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 10/12] android/hal-ipc-api: Add Register Notification notification
From: Luiz Augusto von Dentz @ 2014-02-13 15:18 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392304728-5061-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 7 +++++++
android/hal-msg.h | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index f2427e1..535e880 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1366,6 +1366,13 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in Get Element Attribute
+ Opcode 0x8a - Register Notification notification
+
+ Notification parameters: Event (1 octet)
+ Parameter (4 octets)
+
+ Valid event values: Same as in Register Notification
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9bc2d2a..a7df71a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -926,3 +926,9 @@ struct hal_ev_avrcp_get_element_attrs {
uint8_t number;
uint8_t attrs[0];
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_REGISTER_NOTIFICATION 0x8a
+struct hal_ev_avrcp_register_notification {
+ uint8_t event;
+ uint32_t param;
+} __attribute__((packed));
--
1.8.5.3
^ 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