* 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
* [PATCH BlueZ 09/12] android/hal-ipc-api: Add Get Element Attributes 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 | 8 ++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 3f7d017..f2427e1 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1358,6 +1358,14 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in List Player Attributes
+ Opcode 0x89 - Get Element Attributes notification
+
+ Notification parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ ...
+
+ Valid attribute values: Same as in Get Element Attribute
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index fd4b522..9bc2d2a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -920,3 +920,9 @@ struct hal_ev_avrcp_set_player_values {
uint8_t number;
struct hal_avrcp_player_attr_value attrs[0];
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_GET_ELEMENT_ATTRS 0x89
+struct hal_ev_avrcp_get_element_attrs {
+ uint8_t number;
+ uint8_t attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 08/12] android/hal-ipc-api: Add Set Player Values 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 | 9 +++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 15 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 362cdf4..3f7d017 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1349,6 +1349,15 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in List Player Attributes
+ Opcode 0x88 - Set Player Values notification
+
+ Notification parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ Value # (1 octet)
+ ...
+
+ Valid attribute values: Same as in List Player Attributes
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 188e7c2..fd4b522 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -914,3 +914,9 @@ struct hal_ev_avrcp_get_player_values_text {
uint8_t number;
uint8_t values[0];
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_SET_PLAYER_VALUES 0x88
+struct hal_ev_avrcp_set_player_values {
+ uint8_t number;
+ struct hal_avrcp_player_attr_value attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 07/12] android/hal-ipc-api: Add Get Player Values Text 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 | 9 +++++++++
android/hal-msg.h | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 0810078..362cdf4 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1340,6 +1340,15 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in List Player Attributes
+ Opcode 0x87 - Get Player Values Text notification
+
+ Notification parameters: Attribute (1 octet)
+ Number of values (1 octet)
+ Value # (1 octet)
+ ...
+
+ Valid attribute values: Same as in List Player Attributes
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 67fccb9..188e7c2 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -907,3 +907,10 @@ struct hal_ev_avrcp_get_player_attrs_text {
uint8_t number;
uint8_t attrs[0];
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_GET_PLAYER_VALUES_TEXT 0x87
+struct hal_ev_avrcp_get_player_values_text {
+ uint8_t attr;
+ uint8_t number;
+ uint8_t values[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 06/12] android/hal-ipc-api: Add Get Player Attributes Text 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 | 8 ++++++++
android/hal-msg.h | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index fd687fb..0810078 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1332,6 +1332,14 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in List Player Attributes
+ Opcode 0x86 - Get Player Attributes Text notification
+
+ Notification parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ ...
+
+ Valid attribute values: Same as in List Player Attributes
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index d5d91dd..67fccb9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -901,3 +901,9 @@ struct hal_ev_avrcp_get_player_values {
uint8_t number;
uint8_t attrs[0];
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_GET_PLAYER_ATTRS_TEXT 0x86
+struct hal_ev_avrcp_get_player_attrs_text {
+ uint8_t number;
+ uint8_t attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 05/12] android/hal-ipc-api: Add Get Player Values 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 56df5b0..fd687fb 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1324,6 +1324,13 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attribute values: Same as in List Player Attributes
+ Opcode 0x85 - Get Player Values notification
+
+ Notification parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ ...
+
+ Valid attribute values: Same as in List Player Attributes
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 55cea27..d5d91dd 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -895,3 +895,9 @@ struct hal_ev_avrcp_remote_features {
struct hal_ev_avrcp_list_player_values {
uint8_t attr;
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_GET_PLAYER_VALUES 0x85
+struct hal_ev_avrcp_get_player_values {
+ uint8_t number;
+ uint8_t attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 04/12] android/hal-ipc-api: Add List Player Values 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 | 6 ++++++
android/hal-msg.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index aa35050..56df5b0 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1318,6 +1318,12 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Notification parameters: <none>
+ Opcode 0x84 - List Player Values notification
+
+ Notification parameters: Attribute (1 octet)
+
+ Valid attribute values: Same as in List Player Attributes
+
Bluetooth GATT HAL (ID 9)
=========================
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9536b85..55cea27 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -890,3 +890,8 @@ struct hal_ev_avrcp_remote_features {
#define HAL_EV_AVRCP_GET_PLAY_STATUS 0x82
#define HAL_EV_AVRCP_LIST_PLAYER_ATTRS 0x83
+
+#define HAL_EV_AVRCP_LIST_PLAYER_VALUES 0x84
+struct hal_ev_avrcp_list_player_values {
+ uint8_t attr;
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 03/12] android/hal-ipc-api: Add List Player Attributes 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 | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index ce50b6c..aa35050 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1314,8 +1314,9 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Notification parameters: <none>
- Opcode 0x83 - List Player Application Attributes notification
- ...
+ Opcode 0x83 - List Player Attributes notification
+
+ Notification parameters: <none>
Bluetooth GATT HAL (ID 9)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7dfbf2a..9536b85 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -889,3 +889,4 @@ struct hal_ev_avrcp_remote_features {
} __attribute__((packed));
#define HAL_EV_AVRCP_GET_PLAY_STATUS 0x82
+#define HAL_EV_AVRCP_LIST_PLAYER_ATTRS 0x83
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 02/12] android/hal-ipc-api: Add Get Play Status 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 | 3 +++
android/hal-msg.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 70f947d..ce50b6c 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1311,6 +1311,9 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
0x03 = Browse
Opcode 0x82 - Get Play Status notification
+
+ Notification parameters: <none>
+
Opcode 0x83 - List Player Application Attributes notification
...
diff --git a/android/hal-msg.h b/android/hal-msg.h
index f6cdf58..7dfbf2a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -887,3 +887,5 @@ struct hal_ev_avrcp_remote_features {
uint8_t bdaddr[6];
uint8_t features;
} __attribute__((packed));
+
+#define HAL_EV_AVRCP_GET_PLAY_STATUS 0x82
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 01/12] android/hal-ipc-api: Add Remote Features notification
From: Luiz Augusto von Dentz @ 2014-02-13 15:18 UTC (permalink / raw)
To: linux-bluetooth
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));
--
1.8.5.3
^ permalink raw reply related
* [PATCH v2] Bluetooth: Fix channel check when binding RFCOMM sock
From: Andrzej Kaczmarek @ 2014-02-13 14:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
When binding RFCOMM socket with non-zero channel we're checking if
there is already any other socket which has the same channel number
assigned and then fail. This check does not consider situation where
we have another socket connected to remote device on given channel
number in which case we still should be able to bind local socket.
This patch changes __rfcomm_get_sock_by_addr() to return only sockets
in either BT_BOUND or BT_LISTEN states, also name is updated to better
describe what this function does now.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/rfcomm/sock.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 00573fb..1a59ddd 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -105,13 +105,18 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
}
/* ---- Socket functions ---- */
-static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
+static struct sock *__rfcomm_get_listen_sock_by_addr(u8 channel, bdaddr_t *src)
{
struct sock *sk = NULL;
sk_for_each(sk, &rfcomm_sk_list.head) {
- if (rfcomm_pi(sk)->channel == channel &&
- !bacmp(&rfcomm_pi(sk)->src, src))
+ if (rfcomm_pi(sk)->channel != channel)
+ continue;
+
+ if (bacmp(&rfcomm_pi(sk)->src, src))
+ continue;
+
+ if (sk->sk_state == BT_BOUND || sk->sk_state == BT_LISTEN)
break;
}
@@ -352,7 +357,8 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
write_lock(&rfcomm_sk_list.lock);
- if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) {
+ if (sa->rc_channel && __rfcomm_get_listen_sock_by_addr(sa->rc_channel,
+ &sa->rc_bdaddr)) {
err = -EADDRINUSE;
} else {
/* Save source address */
@@ -439,7 +445,7 @@ static int rfcomm_sock_listen(struct socket *sock, int backlog)
write_lock(&rfcomm_sk_list.lock);
for (channel = 1; channel < 31; channel++)
- if (!__rfcomm_get_sock_by_addr(channel, src)) {
+ if (!__rfcomm_get_listen_sock_by_addr(channel, src)) {
rfcomm_pi(sk)->channel = channel;
err = 0;
break;
--
1.8.5.4
^ permalink raw reply related
* [PATCH] tools/rfcomm-tester: Add bind after connected test case
From: Andrzej Kaczmarek @ 2014-02-13 14:11 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
This testcase will check if it's possible to bind socket on the same
channel number as used by some other socket connected to remote device.
---
tools/rfcomm-tester.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 44df7e7..c6aa8c7 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -56,6 +56,7 @@ struct test_data {
struct rfcomm_client_data {
uint8_t server_channel;
uint8_t client_channel;
+ uint8_t bind_channel;
int expected_connect_err;
};
@@ -300,6 +301,12 @@ const struct rfcomm_client_data connect_nval = {
.expected_connect_err = -ECONNREFUSED
};
+const struct rfcomm_client_data connect_bind_success = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .bind_channel = 0x0c
+};
+
const struct rfcomm_server_data listen_success = {
.server_channel = 0x0c,
.client_channel = 0x0c,
@@ -371,6 +378,7 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
{
struct test_data *data = tester_get_data();
const struct rfcomm_client_data *client_data = data->test_data;
+ const uint8_t *master_addr;
socklen_t len = sizeof(int);
int sk, err, sk_err;
@@ -389,10 +397,24 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
return false;
}
- if (err < 0)
+ if (!client_data->bind_channel) {
+ if (err < 0)
+ tester_test_failed();
+ else
+ tester_test_passed();
+ return false;
+ }
+
+ master_addr = hciemu_get_master_bdaddr(data->hciemu);
+ sk = create_rfcomm_sock((bdaddr_t *) master_addr,
+ client_data->bind_channel);
+ if (sk < 0) {
tester_test_failed();
- else
+ } else {
+ close(sk);
tester_test_passed();
+ }
+
return false;
}
@@ -546,6 +568,9 @@ int main(int argc, char *argv[])
setup_powered_server, test_server);
test_rfcomm("Basic RFCOMM Socket Server - Conn Refused", &listen_nval,
setup_powered_server, test_server);
+ test_rfcomm("Basic RFCOMM Socket Server - Bind Connected",
+ &connect_bind_success, setup_powered_client,
+ test_connect);
return tester_run();
}
--
1.8.5.4
^ permalink raw reply related
* Re: [PATCH] adapter: Handle MGMT_SETTING_LE change
From: Johan Hedberg @ 2014-02-13 12:41 UTC (permalink / raw)
To: Petri Gynther; +Cc: linux-bluetooth
In-Reply-To: <20140213014521.59803100423@puck.mtv.corp.google.com>
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.
> --- 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?
> + 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.
Johan
^ permalink raw reply
* [PATCH] android: Fix for BT Turn off while pairing
From: Lukasz Rymanowski @ 2014-02-13 10:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
This patch fix an issue when Android disables BT during ongoing
paring. In this case mgmt did not accept any commands and BT gets
in some unknown state.
Since Android turns off BT anyway, it is ok to just cancel all
the mgmt requests before send power off command.
---
android/bluetooth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index ff41627..ad8cfec 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2907,6 +2907,9 @@ static void handle_disable_cmd(const void *buf, uint16_t len)
goto reply;
}
+ /* Cancel all pending requests. Need it in case of ongoing paring */
+ mgmt_cancel_index(mgmt_if, adapter.index);
+
if (!set_mode(MGMT_OP_SET_POWERED, 0x00)) {
status = HAL_STATUS_FAILED;
goto reply;
--
1.8.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox