* [RFC] Bluetooth: Provide mgmt API for reading list of supported codecs
From: Michael Knudsen @ 2012-11-20 14:27 UTC (permalink / raw)
To: linux-bluetooth
Provide an API for allowing user space to read the list of codecs
supported by a given controller. For now the list is hardwired in
hci_core but later devices that support the appropriate HCI command
will read out the actual list during controller initialisation.
The intention is that this should be used together with the socket
options that I mailed out a diff for earlier.
Comments?
Specifically, I wonder if it is too much to embed the codecs buffer
in the structure since most of the time very little of it will be
used.
Maybe this needs to be split into multiple diffs, but for now here
it is in one go.
-m.
---
include/net/bluetooth/hci.h | 9 +++++++++
include/net/bluetooth/hci_core.h | 2 ++
include/net/bluetooth/mgmt.h | 7 +++++++
net/bluetooth/hci_core.c | 5 +++++
net/bluetooth/mgmt.c | 36
++++++++++++++++++++++++++++++++++++
5 files changed, 59 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 45eee08..9455cbe 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -283,6 +283,15 @@ enum {
#define HCI_LM_RELIABLE 0x0010
#define HCI_LM_SECURE 0x0020
+/* Coding Format */
+#define HCI_FORMAT_ULAW 0x00
+#define HCI_FORMAT_ALAW 0x01
+#define HCI_FORMAT_CVSD 0x02
+#define HCI_FORMAT_TRANSPARENT 0x03
+#define HCI_FORMAT_PCM 0x04
+#define HCI_FORMAT_MSBC 0x05
+#define HCI_FORMAT_VENDOR 0xff
+
/* Authentication types */
#define HCI_AT_NO_BONDING 0x00
#define HCI_AT_NO_BONDING_MITM 0x01
diff --git a/include/net/bluetooth/hci_core.h
b/include/net/bluetooth/hci_core.h
index ef5b85d..79fe128 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -153,6 +153,8 @@ struct hci_dev {
__u8 features[8];
__u8 host_features[8];
__u8 commands[64];
+ __u8 codecs;
+ __u8 codec[255];
__u8 hci_ver;
__u16 hci_rev;
__u8 lmp_ver;
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 22980a7..523dc58 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -350,6 +350,13 @@ struct mgmt_cp_set_device_id {
} __packed;
#define MGMT_SET_DEVICE_ID_SIZE 8
+#define MGMT_OP_READ_CODECS 0x0029
+#define MGMT_READ_CODECS_SIZE 0
+struct mgmt_rp_read_codecs {
+ __u8 count;
+ __u8 codec[0];
+} __packed;
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
__le16 opcode;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e3a49db..cbc7c62 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1706,6 +1706,11 @@ struct hci_dev *hci_alloc_dev(void)
hdev->sniff_max_interval = 800;
hdev->sniff_min_interval = 80;
+ hdev->codecs = 3;
+ hdev->codec[0] = HCI_FORMAT_CVSD;
+ hdev->codec[1] = HCI_FORMAT_PCM;
+ hdev->codec[2] = HCI_FORMAT_TRANSPARENT;
+
mutex_init(&hdev->lock);
mutex_init(&hdev->req_lock);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dedbb1d..a47fda2 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -76,6 +76,7 @@ static const u16 mgmt_commands[] = {
MGMT_OP_BLOCK_DEVICE,
MGMT_OP_UNBLOCK_DEVICE,
MGMT_OP_SET_DEVICE_ID,
+ MGMT_OP_READ_CODECS,
};
static const u16 mgmt_events[] = {
@@ -319,6 +320,40 @@ static int read_commands(struct sock *sk, struct
hci_dev *hdev, void *data,
return err;
}
+static int read_codecs(struct sock *sk, struct hci_dev *hdev, void *data,
+ u16 len)
+{
+ struct mgmt_rp_read_codecs *rp;
+ int err;
+ size_t rp_size;
+
+ BT_DBG("sock %p %s", sk, hdev->name);
+
+ hci_dev_lock(hdev);
+
+ rp_size = sizeof(*rp) + hdev->codecs;
+
+ rp = kmalloc(rp_size, GFP_KERNEL);
+ if (!rp) {
+ hci_dev_unlock(hdev);
+ return -ENOMEM;
+ }
+
+ memset(rp, 0, sizeof(rp));
+
+ rp->count = hdev->codecs;
+ memcpy(rp->codec, hdev->codec, hdev->codecs);
+
+ hci_dev_unlock(hdev);
+
+ err = cmd_complete(sk, hdev->id, MGMT_OP_READ_CODECS, 0, rp,
+ rp_size);
+
+ kfree(rp);
+
+ return err;
+}
+
static int read_index_list(struct sock *sk, struct hci_dev *hdev, void
*data,
u16 data_len)
{
@@ -2748,6 +2783,7 @@ static const struct mgmt_handler {
{ block_device, false, MGMT_BLOCK_DEVICE_SIZE },
{ unblock_device, false, MGMT_UNBLOCK_DEVICE_SIZE },
{ set_device_id, false, MGMT_SET_DEVICE_ID_SIZE },
+ { read_codecs, true, MGMT_READ_CODECS_SIZE },
};
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 0/3] Fix corrupted SDP response for sequence size > 256
From: Johan Hedberg @ 2012-11-20 12:57 UTC (permalink / raw)
To: Bart Westgeest; +Cc: linux-bluetooth
In-Reply-To: <1353351872-10628-1-git-send-email-bart@elbrys.com>
Hi Bart,
On Mon, Nov 19, 2012, Bart Westgeest wrote:
> This patchset includes minor refactoring and a bug fix. The bug
> is exposed when a data sequence grows beyond 256 bytes, in this case the
> complete sequence data is written, but the size is truncated to one
> byte, resulting in a corrupted SDP response.
>
> RE: Feedback on potential fix for issue while advertising Feature List
>
> Bart Westgeest (3):
> sdp: Inlined single use of function sdp_set_data_type
> sdp: Limit side effects of sdp_get_data_type and sdp_get_data_size
> sdp: Upgrade datatype SEQ8 to SEQ16 when data size is greater than
> 256
>
> lib/sdp.c | 56 +++++++++++++++++++++++---------------------------------
> 1 file changed, 23 insertions(+), 33 deletions(-)
I'm happy with these as well as your responses to the feedback you got,
so the patches are now pushed upstream.
Regarding the SDP code needing cleanups/fixing/rewriting in general, we
know :) This is one of the oldest pieces of code in the stack which
could definitely use a rewrite. However, no one has come along with the
time to do it yet.
Johan
^ permalink raw reply
* Re: [PATCH] hid2hci: change subsystem in udev rule from usb to usb*
From: Alexander Holler @ 2012-11-20 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <20121120122345.GA14255@x220.ger.corp.intel.com>
Am 20.11.2012 13:23, schrieb Johan Hedberg:
> Thanks. The patch has been applied (after fixing up the commit message
> to not include the signed-off-by and to have sensible line widths).
Thanks and sorry for the long lines. I've used to use the comments as
reference (when invoking git commit), but unfortunately they got longer
since they recently got translated (to german) when using LANG != C.
Regards,
Alexander
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Remove OOB data if device was discovered in band
From: Johan Hedberg @ 2012-11-20 12:24 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1353407934-17831-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Tue, Nov 20, 2012, Szymon Janc wrote:
> OOB authentication mechanism should be used only if pairing process
> has been activated by previous OOB information exchange (Core Spec
> 4.0 , vol. 1, Part A, 5.1.4.3). Stored OOB data for specific device
> should be removed if that device was discovered in band later on.
>
> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
> V2:
> Move OOB data removal to hci_inquiry_cache_update to cover all inquiry
> events (ext/rssi) in one place.
>
> net/bluetooth/hci_core.c | 2 ++
> 1 file changed, 2 insertions(+)
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Johan
^ permalink raw reply
* Re: [PATCH] hid2hci: change subsystem in udev rule from usb to usb*
From: Johan Hedberg @ 2012-11-20 12:23 UTC (permalink / raw)
To: Alexander Holler; +Cc: linux-bluetooth
In-Reply-To: <1353412028-5677-1-git-send-email-holler@ahsoftware.de>
Hi Alexander,
On Tue, Nov 20, 2012, Alexander Holler wrote:
> With kernel 3.6 (commit 7e97243c2080ecae7129e83635227fdebd4feef6) the class for some
> devices (e.g. dongles from Logitech) were changed from usb to usbmisc. As consequence
> the udev rule for hid2hci didn't work anymore with kernels >= 3.6.
>
> Changing the subsystem from "usb" to "usb*" matches both "usb" and "usbmisc" and works
> with all kernels.
>
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
> scripts/bluetooth-hid2hci.rules | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks. The patch has been applied (after fixing up the commit message
to not include the signed-off-by and to have sensible line widths).
Johan
^ permalink raw reply
* Sco issue:iogear dongle
From: Deepthi @ 2012-11-20 12:12 UTC (permalink / raw)
To: linux-bluetooth
Hello,
I 'm facing an issue regarding the sco data transfer in iogear dongle
4.0 in linux-3.2.5 kernel version. sco is connected with sco handle as
1, but i could see no sco data transfer .
Please help,
--
Thanks & Regards,
Deepthi Elizabeth P V
^ permalink raw reply
* Re: [PATCH v2 0/8] Adopt btd_profile for A2DP
From: Luiz Augusto von Dentz @ 2012-11-20 11:47 UTC (permalink / raw)
To: Mikel Astiz; +Cc: linux-bluetooth@vger.kernel.org, Mikel Astiz
In-Reply-To: <1352964460-8531-1-git-send-email-mikel.astiz.oss@gmail.com>
Hi Mikel,
On Thu, Nov 15, 2012 at 9:27 AM, Mikel Astiz <mikel.astiz.oss@gmail.com> wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
>
> The proposal is to split A2DP roles into different btd_profile instances, in order to expose .connect and .disconnect.
>
> The changes in v2 include:
>
> - Renaming of functions as suggested by Luiz (avoid using local_xxx)
> - Merge of source_shutdown and source_disconnect: they were quite similar and having a generalized function seems a better idea (to be discussed if we can get rid of the gboolean shutdown parameter)
> - New patches have been added to address the sink part as well (v1 focused on the source role)
>
> Mikel Astiz (8):
> audio: Trivial function renames
> sink: Generalize disconnection function
> source: Add missing code in source_disconnect()
> source: Expose internal connection API
> sink: Expose internal connection API
> audio: Split A2DP into three btd_profile
> source: Add profile .connect and .disconnect
> sink: Add profile .connect and .disconnect
>
> profiles/audio/a2dp.c | 88 ++++++++---------
> profiles/audio/a2dp.h | 4 +-
> profiles/audio/device.c | 4 +-
> profiles/audio/device.h | 3 +
> profiles/audio/manager.c | 242 +++++++++++++++++++++++++++++++++++++++++++----
> profiles/audio/sink.c | 179 ++++++++++++++++++-----------------
> profiles/audio/sink.h | 4 +-
> profiles/audio/source.c | 189 ++++++++++++++++++++----------------
> profiles/audio/source.h | 4 +-
> 9 files changed, 480 insertions(+), 237 deletions(-)
>
> --
> 1.7.11.7
First 5 patches are now pushed, I had to changed sink_disconnect and
source_disconnect since they were crashing. Please rebase the rest and
reasend.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH] hid2hci: change subsystem in udev rule from usb to usb*
From: Alexander Holler @ 2012-11-20 11:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Alexander Holler
In-Reply-To: <50AB6B96.20209@ahsoftware.de>
With kernel 3.6 (commit 7e97243c2080ecae7129e83635227fdebd4feef6) the class for some
devices (e.g. dongles from Logitech) were changed from usb to usbmisc. As consequence
the udev rule for hid2hci didn't work anymore with kernels >= 3.6.
Changing the subsystem from "usb" to "usb*" matches both "usb" and "usbmisc" and works
with all kernels.
Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
scripts/bluetooth-hid2hci.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/bluetooth-hid2hci.rules b/scripts/bluetooth-hid2hci.rules
index 0687c8a..db6bb03 100644
--- a/scripts/bluetooth-hid2hci.rules
+++ b/scripts/bluetooth-hid2hci.rules
@@ -1,7 +1,7 @@
# do not edit this file, it will be overwritten on update
ACTION=="remove", GOTO="hid2hci_end"
-SUBSYSTEM!="usb", GOTO="hid2hci_end"
+SUBSYSTEM!="usb*", GOTO="hid2hci_end"
# Variety of Dell Bluetooth devices - match on a mouse device that is
# self powered and where a HID report needs to be sent to switch modes
--
1.7.11.7
^ permalink raw reply related
* udev rule for hid2hci and Logitech dongles doesn't work with kernels >= 3.6
From: Alexander Holler @ 2012-11-20 11:37 UTC (permalink / raw)
To: linux-bluetooth
Hello,
I've recently noticed that the udev rule for hid2hci with Logitech
dongles doesn't work anymore. The reason is commit
7e97243c2080ecae7129e83635227fdebd4feef6 which changes the class
(subsystem) for those dongles from usb to usbmisc. I've already filed a
bug for Fedora (https://bugzilla.redhat.com/show_bug.cgi?id=877998) but
I thought I should write a note here too, to inform non-Fedora users too.
My suggestion is to use "usb*" instead of "usb" for the subsystem, this
works with all kernels regardless if the subsystem is "usb" or "usbmisc".
Regards,
Alexander
^ permalink raw reply
* Re: [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets
From: Frédéric Dalleau @ 2012-11-20 10:39 UTC (permalink / raw)
To: Gustavo Padovan, linux-bluetooth
In-Reply-To: <20121119201958.GA14006@joana>
Hi Gustavo,
On 11/19/2012 09:19 PM, Gustavo Padovan wrote:
> Hi Frédéric,
>
> * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-19 17:35:55 +0100]:
>> Regarding testing, I'm still stuck by a txt timeout issue however, if the
>> delay between accept and recv is set to 0, then the connection is working fine.
>> And I even managed to get the sco connection established correctly once. So I
>> believed this emulator problem.
>
> You are telling me that your patch is not really working, I suggest you call
> this series RFC before you get everything sorted out. The approach in general
> is good, but I'd need confirmation that it works for actual defer delays, 3
> seconds for example, and not 0.
Sorry, I have been a bit premature, but for the reason explained
above I was confident.
So now I'm quite happy to say I successfully tested this series this
morning, based on bluetooth-next, using delays from 0 to 35 secs several
times in a row.
Regards,
Frédéric
^ permalink raw reply
* [PATCH v2] Bluetooth: Remove OOB data if device was discovered in band
From: Szymon Janc @ 2012-11-20 10:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
OOB authentication mechanism should be used only if pairing process
has been activated by previous OOB information exchange (Core Spec
4.0 , vol. 1, Part A, 5.1.4.3). Stored OOB data for specific device
should be removed if that device was discovered in band later on.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
V2:
Move OOB data removal to hci_inquiry_cache_update to cover all inquiry
events (ext/rssi) in one place.
net/bluetooth/hci_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e3a49db..81f4bac 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -434,6 +434,8 @@ bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
BT_DBG("cache %p, %pMR", cache, &data->bdaddr);
+ hci_remove_remote_oob_data(hdev, &data->bdaddr);
+
if (ssp)
*ssp = data->ssp_mode;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 1/4] neard: Use ENONET error when adapter is not enabled
From: Johan Hedberg @ 2012-11-20 10:25 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1353337438-21865-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Mon, Nov 19, 2012, Szymon Janc wrote:
> This results in returning error 'Disabled' instead of 'No such Device'.
> Will allow neard to properly set power state of Bluetooth carrier.
> ---
> plugins/neard.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
All four patches have been applied after some minor coding style fixes
in patches 3 and 4. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 0/2] Add support for SCO defered setup in test
From: Johan Hedberg @ 2012-11-20 10:22 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1353340244-16443-1-git-send-email-frederic.dalleau@linux.intel.com>
Hi Frederic,
On Mon, Nov 19, 2012, Frédéric Dalleau wrote:
> This adds support for deferred setup in userspace test tools for SCO
> connections.
>
> Regards,
> Frédéric
>
> Frédéric Dalleau (2):
> scotest: Add deferred setup option
> btiotest: Enable deferred setup for sco sockets
>
> test/btiotest.c | 22 +++++++++++++++-----
> test/scotest.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 72 insertions(+), 10 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ] audio: Auto connect AVRCP in case of A2DP source is connected
From: Johan Hedberg @ 2012-11-20 9:23 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1353402781-21791-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Nov 20, 2012, Luiz Augusto von Dentz wrote:
> This enables the same logic used for A2DP sink, so it attempt to
> connect AVRCP if remote device support it.
>
> Note this is necessary for some devices e.g. WP7 that don't connect
> even when being the initiator because it is not mandatory for target
> to do so even though it is recommended to avoid collisions while trying
> to estabilish the connection.
> ---
> profiles/audio/device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ] audio: Auto connect AVRCP in case of A2DP source is connected
From: Luiz Augusto von Dentz @ 2012-11-20 9:13 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This enables the same logic used for A2DP sink, so it attempt to
connect AVRCP if remote device support it.
Note this is necessary for some devices e.g. WP7 that don't connect
even when being the initiator because it is not mandatory for target
to do so even though it is recommended to avoid collisions while trying
to estabilish the connection.
---
profiles/audio/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index df57d81..5176a60 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -269,7 +269,7 @@ static void device_avdtp_cb(struct audio_device *dev, struct avdtp *session,
avdtp_session_state_t new_state,
void *user_data)
{
- if (!dev->sink || !dev->control)
+ if (!dev->control)
return;
if (new_state == AVDTP_SESSION_STATE_CONNECTED) {
--
1.7.11.7
^ permalink raw reply related
* Re: [PATCH] bluetooth: Increase HCI command tx timeout
From: Gustavo Padovan @ 2012-11-19 21:57 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1352714465-17015-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
* Szymon Janc <szymon.janc@tieto.com> [2012-11-12 11:01:05 +0100]:
> Read Local OOB Data command can take more than 1 second on some chips.
> e.g. on CSR 0a12:0001 first call to Read Local OOB Data after reset
> takes about 1300ms resulting in tx timeout error.
>
> [27698.368655] Bluetooth: hci0 command 0x0c57 tx timeout
>
> 2012-10-31 15:53:36.178585 < HCI Command: Read Local OOB Data (0x03|0x0057) plen 0
> 2012-10-31 15:53:37.496996 > HCI Event: Command Complete (0x0e) plen 36
> Read Local OOB Data (0x03|0x0057) ncmd 1
> status 0x00
> hash 0x92219d9b447f2aa9dc12dda2ae7bae6a
> randomizer 0xb1948d0febe4ea38ce85c4e66313beba
>
> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
>
> Spec doesn't seem to be posing any restrictions on how fast should HCI response...
> I've increased timeout to 2 secs as this seems to fix this for me, but maybe this
> could be increased to something more, like 5 secs or sth to minimize tx timeout
> chance for other slow chips? If chip doesn't response for command it is FUBAR
> anyway and having longer timeout would not make things that much worse (and
> could even improve things on slow chips..).
>
>
> include/net/bluetooth/hci.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
This patch is now on bluetooth-next. Thanks. Moreover there was never a real
reason to have the timeout with a 1 second value, it just proved to be enough
at the time we added the timeout mechanism for hci commands.
Gustavo
^ permalink raw reply
* Re: [PATCHv2] Bluetooth: Add support for BCM20702A0 [0b05, 17b5]
From: Gustavo Padovan @ 2012-11-19 21:41 UTC (permalink / raw)
To: Jeff Cook; +Cc: linux-bluetooth, marcel, johan.hedberg, linux-kernel
In-Reply-To: <1352504388-28965-1-git-send-email-jeff@deserettechnology.com>
Hi Jeff,
* Jeff Cook <jeff@deserettechnology.com> [2012-11-09 16:39:48 -0700]:
> Vendor-specific ID for BCM20702A0.
> Support for bluetooth over Asus Wi-Fi GO!, included with Asus P8Z77-V
> Deluxe.
>
> T: Bus=07 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=0b05 ProdID=17b5 Rev=01.12
> S: Manufacturer=Broadcom Corp
> S: Product=BCM20702A0
> S: SerialNumber=94DBC98AC113
> C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
> I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
> I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
> I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
> I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
>
> Signed-off-by: Jeff Cook <jeff@deserettechnology.com>
> ---
> drivers/bluetooth/btusb.c | 1 +
> 1 file changed, 1 insertion(+)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
From: Gustavo Padovan @ 2012-11-19 21:36 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352907572-7113-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-11-14 17:39:32 +0200]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
All 3 patches have been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 3/3] sdp: Upgrade datatype SEQ8 to SEQ16 when data size is greater than 256
From: Bart Westgeest @ 2012-11-19 21:33 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_N1hJkdEqvOrgD8ErAzDT56wzPEYAiA+7KDR0Pah4P6sA@mail.gmail.com>
Hi Anderson,
>> +recalculate:
>> + pdu_size = sdp_get_data_type_size(d->dtd);
>> buf->data_size += pdu_size;
>>
>> data_size = sdp_get_data_size(buf, d);
>> + if (data_size > UCHAR_MAX && d->dtd == SDP_SEQ8) {
>> + buf->data_size = orig_data_size;
>> + d->dtd = SDP_SEQ16;
>> + goto recalculate;
>
> IMHO, using "goto" here is too complicated for 3 lines of code that
> will just be run at most twice. So I would simply duplicate them
> inside the if(). But others may have different opinion on this regard.
I don't have strong feelings about this. I can change it.
One could argue that the way I did it shows that the *same* code needs
to be executed again. (It the same code can also be moved into a
do-while) - this, as well what I have currently, would allow for a data
upgrade to SDP_SEQ16 -> SDP_SEQ32, and SDP_ALT8 -> SDP_ALT16-> SDP_ALT32
as well, which theoretically are also needed as far as I can tell.
For the record, in any regard, I think the fix is rather ugly, goto
statement or not. This problem is now 'fixed' in two places (the other
one in sdp_append_to_buf, with the corresponding data length increase in
sdp_gen_buffer). IMHO, the code requires a bigger cleanup. I actually
made an attempt at it, but the fix got too big, and I opted for what I
submitted instead.
To get back on topic, let me know if you or others want me to re-submit.
Bart
^ permalink raw reply
* Re: [RFC 4/4] Bluetooth: Set local_amp_id after getting Phylink Completed evt
From: Gustavo Padovan @ 2012-11-19 21:28 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352996096-27374-4-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-11-15 18:14:56 +0200]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> local_amp_id is used in l2cap_physical_cfm and shall be set up
> before calling it.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/amp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
> index eb61aaa..ac9e8fe 100644
> --- a/net/bluetooth/amp.c
> +++ b/net/bluetooth/amp.c
> @@ -392,6 +392,7 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
>
> set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags);
> bredr_chan->remote_amp_id = hs_hcon->remote_id;
> + bredr_chan->local_amp_id = hs_hcon->hdev->id;
> bredr_chan->hs_hcon = hs_hcon;
> bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
I was able to apply patches 1 and 3 to bluetooth-next. The other 2 doesn't
apply for some reason, please rebase. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH 2/3] sdp: Limit side effects of sdp_get_data_type and sdp_get_data_size
From: Bart Westgeest @ 2012-11-19 21:06 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_MSAw2EWV=Tp-ycdfhUi1wJdcdXdH+4YAdfGx1LRpWs-g@mail.gmail.com>
Hi Anderson,
>> - sdp_get_data_type(buf, d->dtd);
>> - sdp_get_data_size(buf, d);
>> + buf->buf_size += sdp_get_data_type_size(d->dtd);
>> + buf->buf_size += sdp_get_data_size(buf, d);
>
> No need to check for "if (!buf->data)" like in the original code?
I do not think there's a need for it, this modification is in
sdp_gen_buffer. sdp_gen_buffer is called three times from the following
functions: (1) sdp_attr_size, (2) sdp_append_to_pdu, and (3)
gen_dataseq_pdu.
For (2) & (3), buf is memset to 0 prior to calling sdp_gen_buffer, thus
buf->data is always NULL.
For (1), buf is also memset to 0 for the first call to sdp_attr_size,
which is called repetitively in a foreach statement. Repetitive calls to
sdp_gen_buffer on the same buffer will not (ever) result in an
allocation of buf->data as far as I can tell.
>> - pdu_size = sdp_get_data_type(buf, dtd);
>> + pdu_size = sdp_get_data_type_size(dtd);
>
> Same here. Additionally, buf->buf_size is not being updated.
This modification is in sdp_gen_pdu. sdp_gen_pdu is never called with
buf->data == NULL. If it would, then the initialization of seqp in
sdp_gen_pdu is erroneous, since it uses buf->data without verifying it.
In addition, in the current code, sdp_gen_pdu is only called from three
locations: (1) get_data_size, (2) sdp_append_to_pdu, (3)
gen_dataseq_pdu. In all cases the buf->data is either allocated prior to
calling (2 & 3), or (1) there's an if statement preventing sdp_gen_pdu
from being called when buf->data == NULL.
Bart
^ permalink raw reply
* Re: [PATCH 3/3] sdp: Upgrade datatype SEQ8 to SEQ16 when data size is greater than 256
From: Anderson Lizardo @ 2012-11-19 20:38 UTC (permalink / raw)
To: Bart Westgeest; +Cc: linux-bluetooth
In-Reply-To: <1353351872-10628-4-git-send-email-bart@elbrys.com>
Hi Bart,
On Mon, Nov 19, 2012 at 3:04 PM, Bart Westgeest <bart@elbrys.com> wrote:
> Fixes a bug where the complete sequence data is written, but the size
> is truncated to one byte.
> ---
> lib/sdp.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/lib/sdp.c b/lib/sdp.c
> index 026163e..ceb1192 100644
> --- a/lib/sdp.c
> +++ b/lib/sdp.c
> @@ -786,23 +786,29 @@ static int sdp_gen_buffer(sdp_buf_t *buf, sdp_data_t *d)
>
> int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
> {
> - uint32_t pdu_size = 0, data_size = 0;
> + uint32_t pdu_size, data_size;
> unsigned char *src = NULL, is_seq = 0, is_alt = 0;
> - uint8_t dtd = d->dtd;
> uint16_t u16;
> uint32_t u32;
> uint64_t u64;
> uint128_t u128;
> uint8_t *seqp = buf->data + buf->data_size;
> + uint32_t orig_data_size = buf->data_size;
>
> - pdu_size = sdp_get_data_type_size(dtd);
> +recalculate:
> + pdu_size = sdp_get_data_type_size(d->dtd);
> buf->data_size += pdu_size;
>
> data_size = sdp_get_data_size(buf, d);
> + if (data_size > UCHAR_MAX && d->dtd == SDP_SEQ8) {
> + buf->data_size = orig_data_size;
> + d->dtd = SDP_SEQ16;
> + goto recalculate;
IMHO, using "goto" here is too complicated for 3 lines of code that
will just be run at most twice. So I would simply duplicate them
inside the if(). But others may have different opinion on this regard.
> + }
>
> - *seqp = dtd;
> + *seqp = d->dtd;
>
> - switch (dtd) {
> + switch (d->dtd) {
> case SDP_DATA_NIL:
> break;
> case SDP_UINT8:
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH 2/3] sdp: Limit side effects of sdp_get_data_type and sdp_get_data_size
From: Anderson Lizardo @ 2012-11-19 20:24 UTC (permalink / raw)
To: Bart Westgeest; +Cc: linux-bluetooth
In-Reply-To: <1353351872-10628-3-git-send-email-bart@elbrys.com>
Hi Bart,
On Mon, Nov 19, 2012 at 3:04 PM, Bart Westgeest <bart@elbrys.com> wrote:
> @@ -762,9 +757,6 @@ static int sdp_get_data_size(sdp_buf_t *buf, sdp_data_t *d)
> break;
> }
>
> - if (!buf->data)
> - buf->buf_size += data_size;
> -
> return data_size;
> }
>
> @@ -783,8 +775,8 @@ static int sdp_gen_buffer(sdp_buf_t *buf, sdp_data_t *d)
> /* attribute length */
> buf->buf_size += sizeof(uint8_t) + sizeof(uint16_t);
>
> - sdp_get_data_type(buf, d->dtd);
> - sdp_get_data_size(buf, d);
> + buf->buf_size += sdp_get_data_type_size(d->dtd);
> + buf->buf_size += sdp_get_data_size(buf, d);
No need to check for "if (!buf->data)" like in the original code?
>
> if (buf->buf_size > UCHAR_MAX && d->dtd == SDP_SEQ8)
> buf->buf_size += sizeof(uint8_t);
> @@ -803,7 +795,7 @@ int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
> uint128_t u128;
> uint8_t *seqp = buf->data + buf->data_size;
>
> - pdu_size = sdp_get_data_type(buf, dtd);
> + pdu_size = sdp_get_data_type_size(dtd);
Same here. Additionally, buf->buf_size is not being updated.
> buf->data_size += pdu_size;
>
> data_size = sdp_get_data_size(buf, d);
Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets
From: Gustavo Padovan @ 2012-11-19 20:19 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1353342958-25303-1-git-send-email-frederic.dalleau@linux.intel.com>
Hi Frédéric,
* Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-19 17:35:55 +0100]:
> Hi,
>
> This is a better view about what can be done to implement DEFER_SETUP on SCO
> sockets. hci layer get some changes since previous behavior was to accept all
> SCO connections.
> The ugly hci_proto_defer has been removed and replaced by an additional flag
> parameter to hci_proto_connect_ind.
> Regarding testing, I'm still stuck by a txt timeout issue however, if the
> delay between accept and recv is set to 0, then the connection is working fine.
> And I even managed to get the sco connection established correctly once. So I
> believed this emulator problem.
You are telling me that your patch is not really working, I suggest you call
this series RFC before you get everything sorted out. The approach in general
is good, but I'd need confirmation that it works for actual defer delays, 3
seconds for example, and not 0.
Gustavo
^ permalink raw reply
* [PATCH 3/3] sdp: Upgrade datatype SEQ8 to SEQ16 when data size is greater than 256
From: Bart Westgeest @ 2012-11-19 19:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bart Westgeest
In-Reply-To: <1353351872-10628-1-git-send-email-bart@elbrys.com>
Fixes a bug where the complete sequence data is written, but the size
is truncated to one byte.
---
lib/sdp.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index 026163e..ceb1192 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -786,23 +786,29 @@ static int sdp_gen_buffer(sdp_buf_t *buf, sdp_data_t *d)
int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
{
- uint32_t pdu_size = 0, data_size = 0;
+ uint32_t pdu_size, data_size;
unsigned char *src = NULL, is_seq = 0, is_alt = 0;
- uint8_t dtd = d->dtd;
uint16_t u16;
uint32_t u32;
uint64_t u64;
uint128_t u128;
uint8_t *seqp = buf->data + buf->data_size;
+ uint32_t orig_data_size = buf->data_size;
- pdu_size = sdp_get_data_type_size(dtd);
+recalculate:
+ pdu_size = sdp_get_data_type_size(d->dtd);
buf->data_size += pdu_size;
data_size = sdp_get_data_size(buf, d);
+ if (data_size > UCHAR_MAX && d->dtd == SDP_SEQ8) {
+ buf->data_size = orig_data_size;
+ d->dtd = SDP_SEQ16;
+ goto recalculate;
+ }
- *seqp = dtd;
+ *seqp = d->dtd;
- switch (dtd) {
+ switch (d->dtd) {
case SDP_DATA_NIL:
break;
case SDP_UINT8:
@@ -884,7 +890,7 @@ int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
if (src && buf->buf_size >= buf->data_size + data_size) {
memcpy(buf->data + buf->data_size, src, data_size);
buf->data_size += data_size;
- } else if (dtd != SDP_DATA_NIL) {
+ } else if (d->dtd != SDP_DATA_NIL) {
SDPDBG("Gen PDU : Can't copy from invalid source or dest\n");
}
}
--
1.7.10.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