* [PATCH 3/4] Bluetooth: Remove l2cap_conn->src and l2cap_conn->dst usage from L2CAP
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->src and l2cap_conn->dst addresses are just a pointers
to hci_conn structure. Use hci_conn->hdev->bdaddr and hci_conn->dst
directly instead.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 13bb9da..41e2efe 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1381,7 +1381,8 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
/* Check if we have socket listening on cid */
pchan = l2cap_global_chan_by_scid(BT_LISTEN, L2CAP_CID_ATT,
- conn->src, conn->dst);
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!pchan)
return;
@@ -1399,8 +1400,8 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
chan->dcid = L2CAP_CID_ATT;
- bacpy(&bt_sk(chan->sk)->src, conn->src);
- bacpy(&bt_sk(chan->sk)->dst, conn->dst);
+ bacpy(&bt_sk(chan->sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(chan->sk)->dst, &conn->hcon->dst);
__l2cap_chan_add(conn, chan);
@@ -1665,9 +1666,6 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
break;
}
- conn->src = &hcon->hdev->bdaddr;
- conn->dst = &hcon->dst;
-
conn->feat_mask = 0;
if (hcon->type == ACL_LINK)
@@ -1861,7 +1859,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
}
/* Update source addr of the socket */
- bacpy(src, conn->src);
+ bacpy(src, &hdev->bdaddr);
l2cap_chan_unlock(chan);
l2cap_chan_add(conn, chan);
@@ -3761,7 +3759,9 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
BT_DBG("psm 0x%2.2x scid 0x%4.4x", __le16_to_cpu(psm), scid);
/* Check if we have socket listening on psm */
- pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, conn->src, conn->dst);
+ pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm,
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!pchan) {
result = L2CAP_CR_BAD_PSM;
goto sendresp;
@@ -3799,8 +3799,8 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
*/
conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT;
- bacpy(&bt_sk(sk)->src, conn->src);
- bacpy(&bt_sk(sk)->dst, conn->dst);
+ bacpy(&bt_sk(sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(sk)->dst, &conn->hcon->dst);
chan->psm = psm;
chan->dcid = scid;
chan->local_amp_id = amp_id;
@@ -4479,7 +4479,8 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
struct amp_mgr *mgr = conn->hcon->amp_mgr;
struct hci_conn *hs_hcon;
- hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, conn->dst);
+ hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK,
+ &conn->hcon->dst);
if (!hs_hcon) {
hci_dev_put(hdev);
return -EBADSLT;
@@ -4922,7 +4923,7 @@ static inline int l2cap_move_channel_req(struct l2cap_conn *conn,
*/
if ((__chan_is_moving(chan) ||
chan->move_role != L2CAP_MOVE_ROLE_NONE) &&
- bacmp(conn->src, conn->dst) > 0) {
+ bacmp(&conn->hcon->hdev->bdaddr, &conn->hcon->dst) > 0) {
result = L2CAP_MR_COLLISION;
goto send_move_response;
}
@@ -6437,7 +6438,8 @@ static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
if (hcon->type != ACL_LINK)
goto drop;
- chan = l2cap_global_chan_by_psm(0, psm, conn->src, conn->dst);
+ chan = l2cap_global_chan_by_psm(0, psm, &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!chan)
goto drop;
@@ -6466,7 +6468,8 @@ static void l2cap_att_channel(struct l2cap_conn *conn,
goto drop;
chan = l2cap_global_chan_by_scid(BT_CONNECTED, L2CAP_CID_ATT,
- conn->src, conn->dst);
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!chan)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/4] Bluetooth: Remove l2cap_conn->src and l2cap_conn->dst usage from SMP
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->src and l2cap_conn->dst addresses are just a pointer
to hci_conn->hdev->bdaddr and hci_conn->dst structures. Use the data
provided by hci_conn directly. This is done for hci_conn->dst_type
already anyway and with this change it makes it a lot clearer were
the address information comes from.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 9272094..06a082ea 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -266,13 +266,13 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
&reason);
- clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);
- mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type,
- hcon->dst_type, HCI_ERROR_AUTH_FAILURE);
+ clear_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags);
+ mgmt_auth_failed(hcon->hdev, &hcon->dst, hcon->type, hcon->dst_type,
+ HCI_ERROR_AUTH_FAILURE);
cancel_delayed_work_sync(&conn->security_timer);
- if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags))
+ if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
smp_chan_destroy(conn);
}
@@ -355,10 +355,10 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
hci_dev_lock(hcon->hdev);
if (method == REQ_PASSKEY)
- ret = mgmt_user_passkey_request(hcon->hdev, conn->dst,
+ ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
hcon->type, hcon->dst_type);
else
- ret = mgmt_user_confirm_request(hcon->hdev, conn->dst,
+ ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
hcon->type, hcon->dst_type,
cpu_to_le32(passkey), 0);
@@ -388,11 +388,12 @@ static void confirm_work(struct work_struct *work)
if (conn->hcon->out)
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0,
- conn->src, conn->hcon->dst_type, conn->dst, res);
+ &conn->hcon->hdev->bdaddr, conn->hcon->dst_type,
+ &conn->hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
- conn->hcon->dst_type, conn->dst, 0, conn->src,
- res);
+ conn->hcon->dst_type, &conn->hcon->dst, 0,
+ &conn->hcon->hdev->bdaddr, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -427,10 +428,12 @@ static void random_work(struct work_struct *work)
if (hcon->out)
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0,
- conn->src, hcon->dst_type, conn->dst, res);
+ &hcon->hdev->bdaddr, hcon->dst_type, &hcon->dst,
+ res);
else
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
- hcon->dst_type, conn->dst, 0, conn->src, res);
+ hcon->dst_type, &hcon->dst, 0, &hcon->hdev->bdaddr,
+ res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -480,7 +483,7 @@ static void random_work(struct work_struct *work)
memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
- hci_add_ltk(hcon->hdev, conn->dst, hcon->dst_type,
+ hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, 0, stk, smp->enc_key_size,
ediv, rand);
}
@@ -715,7 +718,7 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
struct smp_ltk *key;
struct hci_conn *hcon = conn->hcon;
- key = hci_find_ltk_by_addr(hcon->hdev, conn->dst, hcon->dst_type);
+ key = hci_find_ltk_by_addr(hcon->hdev, &hcon->dst, hcon->dst_type);
if (!key)
return 0;
@@ -836,9 +839,9 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
skb_pull(skb, sizeof(*rp));
hci_dev_lock(hdev);
- authenticated = (conn->hcon->sec_level == BT_SECURITY_HIGH);
- hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
- HCI_SMP_LTK, 1, authenticated, smp->tk, smp->enc_key_size,
+ authenticated = (hcon->sec_level == BT_SECURITY_HIGH);
+ hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, HCI_SMP_LTK, 1,
+ authenticated, smp->tk, smp->enc_key_size,
rp->ediv, rp->rand);
smp_distribute_keys(conn, 1);
hci_dev_unlock(hdev);
@@ -986,7 +989,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
- hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
+ hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_LTK_SLAVE, 1, authenticated,
enc.ltk, smp->enc_key_size, ediv, ident.rand);
@@ -1008,7 +1011,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
/* Just public address */
memset(&addrinfo, 0, sizeof(addrinfo));
- bacpy(&addrinfo.bdaddr, conn->src);
+ bacpy(&addrinfo.bdaddr, &conn->hcon->hdev->bdaddr);
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
&addrinfo);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/4] Bluetooth: Remove l2cap_conn->dst usage from AMP manager
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->dst address is just a pointer into the hci_conn->dst
structure. Use hci_conn->dst directly instead.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/a2mp.c | 3 ++-
net/bluetooth/amp.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 7e25be3..60ca528 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -537,7 +537,8 @@ static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
goto send_rsp;
}
- hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, mgr->l2cap_conn->dst);
+ hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK,
+ &mgr->l2cap_conn->hcon->dst);
if (!hcon) {
BT_ERR("No phys link exist");
rsp.status = A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 5497ed3..bb39509 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -111,7 +111,7 @@ static u8 __next_handle(struct amp_mgr *mgr)
struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
u8 remote_id, bool out)
{
- bdaddr_t *dst = mgr->l2cap_conn->dst;
+ bdaddr_t *dst = &mgr->l2cap_conn->hcon->dst;
struct hci_conn *hcon;
hcon = hci_conn_add(hdev, AMP_LINK, dst);
@@ -410,7 +410,8 @@ void amp_create_logical_link(struct l2cap_chan *chan)
struct hci_cp_create_accept_logical_link cp;
struct hci_dev *hdev;
- BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst);
+ BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon,
+ &chan->conn->hcon->dst);
if (!hs_hcon)
return;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Bastien Nocera @ 2013-10-12 16:25 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Giovanni Campagna, linux-bluetooth, Giovanni Campagna
In-Reply-To: <0262656B-5656-422C-B12D-C6BF7239AA11@holtmann.org>
On Sat, 2013-10-12 at 18:08 +0200, Marcel Holtmann wrote:
> Hi Giovanni,
<snip>
> that is something your distro specific package should be fixing if
> that is needed. The focus is on integration with systemd and nothing
> else. You can use --disable-systemd and provide your own set of D-Bus
> service files.
There aren't any distributions that ship systemd for user sessions
though.
^ permalink raw reply
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Giovanni Campagna @ 2013-10-12 16:18 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <0262656B-5656-422C-B12D-C6BF7239AA11@holtmann.org>
2013/10/12 Marcel Holtmann <marcel@holtmann.org>:
> Hi Giovanni,
>
> [...]
>
> that is something your distro specific package should be fixing if that is needed. The focus is on integration with systemd and nothing else. You can use --disable-systemd and provide your own set of D-Bus service files.
I don't think shipping with upstream packages that require distro
patches in common configurations is a good idea (it breaks jhbuild
setups, for example), but ok, I filed
https://bugzilla.redhat.com/show_bug.cgi?id=1018496
Thanks for the quick answer,
Giovanni
^ permalink raw reply
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Marcel Holtmann @ 2013-10-12 16:08 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth, Giovanni Campagna
In-Reply-To: <1381592725-28212-1-git-send-email-scampa.giovanni@gmail.com>
Hi Giovanni,
> Not all sessions run systemd --user (actually, the majority
> doesn't), so the dbus daemon must be able to spawn obexd
> directly, and to do so it needs the full path of the daemon.
> ---
> Makefile.obexd | 4 ++--
> obexd/src/org.bluez.obex.service | 4 ----
> obexd/src/org.bluez.obex.service.in | 4 ++++
> 3 files changed, 6 insertions(+), 6 deletions(-)
> delete mode 100644 obexd/src/org.bluez.obex.service
> create mode 100644 obexd/src/org.bluez.obex.service.in
>
> diff --git a/Makefile.obexd b/Makefile.obexd
> index d5377cb..751e0e5 100644
> --- a/Makefile.obexd
> +++ b/Makefile.obexd
> @@ -2,12 +2,12 @@
> if SYSTEMD
> systemduserunitdir = @SYSTEMD_USERUNITDIR@
> systemduserunit_DATA = obexd/src/obex.service
> +endif
>
> dbussessionbusdir = @DBUS_SESSIONBUSDIR@
> dbussessionbus_DATA = obexd/src/org.bluez.obex.service
> -endif
>
> -EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
> +EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
>
> obex_plugindir = $(libdir)/obex/plugins
>
> diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
> deleted file mode 100644
> index a538088..0000000
> --- a/obexd/src/org.bluez.obex.service
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -[D-BUS Service]
> -Name=org.bluez.obex
> -Exec=/bin/false
> -SystemdService=dbus-org.bluez.obex.service
> diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
> new file mode 100644
> index 0000000..9c815f2
> --- /dev/null
> +++ b/obexd/src/org.bluez.obex.service.in
> @@ -0,0 +1,4 @@
> +[D-BUS Service]
> +Name=org.bluez.obex
> +Exec=@libexecdir@/obexd
> +SystemdService=dbus-org.bluez.obex.service
that is something your distro specific package should be fixing if that is needed. The focus is on integration with systemd and nothing else. You can use --disable-systemd and provide your own set of D-Bus service files.
Regards
Marcel
^ permalink raw reply
* [PATCH] Allow using obexd without systemd in the user session
From: Giovanni Campagna @ 2013-10-12 15:45 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Giovanni Campagna
From: Giovanni Campagna <gcampagna@src.gnome.org>
Not all sessions run systemd --user (actually, the majority
doesn't), so the dbus daemon must be able to spawn obexd
directly, and to do so it needs the full path of the daemon.
---
Makefile.obexd | 4 ++--
obexd/src/org.bluez.obex.service | 4 ----
obexd/src/org.bluez.obex.service.in | 4 ++++
3 files changed, 6 insertions(+), 6 deletions(-)
delete mode 100644 obexd/src/org.bluez.obex.service
create mode 100644 obexd/src/org.bluez.obex.service.in
diff --git a/Makefile.obexd b/Makefile.obexd
index d5377cb..751e0e5 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -2,12 +2,12 @@
if SYSTEMD
systemduserunitdir = @SYSTEMD_USERUNITDIR@
systemduserunit_DATA = obexd/src/obex.service
+endif
dbussessionbusdir = @DBUS_SESSIONBUSDIR@
dbussessionbus_DATA = obexd/src/org.bluez.obex.service
-endif
-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
+EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
obex_plugindir = $(libdir)/obex/plugins
diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
deleted file mode 100644
index a538088..0000000
--- a/obexd/src/org.bluez.obex.service
+++ /dev/null
@@ -1,4 +0,0 @@
-[D-BUS Service]
-Name=org.bluez.obex
-Exec=/bin/false
-SystemdService=dbus-org.bluez.obex.service
diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
new file mode 100644
index 0000000..9c815f2
--- /dev/null
+++ b/obexd/src/org.bluez.obex.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.bluez.obex
+Exec=@libexecdir@/obexd
+SystemdService=dbus-org.bluez.obex.service
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 2/2] Bluetooth: Unicast connectionless data reception is supported
From: Johan Hedberg @ 2013-10-12 15:32 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381591099-13207-2-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The unicast connectionless data reception feature is actually support
> and has been supported all along. Mark it as supported in the L2CAP
> features bitmask.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: The L2CAP fixed channel connectionless data is supported
From: Johan Hedberg @ 2013-10-12 15:32 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381591099-13207-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The implementation actually supports the L2CAP connectionless data
> channel. So set it as supported in the fixed channels bitmask.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/l2cap.h | 1 +
> net/bluetooth/l2cap_core.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH 2/2] Bluetooth: Unicast connectionless data reception is supported
From: Marcel Holtmann @ 2013-10-12 15:18 UTC (permalink / raw)
To: linux-bluetooth
The unicast connectionless data reception feature is actually support
and has been supported all along. Mark it as supported in the L2CAP
features bitmask.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 8b5437c..13bb9da 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -43,7 +43,7 @@
bool disable_ertm;
-static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
+static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN | L2CAP_FEAT_UCD;
static u8 l2cap_fixed_chan[8] = { L2CAP_FC_L2CAP | L2CAP_FC_CONNLESS, };
static LIST_HEAD(chan_list);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: The L2CAP fixed channel connectionless data is supported
From: Marcel Holtmann @ 2013-10-12 15:18 UTC (permalink / raw)
To: linux-bluetooth
The implementation actually supports the L2CAP connectionless data
channel. So set it as supported in the fixed channels bitmask.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_core.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 12523c7..56f540e 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -131,6 +131,7 @@ struct l2cap_conninfo {
/* L2CAP fixed channels */
#define L2CAP_FC_L2CAP 0x02
+#define L2CAP_FC_CONNLESS 0x04
#define L2CAP_FC_A2MP 0x08
/* L2CAP Control Field bit masks */
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index e932ffd..8b5437c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -44,7 +44,7 @@
bool disable_ertm;
static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
-static u8 l2cap_fixed_chan[8] = { L2CAP_FC_L2CAP, };
+static u8 l2cap_fixed_chan[8] = { L2CAP_FC_L2CAP | L2CAP_FC_CONNLESS, };
static LIST_HEAD(chan_list);
static DEFINE_RWLOCK(chan_list_lock);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2 1/2] Bluetooth: Limit security mode 4 level 0 to connection oriented channels
From: Johan Hedberg @ 2013-10-12 14:36 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381587572-63593-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The exception for certain PSM channels when it comes to security
> mode 4 level 0 should only be checked when actually a connection
> oriented channel is established.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 24 +++++++++++++++---------
> net/bluetooth/l2cap_sock.c | 10 +++++++---
> 2 files changed, 22 insertions(+), 12 deletions(-)
Both patches have been applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix PSM value for L2CAP connectionless data packets
From: Johan Hedberg @ 2013-10-12 14:35 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381582886-43884-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The put_unaligned() for setting the PSM is missing the (__le16 *)
> cast. Without this, the PSM information transmitted over the air
> are bogus.
>
> In addition, print the used PSM value in the debug message so this
> becomes easier to debug in the future.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH v2 2/2] Bluetooth: Allow 3D profile to use security mode 4 level 0
From: Marcel Holtmann @ 2013-10-12 14:19 UTC (permalink / raw)
To: linux-bluetooth
The PSM 0x0021 is dedicated to the 3D profile and has permission to
use security mode 4 level 0 for L2CAP connectionless unicast data
transfers.
When establishing a L2CAP connectionless channel on PSM 0x0021, it
will no longer force Secure Simple Pairing.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_core.c | 10 ++++++++++
net/bluetooth/l2cap_sock.c | 4 ++++
3 files changed, 15 insertions(+)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index f141b5f..12523c7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -237,6 +237,7 @@ struct l2cap_conn_rsp {
/* protocol/service multiplexer (PSM) */
#define L2CAP_PSM_SDP 0x0001
#define L2CAP_PSM_RFCOMM 0x0003
+#define L2CAP_PSM_3DSP 0x0021
/* channel indentifier */
#define L2CAP_CID_SIGNALING 0x0001
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index cc51cb8..e932ffd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -688,6 +688,16 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
return HCI_AT_NO_BONDING;
}
break;
+ case L2CAP_CHAN_CONN_LESS:
+ if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_3DSP)) {
+ if (chan->sec_level == BT_SECURITY_LOW)
+ chan->sec_level = BT_SECURITY_SDP;
+ }
+ if (chan->sec_level == BT_SECURITY_HIGH)
+ return HCI_AT_NO_BONDING_MITM;
+ else
+ return HCI_AT_NO_BONDING;
+ break;
case L2CAP_CHAN_CONN_ORIENTED:
if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) {
if (chan->sec_level == BT_SECURITY_LOW)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index bee98eb..bd6fe7f 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -101,6 +101,10 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
goto done;
switch (chan->chan_type) {
+ case L2CAP_CHAN_CONN_LESS:
+ if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_3DSP)
+ chan->sec_level = BT_SECURITY_SDP;
+ break;
case L2CAP_CHAN_CONN_ORIENTED:
if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
__le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 1/2] Bluetooth: Limit security mode 4 level 0 to connection oriented channels
From: Marcel Holtmann @ 2013-10-12 14:19 UTC (permalink / raw)
To: linux-bluetooth
The exception for certain PSM channels when it comes to security
mode 4 level 0 should only be checked when actually a connection
oriented channel is established.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 24 +++++++++++++++---------
net/bluetooth/l2cap_sock.c | 10 +++++++---
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index ab976a1..cc51cb8 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -677,7 +677,8 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
{
- if (chan->chan_type == L2CAP_CHAN_RAW) {
+ switch (chan->chan_type) {
+ case L2CAP_CHAN_RAW:
switch (chan->sec_level) {
case BT_SECURITY_HIGH:
return HCI_AT_DEDICATED_BONDING_MITM;
@@ -686,15 +687,19 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
default:
return HCI_AT_NO_BONDING;
}
- } else if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) {
- if (chan->sec_level == BT_SECURITY_LOW)
- chan->sec_level = BT_SECURITY_SDP;
+ break;
+ case L2CAP_CHAN_CONN_ORIENTED:
+ if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) {
+ if (chan->sec_level == BT_SECURITY_LOW)
+ chan->sec_level = BT_SECURITY_SDP;
- if (chan->sec_level == BT_SECURITY_HIGH)
- return HCI_AT_NO_BONDING_MITM;
- else
- return HCI_AT_NO_BONDING;
- } else {
+ if (chan->sec_level == BT_SECURITY_HIGH)
+ return HCI_AT_NO_BONDING_MITM;
+ else
+ return HCI_AT_NO_BONDING;
+ }
+ /* fall through */
+ default:
switch (chan->sec_level) {
case BT_SECURITY_HIGH:
return HCI_AT_GENERAL_BONDING_MITM;
@@ -703,6 +708,7 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
default:
return HCI_AT_NO_BONDING;
}
+ break;
}
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 69e42db..bee98eb 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -100,9 +100,13 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
if (err < 0)
goto done;
- if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
- __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
- chan->sec_level = BT_SECURITY_SDP;
+ switch (chan->chan_type) {
+ case L2CAP_CHAN_CONN_ORIENTED:
+ if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
+ __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
+ chan->sec_level = BT_SECURITY_SDP;
+ break;
+ }
bacpy(&bt_sk(sk)->src, &la.l2_bdaddr);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Allow 3D profile to use security mode 4 level 0
From: Marcel Holtmann @ 2013-10-12 13:58 UTC (permalink / raw)
To: linux-bluetooth
The PSM 0x0021 is dedicated to the 3D profile and has permission to
use security mode 4 level 0 for L2CAP connectionless unicast data
transfers.
When establishing a L2CAP connectionless channel on PSM 0x0021, it
will no longer force Secure Simple Pairing.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_sock.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index f141b5f..12523c7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -237,6 +237,7 @@ struct l2cap_conn_rsp {
/* protocol/service multiplexer (PSM) */
#define L2CAP_PSM_SDP 0x0001
#define L2CAP_PSM_RFCOMM 0x0003
+#define L2CAP_PSM_3DSP 0x0021
/* channel indentifier */
#define L2CAP_CID_SIGNALING 0x0001
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index bee98eb..bd6fe7f 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -101,6 +101,10 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
goto done;
switch (chan->chan_type) {
+ case L2CAP_CHAN_CONN_LESS:
+ if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_3DSP)
+ chan->sec_level = BT_SECURITY_SDP;
+ break;
case L2CAP_CHAN_CONN_ORIENTED:
if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
__le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Limit security mode 4 level 0 to connection oriented channels
From: Marcel Holtmann @ 2013-10-12 13:46 UTC (permalink / raw)
To: linux-bluetooth
The exception for SDP and RFCOMM channels when it comes to security
mode 4 level 0 should only be checked when actually a connection
oriented channel is established.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_sock.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 69e42db..bee98eb 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -100,9 +100,13 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
if (err < 0)
goto done;
- if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
- __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
- chan->sec_level = BT_SECURITY_SDP;
+ switch (chan->chan_type) {
+ case L2CAP_CHAN_CONN_ORIENTED:
+ if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
+ __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)
+ chan->sec_level = BT_SECURITY_SDP;
+ break;
+ }
bacpy(&bt_sk(sk)->src, &la.l2_bdaddr);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Fix PSM value for L2CAP connectionless data packets
From: Marcel Holtmann @ 2013-10-12 13:01 UTC (permalink / raw)
To: linux-bluetooth
The put_unaligned() for setting the PSM is missing the (__le16 *)
cast. Without this, the PSM information transmitted over the air
are bogus.
In addition, print the used PSM value in the debug message so this
becomes easier to debug in the future.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a7d10c3..ab976a1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2283,7 +2283,8 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
int err, count, hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE;
struct l2cap_hdr *lh;
- BT_DBG("chan %p len %zu priority %u", chan, len, priority);
+ BT_DBG("chan %p psm 0x%2.2x len %zu priority %u", chan,
+ __le16_to_cpu(chan->psm), len, priority);
count = min_t(unsigned int, (conn->mtu - hlen), len);
@@ -2298,7 +2299,7 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
lh->cid = cpu_to_le16(chan->dcid);
lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE);
- put_unaligned(chan->psm, skb_put(skb, L2CAP_PSMLEN_SIZE));
+ put_unaligned(chan->psm, (__le16 *) skb_put(skb, L2CAP_PSMLEN_SIZE));
err = l2cap_skbuff_fromiovec(chan, msg, len, count, skb);
if (unlikely(err < 0)) {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Fix HCI init for 1st generation BlueFRITZ! devices
From: Johan Hedberg @ 2013-10-12 6:47 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381534927-27310-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Fri, Oct 11, 2013, Marcel Holtmann wrote:
> The 1st generation of BlueFRITZ! devices from AVM Berlin pretend
> to be HCI version 1.2 controllers, but they are not. They are simple
> Bluetooth 1.1 devices.
>
> Since this company never created any newer controllers, it is safe
> to use the manufacturer ID instead of an USB quirk.
>
> < HCI Command: Read Page Scan Activity (0x03|0x001b) plen 0
> > HCI Event: Command Complete (0x0e) plen 8
> Read Page Scan Activity (0x03|0x001b) ncmd 1
> Status: Success (0x00)
> Interval: 1280.000 msec (0x0800)
> Window: 21.250 msec (0x0022)
> < HCI Command: Read Page Scan Type (0x03|0x0046) plen 0
> > HCI Event: Command Status (0x0f) plen 4
> Read Page Scan Type (0x03|0x0046) ncmd 1
> Status: Unknown HCI Command (0x01)
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hci_core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Add MGMT_OP_SET_SCAN_PARAMS to supported commands list
From: Johan Hedberg @ 2013-10-12 6:47 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381527898-10784-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Fri, Oct 11, 2013, Marcel Holtmann wrote:
> When adding support for MGMT_OP_SET_SCAN_PARAMS command the addition
> to the supported commands list has been forgotten. This is needed
> for userspace to detect if the command is supported or not.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 1 +
> 1 file changed, 1 insertion(+)
Applied to bluetooth-next. Thanke.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Fix HCI init for 1st generation BlueFRITZ! devices
From: Marcel Holtmann @ 2013-10-11 23:42 UTC (permalink / raw)
To: linux-bluetooth
The 1st generation of BlueFRITZ! devices from AVM Berlin pretend
to be HCI version 1.2 controllers, but they are not. They are simple
Bluetooth 1.1 devices.
Since this company never created any newer controllers, it is safe
to use the manufacturer ID instead of an USB quirk.
< HCI Command: Read Page Scan Activity (0x03|0x001b) plen 0
> HCI Event: Command Complete (0x0e) plen 8
Read Page Scan Activity (0x03|0x001b) ncmd 1
Status: Success (0x00)
Interval: 1280.000 msec (0x0800)
Window: 21.250 msec (0x0022)
< HCI Command: Read Page Scan Type (0x03|0x0046) plen 0
> HCI Event: Command Status (0x0f) plen 4
Read Page Scan Type (0x03|0x0046) ncmd 1
Status: Unknown HCI Command (0x01)
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/hci_core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8f70a35..082f396 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -353,6 +353,8 @@ static void hci_init1_req(struct hci_request *req, unsigned long opt)
static void bredr_setup(struct hci_request *req)
{
+ struct hci_dev *hdev = req->hdev;
+
__le16 param;
__u8 flt_type;
@@ -376,8 +378,10 @@ static void bredr_setup(struct hci_request *req)
param = __constant_cpu_to_le16(0x7d00);
hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, ¶m);
- /* Read page scan parameters */
- if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) {
+ /* AVM Berlin (31), aka "BlueFRITZ!", reports version 1.2,
+ * but it does not support page scan related HCI commands.
+ */
+ if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) {
hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
}
--
1.8.3.1
^ permalink raw reply related
* [RFC] Bluetooth: Add command for setting 3D information data
From: Marcel Holtmann @ 2013-10-11 22:14 UTC (permalink / raw)
To: linux-bluetooth
This commands allows to program the 3D information data so it
can later be used when setting the Extended Inquiry Information.
The 3D profile is flexible on the parameter length of this field
and allows for future extensions. So make the input parameter to
this command also flexible.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci.h | 1 +
include/net/bluetooth/hci_core.h | 2 ++
include/net/bluetooth/mgmt.h | 7 +++++++
net/bluetooth/mgmt.c | 45 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 55 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index c8a91cb..944ff04 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -358,6 +358,7 @@ enum {
#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
#define EIR_DEVICE_ID 0x10 /* device ID */
+#define EIR_3D_INFO_DATA 0x3D /* 3D information */
/* Low Energy Advertising Flags */
#define LE_AD_LIMITED 0x01 /* Limited Discoverable */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6900454..d55f353 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -171,6 +171,8 @@ struct hci_dev {
__u16 devid_vendor;
__u16 devid_product;
__u16 devid_version;
+ __u8 data_3d_len;
+ __u8 data_3d[2];
__u16 pkt_type;
__u16 esco_type;
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 518c5c8..95efb75 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -369,6 +369,13 @@ struct mgmt_cp_set_scan_params {
} __packed;
#define MGMT_SET_SCAN_PARAMS_SIZE 4
+#define MGMT_OP_SET_3D_INFO 0x002D
+struct mgmt_cp_set_3d_info {
+ __u8 len;
+ __u8 data[0];
+} __packed;
+#define MGMT_SET_3D_INFO_SIZE 1
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
__le16 opcode;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 338878c..c558571 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -79,6 +79,7 @@ static const u16 mgmt_commands[] = {
MGMT_OP_SET_BREDR,
MGMT_OP_SET_STATIC_ADDRESS,
MGMT_OP_SET_SCAN_PARAMS,
+ MGMT_OP_SET_3D_INFO,
};
static const u16 mgmt_events[] = {
@@ -579,6 +580,15 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
ptr += 10;
}
+ if (hdev->data_3d_len > 0) {
+ ptr[0] = hdev->data_3d_len + 1;
+ ptr[1] = EIR_3D_INFO_DATA;
+
+ memcpy(ptr + 2, hdev->data_3d, hdev->data_3d_len);
+
+ ptr += (hdev->data_3d_len + 2);
+ }
+
ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
@@ -3413,6 +3423,40 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
return err;
}
+static int set_3d_info(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 len)
+{
+ struct mgmt_cp_set_3d_info *cp = data;
+ struct hci_request req;
+ int err;
+
+ BT_DBG("request for %s", hdev->name);
+
+ if (!lmp_bredr_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_3D_INFO,
+ MGMT_STATUS_NOT_SUPPORTED);
+
+ if (cp->len > 2)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_3D_INFO,
+ MGMT_STATUS_INVALID_PARAMS);
+
+ hci_dev_lock(hdev);
+
+ hdev->data_3d_len = cp->len;
+ if (cp->len > 0)
+ memcpy(hdev->data_3d, cp->data, cp->len);
+
+ err = cmd_complete(sk, hdev->id, MGMT_OP_SET_3D_INFO, 0, NULL, 0);
+
+ hci_req_init(&req, hdev);
+ update_eir(&req);
+ hci_req_run(&req, NULL);
+
+ hci_dev_unlock(hdev);
+
+ return err;
+}
+
static void fast_connectable_complete(struct hci_dev *hdev, u8 status)
{
struct pending_cmd *cmd;
@@ -3750,6 +3794,7 @@ static const struct mgmt_handler {
{ set_bredr, false, MGMT_SETTING_SIZE },
{ set_static_address, false, MGMT_SET_STATIC_ADDRESS_SIZE },
{ set_scan_params, false, MGMT_SET_SCAN_PARAMS_SIZE },
+ { set_3d_info, true, MGMT_SET_3D_INFO_SIZE },
};
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Add MGMT_OP_SET_SCAN_PARAMS to supported commands list
From: Marcel Holtmann @ 2013-10-11 21:44 UTC (permalink / raw)
To: linux-bluetooth
When adding support for MGMT_OP_SET_SCAN_PARAMS command the addition
to the supported commands list has been forgotten. This is needed
for userspace to detect if the command is supported or not.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index aa59490..338878c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -78,6 +78,7 @@ static const u16 mgmt_commands[] = {
MGMT_OP_SET_ADVERTISING,
MGMT_OP_SET_BREDR,
MGMT_OP_SET_STATIC_ADDRESS,
+ MGMT_OP_SET_SCAN_PARAMS,
};
static const u16 mgmt_events[] = {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Don't advertise high speed support without SSP
From: Johan Hedberg @ 2013-10-11 20:59 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381510127-1094-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Fri, Oct 11, 2013, Marcel Holtmann wrote:
> It is not allowed to enable high speed support when Secure Simple
> Pairing is not available or disabled.
>
> However the support for high speed gets advertised on a controller
> that does not even support Secure Simple Pairing. Since there is
> no way to enable high speed support on such a controller, do not
> even advertise its support.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix endless loop with HCI_QUIRK_RESET_ON_CLOSE
From: Johan Hedberg @ 2013-10-11 20:59 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381509852-64080-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Fri, Oct 11, 2013, Marcel Holtmann wrote:
> Really early versions of the Bluetooth specification were unclear
> with the behavior of HCI Reset for USB devices. They assumed that
> also an USB reset needs to be issued. Later Bluetooth specifications
> cleared this out and it is safe to call HCI Reset without affecting
> the transport.
>
> For old devices that misbehave, the HCI_QUIRK_RESET_ON_CLOSE quirk
> was introduced to postpone the HCI Reset until the device was no
> longer in use.
>
> One of these devices is the Digianswer BPA-105 Bluetooth Protocol
> Analyzer. The only problem now is that with the quirk set, the
> HCI Reset is also executed at the end of the setup phase. So the
> controller gets configured and then it disconnects from the USB
> bus, connects again, gets configured and of course disconnects
> again. This game goes on forever.
>
> For devices that need HCI_QUIRK_RESET_ON_CLOSE it is important
> that the HCI Reset is not executed after the setup phase. In
> specific when HCI_AUTO_OFF is set, do not call HCI Reset when
> closing the device.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hci_core.c | 1 +
> 1 file changed, 1 insertion(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
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