* Re: [PATCH 2/7] Bluetooth: Use HCI request for LE connection
From: Andre Guedes @ 2013-10-03 14:03 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <AB1C3086-F4EE-47E6-8C0F-8698A4F2C067@holtmann.org>
Hi Marcel,
On Wed, Oct 2, 2013 at 2:04 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Andre,
>
> > This patch adds a new helper for initiating LE conneciton which uses
> > the HCI request framework. This patch also changes the hci_connect_le()
> > so it uses the new helper instead of the old hci_le_create_connection().
> >
> > Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> > ---
> > include/net/bluetooth/hci_core.h | 2 ++
> > net/bluetooth/hci_conn.c | 7 +++++-
> > net/bluetooth/hci_core.c | 46 ++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 54 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index 26cc9f7..6aa172c 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -1216,6 +1216,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
> >
> > u8 bdaddr_to_le(u8 bdaddr_type);
> >
> > +int hci_initiate_le_connection(struct hci_dev *hdev, bdaddr_t *addr, u8 type);
> > +
> > #define SCO_AIRMODE_MASK 0x0003
> > #define SCO_AIRMODE_CVSD 0x0000
> > #define SCO_AIRMODE_TRANSP 0x0003
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index f473605..24d1a0a 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -545,6 +545,7 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
> > u8 dst_type, u8 sec_level, u8 auth_type)
> > {
> > struct hci_conn *le;
> > + int err;
> >
> > if (test_bit(HCI_LE_PERIPHERAL, &hdev->flags))
> > return ERR_PTR(-ENOTSUPP);
> > @@ -565,7 +566,11 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
> > le->link_mode |= HCI_LM_MASTER;
> > le->sec_level = BT_SECURITY_LOW;
> >
> > - hci_le_create_connection(le);
> > + err = hci_initiate_le_connection(hdev, &le->dst, le->dst_type);
> > + if (err) {
> > + hci_conn_del(le);
> > + return ERR_PTR(err);
> > + }
> > }
> >
> > le->pending_sec_level = sec_level;
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index 4549b5c..51c1796 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -3631,3 +3631,49 @@ u8 bdaddr_to_le(u8 bdaddr_type)
> > return ADDR_LE_DEV_RANDOM;
> > }
> > }
> > +
> > +static void initiate_le_connection_complete(struct hci_dev *hdev, u8 status)
> > +{
> > + struct hci_conn *conn;
> > +
> > + if (status == 0)
> > + return;
> > +
> > + BT_ERR("HCI request failed to initiate LE connection: status 0x%2.2x",
> > + status);
> > +
> > + conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT);
> > + if (!conn)
> > + return;
> > +
> > + mgmt_connect_failed(hdev, &conn->dst, conn->type, conn->dst_type,
> > + status);
> > +
> > + hci_proto_connect_cfm(conn, status);
> > +
> > + hci_dev_lock(hdev);
> > + hci_conn_del(conn);
> > + hci_dev_unlock(hdev);
> > +}
> > +
> > +int hci_initiate_le_connection(struct hci_dev *hdev, bdaddr_t *addr, u8 type)
> > +{
> > + struct hci_cp_le_create_conn cp;
> > + struct hci_request req;
> > +
> > + hci_req_init(&req, hdev);
> > +
> > + memset(&cp, 0, sizeof(cp));
> > + cp.scan_interval = __constant_cpu_to_le16(0x0060);
> > + cp.scan_window = __constant_cpu_to_le16(0x0030);
> > + bacpy(&cp.peer_addr, addr);
> > + cp.peer_addr_type = type;
> > + cp.conn_interval_min = __constant_cpu_to_le16(0x0028);
> > + cp.conn_interval_max = __constant_cpu_to_le16(0x0038);
> > + cp.supervision_timeout = __constant_cpu_to_le16(0x002a);
> > + cp.min_ce_len = __constant_cpu_to_le16(0x0000);
> > + cp.max_ce_len = __constant_cpu_to_le16(0x0000);
> > + hci_req_add(&req, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
> > +
> > + return hci_req_run(&req, initiate_le_connection_complete);
> > +}
>
> so how does this actually work. The command status handling for errors is now run twice? Once in hci_cs_le_create_conn() and once in the complete callback.
The hci_cs_le_create_conn() is removed in patch 4/7 since the handling
is done in initiate_le_connection_complete introduced by this patch.
I thought splitting this in three short patches would be easier to
review but it seems to be more confusing :) I'll squash patches 2, 3
and 4 into a bigger patch though.
Regards,
Andre
^ permalink raw reply
* Re: [PATCH 1/7] Bluetooth: Initialize hci_conn fields in hci_connect_le
From: Andre Guedes @ 2013-10-03 14:03 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <A1F8B46C-982C-4C37-8730-5993D28F324E@holtmann.org>
Hi Marcel,
On Wed, Oct 2, 2013 at 1:57 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Andre,
>
> > This patch moves some hci_conn fields initialization from hci_le_
> > create_connection() to hci_connect_le(). It makes more sense to
> > initialize these fields within the function that creates the hci_
> > conn object.
> >
> > Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> > ---
> > net/bluetooth/hci_conn.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index d2380e0..f473605 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -54,11 +54,6 @@ static void hci_le_create_connection(struct hci_conn *conn)
> > struct hci_dev *hdev = conn->hdev;
> > struct hci_cp_le_create_conn cp;
> >
> > - conn->state = BT_CONNECT;
> > - conn->out = true;
> > - conn->link_mode |= HCI_LM_MASTER;
> > - conn->sec_level = BT_SECURITY_LOW;
> > -
> > memset(&cp, 0, sizeof(cp));
> > cp.scan_interval = __constant_cpu_to_le16(0x0060);
> > cp.scan_window = __constant_cpu_to_le16(0x0030);
> > @@ -565,6 +560,11 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
> > return ERR_PTR(-ENOMEM);
> >
> > le->dst_type = bdaddr_to_le(dst_type);
> > + le->state = BT_CONNECT;
> > + le->out = true;
> > + le->link_mode |= HCI_LM_MASTER;
> > + le->sec_level = BT_SECURITY_LOW;
> > +
> > hci_le_create_connection(le);
> > }
>
> I do not understand on how this is the same. Maybe the confusion is the use of le-> instead of conn-> as variable for hci_conn. Seems that should be fixed first.
Yes, I don't really like le-> either. I'll replace le-> by conn-> in
this function in a first patch.
Andre
^ permalink raw reply
* Re: [PATCH 0/7] MAP notification API
From: Luiz Augusto von Dentz @ 2013-10-03 13:53 UTC (permalink / raw)
To: Christian Fetzer; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1380032167-6440-1-git-send-email-christian.fetzer@oss.bmw-carit.de>
Hi Christian,
On Tue, Sep 24, 2013 at 5:16 PM, Christian Fetzer
<christian.fetzer@oss.bmw-carit.de> wrote:
> From: Christian Fetzer <christian.fetzer@bmw-carit.de>
>
> This patchset adds the event handlers for new message, message shift/deleted
> and message status update events.
>
> New messages are signaled by registering a corresponding message event, that
> is announced using the ObjectManager.
>
> For moved / deleted messages:
> - If we have the Message interface, we simply update property 'Folder'.
> - If the message was moved into the current folder, we register its
> Message interface.
>
> The status update events change the property 'Status'.
>
> Note that this patchset depends on the changed map_msg_create function from
> 'obexd: Fix setting message folder' sent on 23.09.2013.
>
> Christian Fetzer (7):
> obexd: Handle new message event
> obexd: Add function set_reception_status to MAP client
> obexd: Handle message status events
> obexd: Update Status property in map documentation
> obexd: Add function set_folder to MAP client
> obexd: Handle message shift and message deleted events
> obexd: Prefix folders in event reports with leading slash
>
> doc/obex-api.txt | 10 ++++--
> obexd/client/map.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> obexd/client/mns.c | 16 +++++++--
> 3 files changed, 120 insertions(+), 5 deletions(-)
>
> --
> 1.8.3.4
After quite a few changes here and there I pushed this set, note some
things I just ignored for now such as message not know changing
location, if you provide a good explanation I can consider adding it
back but it should probably be done in a separate patch.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [RFC] Bluetooth: Only one command per L2CAP LE signalling is supported
From: Johan Hedberg @ 2013-10-03 13:21 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380788797-8001-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Thu, Oct 03, 2013, Marcel Holtmann wrote:
> The Bluetooth specification makes it clear that only one command
> should be present in the L2CAP LE signalling packet. So tighten
> the checks here and restrict it to exactly one command.
>
> This is different from L2CAP BR/EDR signalling where multiple
> commands can be part of the same packet.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 44 +++++++++++++++++++-------------------------
> 1 file changed, 19 insertions(+), 25 deletions(-)
The patch and resulting code looks fine to me. I also did some basic
tests which were fine. The patch is now applied to bluetooth-next.
Thanks.
Johan
^ permalink raw reply
* Re: [RFCv2 09/14] android: sdp: Reuse BlueZ SDP server in Android
From: Szymon Janc @ 2013-10-03 11:47 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <20131003113512.GA2804@aemeltch-MOBL1>
Hi Andrei,
> > > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > >
> > > Reuse existing SDP server code in Android GPL daemon.
> > > ---
> > > Makefile.android | 7 +++++--
> > > android/Android.mk | 7 +++++++
> > > android/bt_adapter.c | 5 ++++-
> > > android/main.c | 29 +++++++++++++++++++++++++++++
> > > android/main.h | 25 +++++++++++++++++++++++++
> > > 5 files changed, 70 insertions(+), 3 deletions(-)
> > > create mode 100644 android/main.h
> > >
> > > diff --git a/Makefile.android b/Makefile.android
> > > index 3e6fec0..bf82928 100644
> > > --- a/Makefile.android
> > > +++ b/Makefile.android
> > > @@ -3,7 +3,10 @@ if ANDROID_DAEMON
> > > noinst_PROGRAMS += android/bluezd
> > >
> > > android_bluezd_SOURCES = android/main.c src/log.c \
> > > + src/sdpd-database.c src/sdpd-server.c \
> > > + src/sdpd-service.c src/sdpd-request.c \
> > > src/shared/util.h src/shared/util.c \
> > > - src/shared/mgmt.h src/shared/mgmt.c
> > > -android_bluezd_LDADD = @GLIB_LIBS@
> > > + src/shared/mgmt.h src/shared/mgmt.c \
> > > + android/bt_adapter.h android/bt_adapter.c
> > > +android_bluezd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> > > endif
> > > diff --git a/android/Android.mk b/android/Android.mk
> > > index 11ac204..b0a531f 100644
> > > --- a/android/Android.mk
> > > +++ b/android/Android.mk
> > > @@ -11,6 +11,11 @@ LOCAL_SRC_FILES := \
> > > main.c \
> > > ../src/shared/mgmt.c \
> > > ../src/shared/util.c \
> > > + bt_adapter.c \
> > > + ../src/sdpd-database.c \
> > > + ../src/sdpd-service.c \
> > > + ../src/sdpd-request.c \
> > > + ../src/sdpd-server.c \
> > >
> > > LOCAL_C_INCLUDES := \
> > > $(call include-path-for, glib) \
> > > @@ -19,6 +24,7 @@ LOCAL_C_INCLUDES := \
> > > LOCAL_C_INCLUDES += \
> > > $(LOCAL_PATH)/../ \
> > > $(LOCAL_PATH)/../src \
> > > + $(LOCAL_PATH)/../lib \
> > >
> > > LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
> > >
> > > @@ -30,6 +36,7 @@ LOCAL_CFLAGS += -DSOCK_CLOEXEC=02000000 -DSOCK_NONBLOCK=04000
> > >
> > > LOCAL_SHARED_LIBRARIES := \
> > > libglib \
> > > + libbluetooth \
> > >
> > > LOCAL_MODULE := bluezd
> > >
> > > diff --git a/android/bt_adapter.c b/android/bt_adapter.c
> > > index e21d50c..5016243 100644
> > > --- a/android/bt_adapter.c
> > > +++ b/android/bt_adapter.c
> > > @@ -23,6 +23,7 @@
> > >
> > > #include "bt_adapter.h"
> > > #include "log.h"
> > > +#include "main.h"
> > > #include "src/shared/mgmt.h"
> > >
> > > struct bt_adapter *bt_adapter_new(uint16_t index, struct mgmt *mgmt_if)
> > > @@ -45,7 +46,7 @@ void adapter_start(struct bt_adapter *adapter)
> > >
> > > /* TODO: CB: report scan mode */
> > >
> > > - /* TODO: SDP start here */
> > > + sdp_start();
> >
> > Why not just start it when daemon starts? Just like in original daemon?
> >
>
> Can it start without adapter initialized? How can I open L2CAP socket?
It binds to BDADDR_ANY address.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [RFCv2 09/14] android: sdp: Reuse BlueZ SDP server in Android
From: Andrei Emeltchenko @ 2013-10-03 11:35 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <12556011.okBRc3D5Dz@uw000953>
Hi Szymon,
On Thu, Oct 03, 2013 at 04:23:02AM -0700, Szymon Janc wrote:
> Hi Andrei,
>
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> >
> > Reuse existing SDP server code in Android GPL daemon.
> > ---
> > Makefile.android | 7 +++++--
> > android/Android.mk | 7 +++++++
> > android/bt_adapter.c | 5 ++++-
> > android/main.c | 29 +++++++++++++++++++++++++++++
> > android/main.h | 25 +++++++++++++++++++++++++
> > 5 files changed, 70 insertions(+), 3 deletions(-)
> > create mode 100644 android/main.h
> >
> > diff --git a/Makefile.android b/Makefile.android
> > index 3e6fec0..bf82928 100644
> > --- a/Makefile.android
> > +++ b/Makefile.android
> > @@ -3,7 +3,10 @@ if ANDROID_DAEMON
> > noinst_PROGRAMS += android/bluezd
> >
> > android_bluezd_SOURCES = android/main.c src/log.c \
> > + src/sdpd-database.c src/sdpd-server.c \
> > + src/sdpd-service.c src/sdpd-request.c \
> > src/shared/util.h src/shared/util.c \
> > - src/shared/mgmt.h src/shared/mgmt.c
> > -android_bluezd_LDADD = @GLIB_LIBS@
> > + src/shared/mgmt.h src/shared/mgmt.c \
> > + android/bt_adapter.h android/bt_adapter.c
> > +android_bluezd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> > endif
> > diff --git a/android/Android.mk b/android/Android.mk
> > index 11ac204..b0a531f 100644
> > --- a/android/Android.mk
> > +++ b/android/Android.mk
> > @@ -11,6 +11,11 @@ LOCAL_SRC_FILES := \
> > main.c \
> > ../src/shared/mgmt.c \
> > ../src/shared/util.c \
> > + bt_adapter.c \
> > + ../src/sdpd-database.c \
> > + ../src/sdpd-service.c \
> > + ../src/sdpd-request.c \
> > + ../src/sdpd-server.c \
> >
> > LOCAL_C_INCLUDES := \
> > $(call include-path-for, glib) \
> > @@ -19,6 +24,7 @@ LOCAL_C_INCLUDES := \
> > LOCAL_C_INCLUDES += \
> > $(LOCAL_PATH)/../ \
> > $(LOCAL_PATH)/../src \
> > + $(LOCAL_PATH)/../lib \
> >
> > LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
> >
> > @@ -30,6 +36,7 @@ LOCAL_CFLAGS += -DSOCK_CLOEXEC=02000000 -DSOCK_NONBLOCK=04000
> >
> > LOCAL_SHARED_LIBRARIES := \
> > libglib \
> > + libbluetooth \
> >
> > LOCAL_MODULE := bluezd
> >
> > diff --git a/android/bt_adapter.c b/android/bt_adapter.c
> > index e21d50c..5016243 100644
> > --- a/android/bt_adapter.c
> > +++ b/android/bt_adapter.c
> > @@ -23,6 +23,7 @@
> >
> > #include "bt_adapter.h"
> > #include "log.h"
> > +#include "main.h"
> > #include "src/shared/mgmt.h"
> >
> > struct bt_adapter *bt_adapter_new(uint16_t index, struct mgmt *mgmt_if)
> > @@ -45,7 +46,7 @@ void adapter_start(struct bt_adapter *adapter)
> >
> > /* TODO: CB: report scan mode */
> >
> > - /* TODO: SDP start here */
> > + sdp_start();
>
> Why not just start it when daemon starts? Just like in original daemon?
>
Can it start without adapter initialized? How can I open L2CAP socket?
Best regards
Andrei Emeltchenko
^ permalink raw reply
* Re: [RFCv2 09/14] android: sdp: Reuse BlueZ SDP server in Android
From: Szymon Janc @ 2013-10-03 11:23 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1380639799-25790-10-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Reuse existing SDP server code in Android GPL daemon.
> ---
> Makefile.android | 7 +++++--
> android/Android.mk | 7 +++++++
> android/bt_adapter.c | 5 ++++-
> android/main.c | 29 +++++++++++++++++++++++++++++
> android/main.h | 25 +++++++++++++++++++++++++
> 5 files changed, 70 insertions(+), 3 deletions(-)
> create mode 100644 android/main.h
>
> diff --git a/Makefile.android b/Makefile.android
> index 3e6fec0..bf82928 100644
> --- a/Makefile.android
> +++ b/Makefile.android
> @@ -3,7 +3,10 @@ if ANDROID_DAEMON
> noinst_PROGRAMS += android/bluezd
>
> android_bluezd_SOURCES = android/main.c src/log.c \
> + src/sdpd-database.c src/sdpd-server.c \
> + src/sdpd-service.c src/sdpd-request.c \
> src/shared/util.h src/shared/util.c \
> - src/shared/mgmt.h src/shared/mgmt.c
> -android_bluezd_LDADD = @GLIB_LIBS@
> + src/shared/mgmt.h src/shared/mgmt.c \
> + android/bt_adapter.h android/bt_adapter.c
> +android_bluezd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> endif
> diff --git a/android/Android.mk b/android/Android.mk
> index 11ac204..b0a531f 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -11,6 +11,11 @@ LOCAL_SRC_FILES := \
> main.c \
> ../src/shared/mgmt.c \
> ../src/shared/util.c \
> + bt_adapter.c \
> + ../src/sdpd-database.c \
> + ../src/sdpd-service.c \
> + ../src/sdpd-request.c \
> + ../src/sdpd-server.c \
>
> LOCAL_C_INCLUDES := \
> $(call include-path-for, glib) \
> @@ -19,6 +24,7 @@ LOCAL_C_INCLUDES := \
> LOCAL_C_INCLUDES += \
> $(LOCAL_PATH)/../ \
> $(LOCAL_PATH)/../src \
> + $(LOCAL_PATH)/../lib \
>
> LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
>
> @@ -30,6 +36,7 @@ LOCAL_CFLAGS += -DSOCK_CLOEXEC=02000000 -DSOCK_NONBLOCK=04000
>
> LOCAL_SHARED_LIBRARIES := \
> libglib \
> + libbluetooth \
>
> LOCAL_MODULE := bluezd
>
> diff --git a/android/bt_adapter.c b/android/bt_adapter.c
> index e21d50c..5016243 100644
> --- a/android/bt_adapter.c
> +++ b/android/bt_adapter.c
> @@ -23,6 +23,7 @@
>
> #include "bt_adapter.h"
> #include "log.h"
> +#include "main.h"
> #include "src/shared/mgmt.h"
>
> struct bt_adapter *bt_adapter_new(uint16_t index, struct mgmt *mgmt_if)
> @@ -45,7 +46,7 @@ void adapter_start(struct bt_adapter *adapter)
>
> /* TODO: CB: report scan mode */
>
> - /* TODO: SDP start here */
> + sdp_start();
Why not just start it when daemon starts? Just like in original daemon?
>
> /* TODO: CB: report state on */
> }
> @@ -53,4 +54,6 @@ void adapter_start(struct bt_adapter *adapter)
> void adapter_stop(struct bt_adapter *adapter)
> {
> DBG("disabled %u", adapter->dev_id);
> +
> + sdp_stop();
> }
> diff --git a/android/main.c b/android/main.c
> index 4792919..db435f9 100644
> --- a/android/main.c
> +++ b/android/main.c
> @@ -36,6 +36,8 @@
>
> #include "log.h"
> #include "hcid.h"
> +#include "sdpd.h"
> +#include "main.h"
>
> #include "lib/bluetooth.h"
> #include "lib/mgmt.h"
> @@ -43,12 +45,39 @@
>
> #define SHUTDOWN_GRACE_SECONDS 10
>
> +struct main_opts main_opts;
> +
> static GMainLoop *event_loop;
> static struct mgmt *mgmt_if = NULL;
>
> static uint8_t mgmt_version = 0;
> static uint8_t mgmt_revision = 0;
>
> +GList *adapter_list = NULL;
> +struct bt_adapter *default_adapter = NULL;
> +
> +int sdp_start(void)
> +{
> + DBG("");
> +
> + /* TODO: add logic */
> +
> + /* sdpd-server use these settings */
> + memset(&main_opts, 0, sizeof(main_opts));
> +
> + /* Use params: mtu = 0, flags = 0 */
> + return start_sdp_server(0, 0);
> +}
> +
> +void sdp_stop(void)
> +{
> + DBG("");
> +
> + /* TODO: add logic */
> +
> + stop_sdp_server();
> +}
> +
> void btd_exit(void)
> {
> g_main_loop_quit(event_loop);
> diff --git a/android/main.h b/android/main.h
> new file mode 100644
> index 0000000..6ecad14
> --- /dev/null
> +++ b/android/main.h
> @@ -0,0 +1,25 @@
> +/*
> + *
> + * BlueZ - Bluetooth protocol stack for Linux
> + *
> + * Copyright (C) 2013 Intel Corporation. All rights reserved.
> + *
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + */
> +
> +int sdp_start(void);
> +void sdp_stop(void);
>
--
BR
Szymon Janc
^ permalink raw reply
* [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
From: Giovanni Campagna @ 2013-10-03 11:03 UTC (permalink / raw)
To: linux-bluetooth
From: Giovanni Campagna <gcampagna@src.gnome.org>
The paths under /dev, in the default udev configuration, are formatted
with two leading zeros, but the number obtained from sysfs don't have
them, so we must convert them to integers and reformat them.
---
tools/hid2hci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index bb8a521..95b4abf 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
static int find_device(struct udev_device *udev_dev)
{
char path[PATH_MAX];
- const char *busnum, *devnum;
+ const char *busnum_str, *devnum_str;
+ int busnum, devnum;
int fd;
- busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
- if (!busnum)
+ busnum_str = udev_device_get_sysattr_value(udev_dev, "busnum");
+ if (!busnum_str)
return -1;
+ busnum = strtol(busnum_str, NULL, 10);
- devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
- if (!devnum)
+ devnum_str = udev_device_get_sysattr_value(udev_dev, "devnum");
+ if (!devnum_str)
return -1;
+ devnum = strtol(devnum_str, NULL, 10);
- snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
+ snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
fd = open(path, O_RDWR, O_CLOEXEC);
if (fd < 0) {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Check minimum length of SMP packets
From: Johan Hedberg @ 2013-10-03 10:08 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380788588-7897-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Thu, Oct 03, 2013, Marcel Holtmann wrote:
> When SMP packets are received, make sure they contain at least 1 byte
> header for the opcode. If not, drop the packet and disconnect the link.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/smp.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Drop packets on ATT fixed channel on BR/EDR
From: Johan Hedberg @ 2013-10-03 10:08 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380794051-8488-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Thu, Oct 03, 2013, Marcel Holtmann wrote:
> The ATT fixed channel is only valid when using LE connections. On
> BR/EDR it is required to go through L2CAP connection oriented
> channel for ATT.
>
> Drop ATT packets when they are received on a BR/EDR connection.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Drop packets on ATT fixed channel on BR/EDR
From: Marcel Holtmann @ 2013-10-03 9:54 UTC (permalink / raw)
To: linux-bluetooth
The ATT fixed channel is only valid when using LE connections. On
BR/EDR it is required to go through L2CAP connection oriented
channel for ATT.
Drop ATT packets when they are received on a BR/EDR connection.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 102a510..583517e1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6431,8 +6431,12 @@ drop:
static void l2cap_att_channel(struct l2cap_conn *conn,
struct sk_buff *skb)
{
+ struct hci_conn *hcon = conn->hcon;
struct l2cap_chan *chan;
+ if (hcon->type != LE_LINK)
+ goto drop;
+
chan = l2cap_global_chan_by_scid(BT_CONNECTED, L2CAP_CID_ATT,
conn->src, conn->dst);
if (!chan)
--
1.8.3.1
^ permalink raw reply related
* [RFC] Bluetooth: Only one command per L2CAP LE signalling is supported
From: Marcel Holtmann @ 2013-10-03 8:26 UTC (permalink / raw)
To: linux-bluetooth
The Bluetooth specification makes it clear that only one command
should be present in the L2CAP LE signalling packet. So tighten
the checks here and restrict it to exactly one command.
This is different from L2CAP BR/EDR signalling where multiple
commands can be part of the same packet.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 44 +++++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 102a510..a2c223e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5322,43 +5322,37 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
struct sk_buff *skb)
{
struct hci_conn *hcon = conn->hcon;
- u8 *data = skb->data;
- int len = skb->len;
- struct l2cap_cmd_hdr cmd;
+ struct l2cap_cmd_hdr *cmd;
+ u16 len;
int err;
if (hcon->type != LE_LINK)
goto drop;
- while (len >= L2CAP_CMD_HDR_SIZE) {
- u16 cmd_len;
- memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE);
- data += L2CAP_CMD_HDR_SIZE;
- len -= L2CAP_CMD_HDR_SIZE;
+ if (skb->len < L2CAP_CMD_HDR_SIZE)
+ goto drop;
- cmd_len = le16_to_cpu(cmd.len);
+ cmd = (void *) skb->data;
+ skb_pull(skb, L2CAP_CMD_HDR_SIZE);
- BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len,
- cmd.ident);
+ len = le16_to_cpu(cmd->len);
- if (cmd_len > len || !cmd.ident) {
- BT_DBG("corrupted command");
- break;
- }
+ BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd->code, len, cmd->ident);
- err = l2cap_le_sig_cmd(conn, &cmd, data);
- if (err) {
- struct l2cap_cmd_rej_unk rej;
+ if (len != skb->len || !cmd->ident) {
+ BT_DBG("corrupted command");
+ goto drop;
+ }
- BT_ERR("Wrong link type (%d)", err);
+ err = l2cap_le_sig_cmd(conn, cmd, skb->data);
+ if (err) {
+ struct l2cap_cmd_rej_unk rej;
- rej.reason = l2cap_err_to_reason(err);
- l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ,
- sizeof(rej), &rej);
- }
+ BT_ERR("Wrong link type (%d)", err);
- data += cmd_len;
- len -= cmd_len;
+ rej.reason = l2cap_err_to_reason(err);
+ l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ,
+ sizeof(rej), &rej);
}
drop:
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Check minimum length of SMP packets
From: Marcel Holtmann @ 2013-10-03 8:23 UTC (permalink / raw)
To: linux-bluetooth
When SMP packets are received, make sure they contain at least 1 byte
header for the opcode. If not, drop the packet and disconnect the link.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 6e049497..884b208 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -848,8 +848,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
{
struct hci_conn *hcon = conn->hcon;
- __u8 code = skb->data[0];
- __u8 reason;
+ __u8 code, reason;
int err = 0;
if (hcon->type != LE_LINK) {
@@ -857,12 +856,18 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
return -ENOTSUPP;
}
+ if (skb->len < 1) {
+ kfree_skb(skb);
+ return -EILSEQ;
+ }
+
if (!test_bit(HCI_LE_ENABLED, &conn->hcon->hdev->dev_flags)) {
err = -ENOTSUPP;
reason = SMP_PAIRING_NOTSUPP;
goto done;
}
+ code = skb->data[0];
skb_pull(skb, sizeof(code));
/*
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: L2CAP connectionless channels are only valid for BR/EDR
From: Johan Hedberg @ 2013-10-03 7:14 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380783819-47726-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Thu, Oct 03, 2013, Marcel Holtmann wrote:
> When receiving connectionless packets on a LE connection, just drop
> the packet. There is no concept of connectionless channels for LE.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: SMP packets are only valid on LE connections
From: Johan Hedberg @ 2013-10-03 7:10 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380783657-45553-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Thu, Oct 03, 2013, Marcel Holtmann wrote:
> When receiving SMP packets on a BR/EDR connection, then just drop
> the packet and do not try to process it.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/smp.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Don't copy L2CAP LE signalling to raw sockets
From: Johan Hedberg @ 2013-10-03 7:10 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380783109-37739-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> The L2CAP raw sockets are only used for BR/EDR signalling. Packets
> on LE links should not be forwarded there.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 2 --
> 1 file changed, 2 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix switch statement order for L2CAP fixed channels
From: Johan Hedberg @ 2013-10-03 7:09 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380782814-35670-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> The switch statement for the various L2CAP fixed channel handlers
> is not really ordered.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Allow changing device class when BR/EDR is disabled
From: Johan Hedberg @ 2013-10-03 7:06 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380782249-29597-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Changing the device class when BR/EDR is disabled has no visible
> effect for remote devices. However to simplify the logic allow it
> as long as the controller supports BR/EDR operations.
>
> If it is not allowed, then the overall logic becomes rather
> complicated since the class of device values would need clearing
> or restoring when BR/EDR setting changes.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: L2CAP connectionless channels are only valid for BR/EDR
From: Marcel Holtmann @ 2013-10-03 7:03 UTC (permalink / raw)
To: linux-bluetooth
When receiving connectionless packets on a LE connection, just drop
the packet. There is no concept of connectionless channels for LE.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index eee18f3..583517e1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6403,8 +6403,12 @@ done:
static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
struct sk_buff *skb)
{
+ struct hci_conn *hcon = conn->hcon;
struct l2cap_chan *chan;
+ if (hcon->type != ACL_LINK)
+ goto drop;
+
chan = l2cap_global_chan_by_psm(0, psm, conn->src, conn->dst);
if (!chan)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Hans de Goede @ 2013-10-03 7:00 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan
Cc: USB list, linux-bluetooth, Shuah Khan, Gustavo Padovan, stable
In-Reply-To: <508150F6-D142-4406-8CC9-57DDE754F391@holtmann.org>
Hi,
On 10/03/2013 05:39 AM, Marcel Holtmann wrote:
> Hi Gustavo,
>
>>> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
>>> devices default to hid mode for BIOS use. This means that after having been
>>> reset they will revert to HID mode, and are no longer usable as a HCI.
>>>
>>> Therefor it is a very bad idea to just blindly make reset_resume point to
>>> the regular resume handler. Note that the btusb driver has no clue how to
>>> switch these devices from hid to hci mode, this is done in userspace through
>>> udev rules, so the proper way to deal with this is to not have a reset-resume
>>> handler and instead let the usb-system re-enumerate the device, and re-run
>>> the udev rules.
>>>
>>> I must also note, that the commit message for the commit causing this
>>> problem has a very weak motivation for the change:
>>>
>>> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
>>> following message after power management device test. This change sets
>>> reset_resume to btusb_resume().
>>>
>>> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
>>> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>>>
>>> Making a change solely to silence a warning while also changing important
>>> behavior (normal resume handling versus re-enumeration) requires a commit
>>> message with a proper explanation why it is safe to do so, which clearly lacks
>>> here, and unsurprisingly it turns out to not be safe to make this change.
>>>
>>> Reverting the commit in question fixes bt no longer working on my Dell
>>> E6430 after a suspend/resume, and I believe it likely also fixes the
>>> following bugs:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=988481
>>> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
>>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>>>
>>> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>>>
>>> Cc: Shuah Khan <shuah.kh@samsung.com>
>>> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>> drivers/bluetooth/btusb.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>
>> Patch has been applied to bluetooth.git. Thanks.
>
> why? Because we have one broken Dell Bluetooth dongle.
Well for one, because we have a no regressions policy.
For another because the original patch does not actually fix anything
(according to the original commit message), it just silences a warning
(with a way too big hammer).
> Do we actually know how this affects other chips.
In the mean time I have confirmation that the reset_resume patch also
breaks intel hci's (embedded in their wlan cards, 8087:07da) after
suspend/resume, and that reverting it also fixes this. To be precise
I've confirmation that downgrading to 3.10 which lacks this patch fixes
the intel hci issues, see:
https://bugzilla.redhat.com/show_bug.cgi?id=988481
> The dell HID Proxy thing has always been special case and that is Dell's fault.
And the Logitech HID proxy, and various devices with broadcom chips ...
> Look at the extra code that we have in hid2hci tool and its udev rules for Dell hardware. Is anybody actually willing to investigate this one properly.
If people really want a reset_resume handler, then a lot more works need
to be done then just making reset_resume point to the current resume handler.
reset_resume gets called when on resume the usb subsys sees that the device
has lost power, iow the device has had a hard reset, and all device state is
gone. The current btusb resume handler was never written with the assumption
that all device state is gone. All it does is resubmit a bunch of urbs, it
does not restore any device state, therefor it is unsuitable as a
reset_resume handler.
Regards,
Hans
^ permalink raw reply
* [PATCH] Bluetooth: SMP packets are only valid on LE connections
From: Marcel Holtmann @ 2013-10-03 7:00 UTC (permalink / raw)
To: linux-bluetooth
When receiving SMP packets on a BR/EDR connection, then just drop
the packet and do not try to process it.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index b5562ab..6e049497 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -847,10 +847,16 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
{
+ struct hci_conn *hcon = conn->hcon;
__u8 code = skb->data[0];
__u8 reason;
int err = 0;
+ if (hcon->type != LE_LINK) {
+ kfree_skb(skb);
+ return -ENOTSUPP;
+ }
+
if (!test_bit(HCI_LE_ENABLED, &conn->hcon->hdev->dev_flags)) {
err = -ENOTSUPP;
reason = SMP_PAIRING_NOTSUPP;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported
From: Johan Hedberg @ 2013-10-03 6:56 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, Marcel Holtmann
In-Reply-To: <1380729451-2266-1-git-send-email-dh.herrmann@gmail.com>
Hi David,
On Wed, Oct 02, 2013, David Herrmann wrote:
> Allow plugins to return -ENOSYS during registration and handle it as
> "not-supported" error. It makes the error messages slightly more useful in
> case kernel-support is missing for a particular subsystem.
> ---
> src/plugin.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Both patches have been applied after a couple of minor tweaks: remove
one of the three logs in the bnep failure case (we don't need that many)
and restrict scope of the err variable in plugin.c.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Don't copy L2CAP LE signalling to raw sockets
From: Marcel Holtmann @ 2013-10-03 6:51 UTC (permalink / raw)
To: linux-bluetooth
The L2CAP raw sockets are only used for BR/EDR signalling. Packets
on LE links should not be forwarded there.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 0661ca6..65c5371 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5327,8 +5327,6 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
struct l2cap_cmd_hdr cmd;
int err;
- l2cap_raw_recv(conn, skb);
-
if (hcon->type != LE_LINK)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Fix switch statement order for L2CAP fixed channels
From: Marcel Holtmann @ 2013-10-03 6:46 UTC (permalink / raw)
To: linux-bluetooth
The switch statement for the various L2CAP fixed channel handlers
is not really ordered.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 814563d..0661ca6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6466,9 +6466,6 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("len %d, cid 0x%4.4x", len, cid);
switch (cid) {
- case L2CAP_CID_LE_SIGNALING:
- l2cap_le_sig_channel(conn, skb);
- break;
case L2CAP_CID_SIGNALING:
l2cap_sig_channel(conn, skb);
break;
@@ -6483,6 +6480,10 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
l2cap_att_channel(conn, skb);
break;
+ case L2CAP_CID_LE_SIGNALING:
+ l2cap_le_sig_channel(conn, skb);
+ break;
+
case L2CAP_CID_SMP:
if (smp_sig_channel(conn, skb))
l2cap_conn_del(conn->hcon, EACCES);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Allow changing device class when BR/EDR is disabled
From: Marcel Holtmann @ 2013-10-03 6:37 UTC (permalink / raw)
To: linux-bluetooth
Changing the device class when BR/EDR is disabled has no visible
effect for remote devices. However to simplify the logic allow it
as long as the controller supports BR/EDR operations.
If it is not allowed, then the overall logic becomes rather
complicated since the class of device values would need clearing
or restoring when BR/EDR setting changes.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4ce0f11..16125ff9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1757,7 +1757,7 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
BT_DBG("request for %s", hdev->name);
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
+ if (!lmp_bredr_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ 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