* [PATCH v2 2/8] sink: Generalize disconnection function
From: Mikel Astiz @ 2012-11-15 7:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1352964460-8531-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
Extend the function for a more general usage other than full device
disconnection. Besides, return error code instead of a boolean.
---
profiles/audio/device.c | 4 ++--
profiles/audio/sink.c | 20 ++++++++++----------
profiles/audio/sink.h | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index 811ed75..09a1ed7 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -203,7 +203,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
avrcp_disconnect(dev);
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
- sink_disconnect(dev->sink);
+ sink_disconnect(dev, TRUE);
else
priv->disconnecting = FALSE;
}
@@ -390,7 +390,7 @@ static DBusMessage *dev_disconnect(DBusConnection *conn, DBusMessage *msg,
}
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
- sink_disconnect(dev->sink);
+ sink_disconnect(dev, TRUE);
else {
dbus_message_unref(priv->dc_req);
priv->dc_req = NULL;
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index e769917..7a08960 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -604,12 +604,15 @@ gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
return TRUE;
}
-gboolean sink_disconnect(struct sink *sink)
+int sink_disconnect(struct audio_device *dev, gboolean shutdown)
{
+ struct sink *sink = dev->sink;
+
if (!sink->session)
- return FALSE;
+ return -ENOTCONN;
- avdtp_set_device_disconnect(sink->session, TRUE);
+ if (shutdown)
+ avdtp_set_device_disconnect(sink->session, TRUE);
/* cancel pending connect */
if (sink->connect) {
@@ -623,20 +626,17 @@ gboolean sink_disconnect(struct sink *sink)
avdtp_unref(sink->session);
sink->session = NULL;
- return TRUE;
+ return 0;
}
/* disconnect already ongoing */
if (sink->disconnect)
- return TRUE;
+ return -EBUSY;
if (!sink->stream)
- return FALSE;
-
- if (avdtp_close(sink->session, sink->stream, FALSE) < 0)
- return FALSE;
+ return -ENOTCONN;
- return TRUE;
+ return avdtp_close(sink->session, sink->stream, FALSE);
}
unsigned int sink_add_state_cb(sink_state_cb cb, void *user_data)
diff --git a/profiles/audio/sink.h b/profiles/audio/sink.h
index edac364..426d83f 100644
--- a/profiles/audio/sink.h
+++ b/profiles/audio/sink.h
@@ -46,4 +46,4 @@ sink_state_t sink_get_state(struct audio_device *dev);
gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
struct avdtp_stream *stream);
gboolean sink_setup_stream(struct sink *sink, struct avdtp *session);
-gboolean sink_disconnect(struct sink *sink);
+int sink_disconnect(struct audio_device *dev, gboolean shutdown);
--
1.7.11.7
^ permalink raw reply related
* [PATCH v2 1/8] audio: Trivial function renames
From: Mikel Astiz @ 2012-11-15 7:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1352964460-8531-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
Rename functions to be consistent with the rest of the code.
---
profiles/audio/device.c | 4 ++--
profiles/audio/sink.c | 10 +++++-----
profiles/audio/sink.h | 2 +-
profiles/audio/source.c | 10 +++++-----
profiles/audio/source.h | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index df57d81..811ed75 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -203,7 +203,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
avrcp_disconnect(dev);
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
- sink_shutdown(dev->sink);
+ sink_disconnect(dev->sink);
else
priv->disconnecting = FALSE;
}
@@ -390,7 +390,7 @@ static DBusMessage *dev_disconnect(DBusConnection *conn, DBusMessage *msg,
}
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
- sink_shutdown(dev->sink);
+ sink_disconnect(dev->sink);
else {
dbus_message_unref(priv->dc_req);
priv->dc_req = NULL;
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 2e63579..e769917 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -390,7 +390,7 @@ gboolean sink_setup_stream(struct sink *sink, struct avdtp *session)
return TRUE;
}
-static DBusMessage *sink_connect(DBusConnection *conn,
+static DBusMessage *connect_sink(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct audio_device *dev = data;
@@ -423,7 +423,7 @@ static DBusMessage *sink_connect(DBusConnection *conn,
return NULL;
}
-static DBusMessage *sink_disconnect(DBusConnection *conn,
+static DBusMessage *disconnect_sink(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct audio_device *device = data;
@@ -489,8 +489,8 @@ static DBusMessage *sink_get_properties(DBusConnection *conn,
}
static const GDBusMethodTable sink_methods[] = {
- { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, sink_connect) },
- { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, sink_disconnect) },
+ { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, connect_sink) },
+ { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, disconnect_sink) },
{ GDBUS_METHOD("GetProperties",
NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
sink_get_properties) },
@@ -604,7 +604,7 @@ gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
return TRUE;
}
-gboolean sink_shutdown(struct sink *sink)
+gboolean sink_disconnect(struct sink *sink)
{
if (!sink->session)
return FALSE;
diff --git a/profiles/audio/sink.h b/profiles/audio/sink.h
index 4fea5ba..edac364 100644
--- a/profiles/audio/sink.h
+++ b/profiles/audio/sink.h
@@ -46,4 +46,4 @@ sink_state_t sink_get_state(struct audio_device *dev);
gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
struct avdtp_stream *stream);
gboolean sink_setup_stream(struct sink *sink, struct avdtp *session);
-gboolean sink_shutdown(struct sink *sink);
+gboolean sink_disconnect(struct sink *sink);
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 1d0c74a..38cb822 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -379,7 +379,7 @@ gboolean source_setup_stream(struct source *source, struct avdtp *session)
return TRUE;
}
-static DBusMessage *source_connect(DBusConnection *conn,
+static DBusMessage *connect_source(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct audio_device *dev = data;
@@ -412,7 +412,7 @@ static DBusMessage *source_connect(DBusConnection *conn,
return NULL;
}
-static DBusMessage *source_disconnect(DBusConnection *conn,
+static DBusMessage *disconnect_source(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct audio_device *device = data;
@@ -478,8 +478,8 @@ static DBusMessage *source_get_properties(DBusConnection *conn,
}
static const GDBusMethodTable source_methods[] = {
- { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, source_connect) },
- { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, source_disconnect) },
+ { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, connect_source) },
+ { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, disconnect_source) },
{ GDBUS_METHOD("GetProperties",
NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
source_get_properties) },
@@ -593,7 +593,7 @@ gboolean source_new_stream(struct audio_device *dev, struct avdtp *session,
return TRUE;
}
-gboolean source_shutdown(struct source *source)
+gboolean source_disconnect(struct source *source)
{
if (!source->stream)
return FALSE;
diff --git a/profiles/audio/source.h b/profiles/audio/source.h
index 695bded..49a8d64 100644
--- a/profiles/audio/source.h
+++ b/profiles/audio/source.h
@@ -47,4 +47,4 @@ source_state_t source_get_state(struct audio_device *dev);
gboolean source_new_stream(struct audio_device *dev, struct avdtp *session,
struct avdtp_stream *stream);
gboolean source_setup_stream(struct source *source, struct avdtp *session);
-gboolean source_shutdown(struct source *source);
+gboolean source_disconnect(struct source *source);
--
1.7.11.7
^ permalink raw reply related
* [PATCH v2 0/8] Adopt btd_profile for A2DP
From: Mikel Astiz @ 2012-11-15 7:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Mikel Astiz
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
^ permalink raw reply
* Re: [PATCH v4 11/16] sbc: Add SBC_MSBC flag to enable 15 block encoding
From: Marcel Holtmann @ 2012-11-14 23:20 UTC (permalink / raw)
To: frederic.dalleau; +Cc: linux-bluetooth
In-Reply-To: <50A3B9FC.3070009@linux.intel.com>
Hi Fred,
> > I am debating to actually call this SBC_FLAG_MSBC instead of just
> > SBC_MSBC. Anyone any comments?
>
> The use of the flag may not be the most elegant API. As an alternative,
> maybe we could have a specific function for msbc initialization. Then,
> instead of sbc_init(), sbc_encode() sbc_decode(), we could have
> msbc_init(), sbc_encode(), sbc_decode().
> The biggest advantage is that parameters like bitpool, subbands,
> allocation, and other parts could be specified inside this function
> instead of being given from the application.
we could do an sbc_init_msbc() function.
As this is the only real external visible API change, we need to be 100%
sure with this one.
Regards
Marcel
^ permalink raw reply
* Re: CSA2: User space aspect
From: Marcel Holtmann @ 2012-11-14 23:17 UTC (permalink / raw)
To: Michael Knudsen; +Cc: linux-bluetooth
In-Reply-To: <50A3B0D5.9030107@samsung.com>
Hi Michael,
> > If anyone else has an ideas or opinions about this, please speak up,
> > otherwise I'll try coming up with an interface specification with
> > more details.
>
> This diff shows the direction I'm heading:
>
> diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
> index 1e35c43..a565a4d 100644
> --- a/include/net/bluetooth/sco.h
> +++ b/include/net/bluetooth/sco.h
> @@ -51,6 +51,42 @@ struct sco_conninfo {
> __u8 dev_class[3];
> };
>
> +/* Audio format setting */
> +#define SCO_HOST_FORMAT 0x04
> +#define SCO_AIR_FORMAT 0x05
> +
> +#define SCO_FORMAT_ULAW 0x00
> +#define SCO_FORMAT_ALAW 0x01
> +#define SCO_FORMAT_CVSD 0x02
> +#define SCO_FORMAT_TRANSPARENT 0x03
> +#define SCO_FORMAT_PCM 0x05
> +#define SCO_FORMAT_MSBC 0x05
> +#define SCO_FORMAT_VENDOR 0xff
> +struct sco_format_vendor {
> + __u16 vendor;
> + __u16 codec;
> +};
> +
> +struct sco_format {
> + __u8 in_format;
> + struct sco_format_vendor in_vendor;
> +
> + __u8 out_format;
> + struct sco_format_vendor out_vendor;
> +};
> +
> +#define SCO_CODECS 0x06
> +struct sco_codecs {
> + __u8 count;
> + __u8 *codec;
> +};
> +
> +#define SCO_CODECS_VENDOR 0x07
> +struct sco_codecs_vendor {
> + __u8 count;
> + struct sco_format_vendor *format;
> +};
> +
> /* ---- SCO connections ---- */
> struct sco_conn {
> struct hci_conn *hcon;
> @@ -74,6 +110,8 @@ struct sco_pinfo {
> struct bt_sock bt;
> __u32 flags;
> struct sco_conn *conn;
> + struct sco_format host_format;
> + struct sco_format air_format;
> };
>
> #endif /* __SCO_H */
>
> Basically, this adds four socket options (I'll do the audio path
> stuff as well once this is done):
>
> SCO_AIR_FORMAT
> SCO_HOST_FORMAT
> SCO_CODECS (ro)
> SCO_CODECS_VENDOR (ro)
>
> The SCO_CODECS ones provide the application with a list of codecs
> supported by the hdev as indicated in the HCI_Read_Local_Supported_Codecs
> command response, and if the hdev does not support this command a
> default of linear PCM, CVSD, and transparent will be provided.
please to not attempt to use socket options as ioctl. They are called
options for a reason.
Getting the list of supported codecs should be done via mgmt interface
command and it should be only done once.
> Because the result length is variable, the idea is that the application-
> provided structure is modified by the kernel to hold the actual number
> of results so the application can allocate a buffer accordingly, e.g.:
>
> struct sco_codecs sc;
>
> memset(&sc, 0, sizeof(sc));
> getsockopt(sk, SOL_SCO, SCO_CODECS, &sk);
>
> sk.codecs = malloc(sk.count);
> getsockopt(sk, SOL_SCO, SCO_CODECS, &sk);
We are not doing that. I have no intention to map kernel memory to
userspace memory and back with socket options.
> The SCO_*_FORMAT ones allows the application to set the parameters that
> are to be used on host-controller and controller-controller paths. While
> the spec requires the pairs (host input/output, air input/output) to be
> identical, I don't see a reason to enforce this in the API, thus all are
> set independently.
>
> So, before I spend any more time on this.. comments?
Please ask yourself the question when and how the SCO data from the
socket is actually affected. I still have not seen you provide the
semantics of how the socket would be used afterwards. Especially on
impact for the application establishing the SCO socket.
In a more important question, is this static one time fits all selection
or is this actually to be dynamic on every new connection establishment.
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels
From: Marcel Holtmann @ 2012-11-14 23:08 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352907572-7113-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Set chan->fcs to L2CAP_FCS_NONE only for new L2CAP channels
> (not moved). Other side can still request to use FCS.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/amp.c | 1 -
> net/bluetooth/l2cap_core.c | 2 ++
> 2 files changed, 2 insertions(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
From: Marcel Holtmann @ 2012-11-14 23:07 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,
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm
From: Marcel Holtmann @ 2012-11-14 23:04 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1352907572-7113-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Remove locking from l2cap_physical_cfm and lock chan inside
> amp_physical_cfm.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/l2cap.h | 2 +-
> net/bluetooth/amp.c | 6 +++++-
> net/bluetooth/l2cap_core.c | 7 ++-----
> 3 files changed, 8 insertions(+), 7 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH v4 05/16] sbc: Add mmx primitive for 1b 8s analysis
From: Siarhei Siamashka @ 2012-11-14 20:23 UTC (permalink / raw)
To: frederic.dalleau; +Cc: linux-bluetooth
In-Reply-To: <50A3BC30.8060209@linux.intel.com>
On Wed, 14 Nov 2012 16:43:44 +0100
Frédéric Dalleau <frederic.dalleau@linux.intel.com> wrote:
> Hi,
>
> Since I'm gonna resend a new series, I'll comment myself ;)
>
> On 10/30/2012 10:39 AM, Frédéric Dalleau wrote:
> > +static inline void sbc_analyze_1b_8s_mmx(struct sbc_encoder_state *state,
> > + int16_t *x, int32_t *out, int out_stride)
> > +{
> > + if (state->odd)
> > + sbc_analyze_eight_mmx(x, out, analysis_consts_fixed8_simd_odd);
> > + else
> > + sbc_analyze_eight_mmx(x, out, analysis_consts_fixed8_simd_even);
> > +
> > + state->odd = !state->odd;
> > +
> > + __asm__ volatile ("emms\n");
> > +}
> > +
>
> One thing bother me about this patch : the emms instruction is called
> after every block, instead of every four blocks until now. I have very
> little knowledge about this, but I read that emms instruction is
> somewhat expensive.
> Some quick tests haven't shown differences, but it is possible to add a
> post analyze callback to overcome this. In this case, emms instruction
> could be run every 15 blocks or whatever is defined.
The EMMS instruction must be used after the use of MMX instructions,
otherwise the subsequent floating point calculations are broken.
As part of calling conventions, FPU state must be clear after returning
from any function:
http://www.agner.org/optimize/calling_conventions.pdf
It means that normally every MMX function needs to execute EMMS
instruction before returning. We were already cutting the corners a bit
by putting MMX code into static inline functions which don't have
EMMS themselves. But using the post analyze callback would be really
wrong as that's going to explicitly cross function boundaries with
inconsistent FPU state.
>
> Is it worth it?
If benchmarks do not show a significant performance drop, then it does
not really matter. A minor performance regression is fine, as long as
the MMX code is still significantly faster than C.
Nowadays using SSE2 is a much better idea. And SSE2 does not suffer
from EMMS-alike warts.
--
Best regards,
Siarhei Siamashka
^ permalink raw reply
* Re: [PATCH v4 00/16] mSBC tests
From: Siarhei Siamashka @ 2012-11-14 19:57 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: frederic.dalleau
In-Reply-To: <1352904655.20338.11.camel@aeonflux>
On Wed, 14 Nov 2012 23:50:55 +0900
Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Fred,
>
> > > v4 integrate latest comments from Siarhei:
> > > - remove state->pending field from sbc_encoder_state
> > > - add armv6 and iwmmxt primitives
> > > - use simd primitive instead of neon
> > > - reorder patches so that the SBC_MSBC flag is exposed to users only when
> > > implementation is complete.
> >
> > Any feedback ?
>
> beside a tiny cosmetic comment, I have nothing. However I am not the
> expert here. If Siarhei looks over this and is fine with it, I will be
> as well.
Hi,
My biggest concern is the way how we handle the mSBC API/ABI extension.
Because once the new version of sbc library is out, we can't
(easily/painlessly) change it any more. Everything else is fixable.
Anyway, as far as I can see, there are no regressions in the existing
SBC functionality, which is the most important requirement.
I personally would prefer a bit more verbose commit messages. But let
me know if these demands are unreasonable :)
--
Best regards,
Siarhei Siamashka
^ permalink raw reply
* Re: pull request: bluetooth-next 2012-11-01
From: John W. Linville @ 2012-11-14 19:51 UTC (permalink / raw)
To: Gustavo Padovan, linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <20121101223750.GA1915@joana>
On Thu, Nov 01, 2012 at 08:37:50PM -0200, Gustavo Padovan wrote:
> Hi John,
>
> Another set of patches for integration in wireless-next. There are two big set
> of changes in it: Andrei Emeltchenko and Mat Martineau added more patches
> towards a full Bluetooth High Speed support and Johan Hedberg improve the
> single mode support for Bluetooth dongles. Apart from that we have small fixes
> and improvements.
>
> Please pull. Thanks a lot.
>
> Gustavo
> ---
>
> The following changes since commit 9917c85b06c2eb9d61c0f2dadd2d5d8788f7e563:
>
> brcm80211: remove some truely barftastic code (2012-10-19 16:20:56 -0400)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next for-upstream
Pulled...
>
> for you to fetch changes up to 0c0afedf55ff409be9db0b0aeeaa1c6fe0f3cd3c:
>
> Bluetooth: Fix parameter order of hci_get_route (2012-11-01 20:27:11 -0200)
>
> ----------------------------------------------------------------
> Andrei Emeltchenko (18):
> Bluetooth: trivial: Remove unneeded assignment
> Bluetooth: Use helper function sending EFS conf rsp
> Bluetooth: AMP: Process Physical Link Complete evt
> Bluetooth: AMP: Process Logical Link complete evt
> Bluetooth: Add put(hcon) when deleting hchan
> Bluetooth: trivial: Fix braces style and remove empty line
> Bluetooth: Save hs_hchan instead of hs_hcon in loglink complete
> Bluetooth: Return correct L2CAP response type
> Bluetooth: Derive remote and local amp id from chan struct
> Bluetooth: AMP: Add Logical Link Create function
> Bluetooth: AMP: Process Disc Logical Link
> Bluetooth: AMP: Process Disc Physical Link Complete evt
> Bluetooth: AMP: Remove hci_conn receiving error command status
> Bluetooth: Disconnect logical link when deleting chan
> Bluetooth: AMP: Check for hs_hcon instead of ctrl_id
> Bluetooth: AMP: Use l2cap_physical_cfm in phylink complete evt
> Bluetooth: Process Create Chan Request
> Bluetooth: Rename ctrl_id to remote_amp_id
>
> Denis Kirjanov (1):
> Bluetooth:Replace list_for_each with list_for_each_entry() helper
>
> Gustavo Padovan (1):
> Bluetooth: Replace *_init() for *_setup()
>
> Johan Hedberg (16):
> Bluetooth: Add initial support for LE-only controllers
> Bluetooth: Fix LE MTU reporting for HCIGETDEVINFO
> Bluetooth: Add setting of the LE event mask
> Bluetooth: Read adversiting channel TX power during init sequence
> Bluetooth: Fix HCI command sending when powering on LE-only adapters
> Bluetooth: mgmt: Restrict BR/EDR settings to BR/EDR-only adapters
> Bluetooth: Fix updating host feature bits for LE
> Bluetooth: Add missing feature test macros
> Bluetooth: Make use feature test macros
> Bluetooth: Add flag for LE GAP Peripheral role
> Bluetooth: Disallow LE scanning and connecting in peripheral role
> Bluetooth: Fix setting host feature bits for SSP
> Bluetooth: Fix sending unnecessary HCI_Write_SSP_Mode command
> Bluetooth: Fix unnecessary EIR update during powering on
> Bluetooth: Fix sending unnecessary HCI_LE_Host_Enable
> Bluetooth: Fix parameter order of hci_get_route
>
> Mat Martineau (18):
> Bluetooth: Add new l2cap_chan struct members for high speed channels
> Bluetooth: Add L2CAP create channel request handling
> Bluetooth: Remove unnecessary intermediate function
> Bluetooth: Lookup channel structure based on DCID
> Bluetooth: Channel move request handling
> Bluetooth: Add new ERTM receive states for channel move
> Bluetooth: Add move channel confirm handling
> Bluetooth: Add state to hci_chan
> Bluetooth: Move channel response
> Bluetooth: Add logical link confirm
> Bluetooth: Add move confirm response handling
> Bluetooth: Handle physical link completion
> Bluetooth: Flag ACL frames as complete for AMP controllers
> Bluetooth: Do not send data during channel move
> Bluetooth: Configure appropriate timeouts for AMP controllers
> Bluetooth: Ignore BR/EDR packet size constraints when fragmenting for AMP
> Bluetooth: Do not retransmit data during a channel move
> Bluetooth: Start channel move when socket option is changed
>
> Syam Sidhardhan (4):
> Bluetooth: trivial: Remove newline before EOF
> Bluetooth: Replace include linux/module.h with linux/export.h
> Bluetooth: Remove unnecessary include export.h
> Bluetooth: mgmt: Use __constant when dealing with constants
>
> include/net/bluetooth/amp.h | 4 +
> include/net/bluetooth/hci.h | 7 +
> include/net/bluetooth/hci_core.h | 44 +-
> include/net/bluetooth/l2cap.h | 38 +-
> net/bluetooth/Kconfig | 1 -
> net/bluetooth/a2mp.c | 4 +-
> net/bluetooth/amp.c | 93 ++++
> net/bluetooth/bnep/netdev.c | 1 -
> net/bluetooth/cmtp/capi.c | 2 +-
> net/bluetooth/cmtp/sock.c | 2 +-
> net/bluetooth/hci_conn.c | 6 +
> net/bluetooth/hci_core.c | 65 +--
> net/bluetooth/hci_event.c | 309 +++++++++++--
> net/bluetooth/l2cap_core.c | 1000 +++++++++++++++++++++++++++++++++++++---
> net/bluetooth/l2cap_sock.c | 5 +
> net/bluetooth/mgmt.c | 98 ++--
> 16 files changed, 1486 insertions(+), 193 deletions(-)
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: [PATCH v4 09/16] sbc: Use simd primitive if doing msbc on neon
From: Siarhei Siamashka @ 2012-11-14 19:27 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1351589975-22640-10-git-send-email-frederic.dalleau@linux.intel.com>
On Tue, 30 Oct 2012 10:39:28 +0100
Frédéric Dalleau <frederic.dalleau@linux.intel.com> wrote:
> ---
> sbc/sbc_primitives.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sbc/sbc_primitives.c b/sbc/sbc_primitives.c
> index a4767ef..9311848 100644
> --- a/sbc/sbc_primitives.c
> +++ b/sbc/sbc_primitives.c
> @@ -568,5 +568,8 @@ void sbc_init_primitives(struct sbc_encoder_state *state)
> #endif
> #ifdef SBC_BUILD_WITH_NEON_SUPPORT
> sbc_init_primitives_neon(state);
> +
> + if (state->increment == 1)
> + state->sbc_analyze_8s = sbc_analyze_1b_8s_simd;
> #endif
> }
This is not enough. As I commented earlier in
http://permalink.gmane.org/gmane.linux.bluez.kernel/31567
"neon code also provides optimized "sbc_enc_process_input_*" functions,
which are not going to work correctly for mSBC:
state->sbc_enc_process_input_8s_le = sbc_enc_process_input_8s_le_neon;
state->sbc_enc_process_input_8s_be = sbc_enc_process_input_8s_be_neon;"
And if we had, for example, an SSSE3 implementation of
"sbc_enc_process_input_*" functions for x86 (via PSHUFB instruction),
then it would also have the same problem.
--
Best regards,
Siarhei Siamashka
^ permalink raw reply
* Re: pull request: bluetooth 2012-11-09
From: John W. Linville @ 2012-11-14 19:18 UTC (permalink / raw)
To: Gustavo Padovan, linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <20121110182427.GA7523@joana>
On Sat, Nov 10, 2012 at 07:24:27PM +0100, Gustavo Padovan wrote:
> Hi John,
>
> A few important fixes to go into 3.7. There is a new hw support by Marcos
> Chaparro. Johan added a memory leak fix and hci device index list fix.
> Also Marcel fixed a race condition in the device set up that was prevent the
> bt monitor to work properly. Last, Paulo Sérgio added a fix to the error
> status when pairing for LE fails. This was prevent userspace to work to handle
> the failure properly.
>
> Please pull! or let me know of any issues. Thanks.
>
> Gustavo
>
> ---
> The following changes since commit 6fe7cc71bbf3a0bc28c9cec3c00bc11e81344412:
>
> ath9k: Test for TID only in BlockAcks while checking tx status (2012-10-30 15:58:54 -0400)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth master
Pulled...
> for you to fetch changes up to 482049f75750d73358e65236b933417b69f9cc25:
>
> Bluetooth: Fix memory leak when removing a UUID (2012-11-09 16:45:37 +0100)
>
> ----------------------------------------------------------------
> Johan Hedberg (2):
> Bluetooth: Fix having bogus entries in mgmt_read_index_list reply
> Bluetooth: Fix memory leak when removing a UUID
>
> Marcel Holtmann (1):
> Bluetooth: Notify about device registration before power on
>
> Marcos Chaparro (1):
> Bluetooth: ath3k: Add support for VAIO VPCEH [0489:e027]
>
> Paulo Sérgio (1):
> Bluetooth: Fix error status when pairing fails
>
> drivers/bluetooth/ath3k.c | 1 +
> drivers/bluetooth/btusb.c | 1 +
> net/bluetooth/hci_core.c | 4 ++--
> net/bluetooth/mgmt.c | 12 +++++++-----
> net/bluetooth/smp.c | 2 +-
> 5 files changed, 12 insertions(+), 8 deletions(-)
>
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: [PATCH v4 10/16] sbc: simd support for 8 multiples block size
From: Siarhei Siamashka @ 2012-11-14 19:09 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1351589975-22640-11-git-send-email-frederic.dalleau@linux.intel.com>
On Tue, 30 Oct 2012 10:39:29 +0100
Frédéric Dalleau <frederic.dalleau@linux.intel.com> wrote:
This looks good. The only potential problem is here:
http://git.kernel.org/?p=bluetooth/sbc.git;a=blob;f=sbc/sbc_primitives.h;h=17ad4f74da4c#l31
31 #define SBC_X_BUFFER_SIZE 328
http://git.kernel.org/?p=bluetooth/sbc.git;a=blob;f=sbc/sbc.c;h=f0c77c7cb546#l908
908 state->position = (SBC_X_BUFFER_SIZE - frame->subbands * 9) & ~7;
http://git.kernel.org/?p=bluetooth/sbc.git;a=blob;f=sbc/sbc_primitives.c;h=ad780d0800de#l285
285 /* handle X buffer wraparound */
286 if (position < nsamples) {
287 if (nchannels > 0)
288 memcpy(&X[0][SBC_X_BUFFER_SIZE - 72], &X[0][position],
289 72 * sizeof(int16_t));
290 if (nchannels > 1)
291 memcpy(&X[1][SBC_X_BUFFER_SIZE - 72], &X[1][position],
292 72 * sizeof(int16_t));
293 position = SBC_X_BUFFER_SIZE - 72;
294 }
As we are going to use divisibility by 16 of position variable as a
way to distinguish between "even" and "odd" blocks (chunks of 8
samples) in the buffer, we need to be sure that the following
conditions are true:
1. assert((SBC_X_BUFFER_SIZE - frame->subbands * 9) & ~7 ==
SBC_X_BUFFER_SIZE - 72);
Buffer wraparound is handled by copying a portion of still
needed old data to the initial position.
2. assert((SBC_X_BUFFER_SIZE - 72) % 16 == 0);
The initial position is divisible by 16.
3. assert((SBC_X_BUFFER_SIZE - 72) % (15 * 8) % 16 == 0);
When we handle buffer wraparound, the position before memcpy has the
same divisibility by 16 as the new updated position after memcpy.
4. assert((SBC_X_BUFFER_SIZE - 72) % (15 * 8) >= 8);
Just to be sure that "x[-7] = PCM(0 + 7 * nchannels)" does not
do invalid memory writes below the X array. This would be not
necessary if we adjust the "if (position < nsamples)" check.
If anybody decides to change SBC_X_BUFFER_SIZE constant, there is a
risk of doing it wrong. But right now the code seems to fulfil these
requirements :)
And some cosmetic nitpicks.
First the text of the summary:
1. Why "simd"? It's not totally wrong, but still way too generic.
You could use "input permutation" or "input processing" or
"sbc_encoder_process_input_s8 function" instead.
2. That's a multiple of 1 block (or alternatively a multiple of 8
samples).
> ---
> sbc/sbc_primitives.c | 37 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/sbc/sbc_primitives.c b/sbc/sbc_primitives.c
> index 9311848..b189320 100644
> --- a/sbc/sbc_primitives.c
> +++ b/sbc/sbc_primitives.c
> @@ -309,8 +309,26 @@ static SBC_ALWAYS_INLINE int sbc_encoder_process_input_s8_internal(
> #define PCM(i) (big_endian ? \
> unaligned16_be(pcm + (i) * 2) : unaligned16_le(pcm + (i) * 2))
>
> + if (position % 16 == 8) {
> + position -= 8;
> + nsamples -= 8;
> + if (nchannels > 0) {
That's a somewhat redundant "if" here. Yes, it is also redundant in
the code where both "if (nchannels > 0)" and "if (nchannels > 1)" are
used, but it was there just for cosmetic reasons in order to keep the
same level of indentation.
> + int16_t *x = &X[0][position];
> + x[0] = PCM(0 + (15-8) * nchannels);
> + x[2] = PCM(0 + (14-8) * nchannels);
> + x[3] = PCM(0 + (8-8) * nchannels);
> + x[4] = PCM(0 + (13-8) * nchannels);
> + x[5] = PCM(0 + (9-8) * nchannels);
> + x[6] = PCM(0 + (12-8) * nchannels);
> + x[7] = PCM(0 + (10-8) * nchannels);
> + x[8] = PCM(0 + (11-8) * nchannels);
> + }
> + /* mSBC is designed for 1 channel */
Thanks for adding this comment. But IMHO it still feels a bit
incomplete. It could be a extended to:
/* mSBC codec is the only case when the number of
* samples to process may be not multiple of 16.
* mSBC only supports 1 channel */
Or alternatively just add back the omitted "if (nchannels > 1)" branch
too. Yes, it is not needed for mSBC now, but what if somebody introduces
something like a stereo variant of mSBC later? This way the code is
more orthogonal, "futureproof" and does not need lengthy excuses and
explanations in comments for the parts which are cutting the corners.
Either way is fine.
> + pcm += 16 * nchannels;
> + }
> +
> /* copy/permutate audio samples */
> - while ((nsamples -= 16) >= 0) {
> + while (nsamples >= 16) {
> position -= 16;
> if (nchannels > 0) {
> int16_t *x = &X[0][position];
> @@ -351,6 +369,23 @@ static SBC_ALWAYS_INLINE int sbc_encoder_process_input_s8_internal(
> x[15] = PCM(1 + 2 * nchannels);
> }
> pcm += 32 * nchannels;
> + nsamples -= 16;
> + }
> +
> + if (nsamples == 8) {
> + position -= 8;
> + if (nchannels > 0) {
> + int16_t *x = &X[0][position];
> + x[-7] = PCM(0 + 7 * nchannels);
> + x[1] = PCM(0 + 3 * nchannels);
> + x[2] = PCM(0 + 6 * nchannels);
> + x[3] = PCM(0 + 0 * nchannels);
> + x[4] = PCM(0 + 5 * nchannels);
> + x[5] = PCM(0 + 1 * nchannels);
> + x[6] = PCM(0 + 4 * nchannels);
> + x[7] = PCM(0 + 2 * nchannels);
> + }
> + /* mSBC is designed for 1 channel */
Same here.
> }
> #undef PCM
Well, none of these are really serious issues which could
immediately affect end users. But I would definitely prefer more
verbose commit messages, showing that you know what you are
doing, that the corner cases are under control, the rationale for
your decisions, etc.
--
Best regards,
Siarhei Siamashka
^ permalink raw reply
* Re: [PATCH BlueZ 1/1] gdbus: Fix compilation error due to missing #defines
From: Johan Hedberg @ 2012-11-14 18:24 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
In-Reply-To: <1352898430-3383-1-git-send-email-s.syam@samsung.com>
Hi Syam,
On Wed, Nov 14, 2012, Syam Sidhardhan wrote:
> Since these are simple #define strings, we are defining it here
> instead of upgrading to D-Bus 1.5 or later.
>
> Log:
> CC gdbus/object.o
> gdbus/object.c: In function ‘properties_set’:
> gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared
> (first use in this function)
> gdbus/object.c:876:7: note: each undeclared identifier is reported
> only once for each function it appears in
> gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’
> undeclared (first use in this function)
> make[1]: *** [gdbus/object.o] Error 1
> make: *** [all] Error 2
> ---
> gdbus/object.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* [RFC 2/2] btiotest: Enable deferred setup for sco sockets
From: Frédéric Dalleau @ 2012-11-14 18:18 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frédéric Dalleau
In-Reply-To: <1352917080-18509-1-git-send-email-frederic.dalleau@linux.intel.com>
---
test/btiotest.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/test/btiotest.c b/test/btiotest.c
index f090dd9..f157286 100644
--- a/test/btiotest.c
+++ b/test/btiotest.c
@@ -459,24 +459,34 @@ static void sco_connect(const char *src, const char *dst, gint disconn)
}
}
-static void sco_listen(const char *src, gint disconn)
+static void sco_listen(const char *src, gint disconn, gboolean defer)
{
struct io_data *data;
+ BtIOConnect conn;
+ BtIOConfirm cfm;
GIOChannel *sco_srv;
GError *err = NULL;
printf("Listening for SCO connections\n");
+ if (defer) {
+ conn = NULL;
+ cfm = confirm_cb;
+ } else {
+ conn = connect_cb;
+ cfm = NULL;
+ }
+
data = io_data_new(NULL, -1, disconn, -1);
if (src)
- sco_srv = bt_io_listen(connect_cb, NULL, data,
+ sco_srv = bt_io_listen(conn, cfm, data,
(GDestroyNotify) io_data_unref,
&err,
BT_IO_OPT_SOURCE, src,
BT_IO_OPT_INVALID);
else
- sco_srv = bt_io_listen(connect_cb, NULL, data,
+ sco_srv = bt_io_listen(conn, cfm, data,
(GDestroyNotify) io_data_unref,
&err, BT_IO_OPT_INVALID);
@@ -581,7 +591,7 @@ int main(int argc, char *argv[])
if (argc > 1)
sco_connect(opt_dev, argv[1], opt_disconn);
else
- sco_listen(opt_dev, opt_disconn);
+ sco_listen(opt_dev, opt_disconn, opt_defer);
}
signal(SIGTERM, sig_term);
--
1.7.9.5
^ permalink raw reply related
* [RFC 1/2] scotest: Add deferred setup option
From: Frédéric Dalleau @ 2012-11-14 18:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frédéric Dalleau
---
test/scotest.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 55 insertions(+), 5 deletions(-)
diff --git a/test/scotest.c b/test/scotest.c
index de65edf..a40e395 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -57,6 +57,8 @@ static long data_size = 672;
static bdaddr_t bdaddr;
+static int defer_setup = 0;
+
static float tv2fl(struct timeval tv)
{
return (float)tv.tv_sec + (float)(tv.tv_usec/1000000.0);
@@ -147,6 +149,14 @@ static void do_listen(void (*handler)(int sk))
goto error;
}
+ /* Enable deferred setup */
+ if (defer_setup && setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP,
+ &defer_setup, sizeof(defer_setup)) < 0) {
+ syslog(LOG_ERR, "Can't enable deferred setup : %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
/* Listen for connections */
if (listen(sk, 10)) {
syslog(LOG_ERR,"Can not listen on the socket: %s (%d)",
@@ -181,8 +191,10 @@ static void do_listen(void (*handler)(int sk))
if (getsockopt(nsk, SOL_SCO, SCO_CONNINFO, &conn, &optlen) < 0) {
syslog(LOG_ERR, "Can't get SCO connection information: %s (%d)",
strerror(errno), errno);
- close(nsk);
- goto error;
+ if (!defer_setup) {
+ close(nsk);
+ goto error;
+ }
}
ba2str(&addr.sco_bdaddr, ba);
@@ -190,6 +202,18 @@ static void do_listen(void (*handler)(int sk))
ba, conn.hci_handle,
conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
+ /* Handle deferred setup */
+ if (defer_setup) {
+ syslog(LOG_INFO, "Waiting for %d seconds",
+ abs(defer_setup) - 1);
+ sleep(abs(defer_setup) - 1);
+
+ if (defer_setup < 0) {
+ close(nsk);
+ goto error;
+ }
+ }
+
handler(nsk);
syslog(LOG_INFO, "Disconnect");
@@ -207,6 +231,15 @@ static void dump_mode(int sk)
{
int len;
+ if (defer_setup) {
+ len = read(sk, buf, sizeof(buf));
+ if (len < 0)
+ syslog(LOG_ERR, "Initial read error: %s (%d)",
+ strerror(errno), errno);
+ else
+ syslog(LOG_INFO, "Initial bytes %d", len);
+ }
+
syslog(LOG_INFO,"Receiving ...");
while ((len = read(sk, buf, data_size)) > 0)
syslog(LOG_INFO, "Recevied %d bytes", len);
@@ -216,6 +249,16 @@ static void recv_mode(int sk)
{
struct timeval tv_beg,tv_end,tv_diff;
long total;
+ int len;
+
+ if (defer_setup) {
+ len = read(sk, buf, sizeof(buf));
+ if (len < 0)
+ syslog(LOG_ERR, "Initial read error: %s (%d)",
+ strerror(errno), errno);
+ else
+ syslog(LOG_INFO, "Initial bytes %d", len);
+ }
syslog(LOG_INFO, "Receiving ...");
@@ -328,14 +371,17 @@ static void usage(void)
{
printf("scotest - SCO testing\n"
"Usage:\n");
- printf("\tscotest <mode> [-b bytes] [bd_addr]\n");
+ printf("\tscotest <mode> [options] [bd_addr]\n");
printf("Modes:\n"
"\t-d dump (server)\n"
"\t-c reconnect (client)\n"
"\t-m multiple connects (client)\n"
"\t-r receive (server)\n"
"\t-s connect and send (client)\n"
- "\t-n connect and be silent (client)\n");
+ "\t-n connect and be silent (client)\n"
+ "Options:\n"
+ "\t[-b bytes]\n"
+ "\t[-W seconds] enable deferred setup\n");
}
int main(int argc ,char *argv[])
@@ -343,7 +389,7 @@ int main(int argc ,char *argv[])
struct sigaction sa;
int opt, sk, mode = RECV;
- while ((opt=getopt(argc,argv,"rdscmnb:")) != EOF) {
+ while ((opt = getopt(argc, argv, "rdscmnb:W:")) != EOF) {
switch(opt) {
case 'r':
mode = RECV;
@@ -373,6 +419,10 @@ int main(int argc ,char *argv[])
data_size = atoi(optarg);
break;
+ case 'W':
+ defer_setup = atoi(optarg);
+ break;
+
default:
usage();
exit(1);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH v4 05/16] sbc: Add mmx primitive for 1b 8s analysis
From: Frédéric Dalleau @ 2012-11-14 15:43 UTC (permalink / raw)
To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1351589975-22640-6-git-send-email-frederic.dalleau@linux.intel.com>
Hi,
Since I'm gonna resend a new series, I'll comment myself ;)
On 10/30/2012 10:39 AM, Frédéric Dalleau wrote:
> +static inline void sbc_analyze_1b_8s_mmx(struct sbc_encoder_state *state,
> + int16_t *x, int32_t *out, int out_stride)
> +{
> + if (state->odd)
> + sbc_analyze_eight_mmx(x, out, analysis_consts_fixed8_simd_odd);
> + else
> + sbc_analyze_eight_mmx(x, out, analysis_consts_fixed8_simd_even);
> +
> + state->odd = !state->odd;
> +
> + __asm__ volatile ("emms\n");
> +}
> +
One thing bother me about this patch : the emms instruction is called
after every block, instead of every four blocks until now. I have very
little knowledge about this, but I read that emms instruction is
somewhat expensive.
Some quick tests haven't shown differences, but it is possible to add a
post analyze callback to overcome this. In this case, emms instruction
could be run every 15 blocks or whatever is defined.
Is it worth it?
Thanks,
Frédéric
^ permalink raw reply
* [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352907572-7113-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
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(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 10b3062..4a635f1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4529,12 +4529,12 @@ static void l2cap_do_create(struct l2cap_chan *chan, int result,
/* Incoming channel on AMP */
if (result == L2CAP_CR_SUCCESS) {
/* Send successful response */
- rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS);
- rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
+ rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
+ rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
} else {
/* Send negative response */
- rsp.result = cpu_to_le16(L2CAP_CR_NO_MEM);
- rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
+ rsp.result = __constant_cpu_to_le16(L2CAP_CR_NO_MEM);
+ rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
}
l2cap_send_cmd(chan->conn, chan->ident, L2CAP_CREATE_CHAN_RSP,
--
1.7.10.4
^ permalink raw reply related
* [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352907572-7113-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Set chan->fcs to L2CAP_FCS_NONE only for new L2CAP channels
(not moved). Other side can still request to use FCS.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/amp.c | 1 -
net/bluetooth/l2cap_core.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index eaf473f..0258b26 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -392,7 +392,6 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
bredr_chan->remote_amp_id = hs_hcon->remote_id;
bredr_chan->hs_hcon = hs_hcon;
bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
- bredr_chan->fcs = L2CAP_FCS_NONE;
__l2cap_physical_cfm(bredr_chan, 0);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 138d505..10b3062 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4518,6 +4518,8 @@ void l2cap_move_start(struct l2cap_chan *chan)
static void l2cap_do_create(struct l2cap_chan *chan, int result,
u8 local_amp_id, u8 remote_amp_id)
{
+ chan->fcs = L2CAP_FCS_NONE;
+
if (!test_bit(CONF_CONNECT_PEND, &chan->conf_state)) {
struct l2cap_conn_rsp rsp;
char buf[128];
--
1.7.10.4
^ permalink raw reply related
* [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Remove locking from l2cap_physical_cfm and lock chan inside
amp_physical_cfm.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/amp.c | 6 +++++-
net/bluetooth/l2cap_core.c | 7 ++-----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d65db45..f57fab0 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -811,6 +811,6 @@ void l2cap_send_conn_req(struct l2cap_chan *chan);
void l2cap_move_start(struct l2cap_chan *chan);
void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
u8 status);
-void l2cap_physical_cfm(struct l2cap_chan *chan, int result);
+void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
#endif /* __L2CAP_H */
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 4b2fea6..eaf473f 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -386,13 +386,17 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
bredr_chan = mgr->bredr_chan;
+ l2cap_chan_lock(bredr_chan);
+
set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags);
bredr_chan->remote_amp_id = hs_hcon->remote_id;
bredr_chan->hs_hcon = hs_hcon;
bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
bredr_chan->fcs = L2CAP_FCS_NONE;
- l2cap_physical_cfm(bredr_chan, 0);
+ __l2cap_physical_cfm(bredr_chan, 0);
+
+ l2cap_chan_unlock(bredr_chan);
hci_dev_put(bredr_hdev);
}
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a1faaab..138d505 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4612,7 +4612,8 @@ static void l2cap_do_move_cancel(struct l2cap_chan *chan, int result)
l2cap_ertm_send(chan);
}
-void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
+/* Invoke with locked chan */
+void __l2cap_physical_cfm(struct l2cap_chan *chan, int result)
{
u8 local_amp_id = chan->local_amp_id;
u8 remote_amp_id = chan->remote_amp_id;
@@ -4620,8 +4621,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d",
chan, result, local_amp_id, remote_amp_id);
- l2cap_chan_lock(chan);
-
if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) {
l2cap_chan_unlock(chan);
return;
@@ -4645,8 +4644,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
break;
}
}
-
- l2cap_chan_unlock(chan);
}
static inline int l2cap_move_channel_req(struct l2cap_conn *conn,
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v4 11/16] sbc: Add SBC_MSBC flag to enable 15 block encoding
From: Frédéric Dalleau @ 2012-11-14 15:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1352904577.20338.10.camel@aeonflux>
Hi Marcel,
On 11/14/2012 03:49 PM, Marcel Holtmann wrote:
> I am debating to actually call this SBC_FLAG_MSBC instead of just
> SBC_MSBC. Anyone any comments?
The use of the flag may not be the most elegant API. As an alternative,
maybe we could have a specific function for msbc initialization. Then,
instead of sbc_init(), sbc_encode() sbc_decode(), we could have
msbc_init(), sbc_encode(), sbc_decode().
The biggest advantage is that parameters like bitpool, subbands,
allocation, and other parts could be specified inside this function
instead of being given from the application.
Regards,
Frédéric
^ permalink raw reply
* Re: [PATCH BlueZ 1/1] gdbus: Fix compilation error due to missing #defines
From: Lucas De Marchi @ 2012-11-14 15:13 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: linux-bluetooth
In-Reply-To: <1352898430-3383-1-git-send-email-s.syam@samsung.com>
On Wed, Nov 14, 2012 at 11:07 AM, Syam Sidhardhan <s.syam@samsung.com> wrote:
> Since these are simple #define strings, we are defining it here
> instead of upgrading to D-Bus 1.5 or later.
>
> Log:
> CC gdbus/object.o
> gdbus/object.c: In function ‘properties_set’:
> gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared
> (first use in this function)
> gdbus/object.c:876:7: note: each undeclared identifier is reported
> only once for each function it appears in
> gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’
> undeclared (first use in this function)
> make[1]: *** [gdbus/object.o] Error 1
> make: *** [all] Error 2
> ---
> gdbus/object.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/gdbus/object.c b/gdbus/object.c
> index e3ad067..3101ca6 100644
> --- a/gdbus/object.c
> +++ b/gdbus/object.c
> @@ -39,6 +39,14 @@
>
> #define DBUS_INTERFACE_OBJECT_MANAGER "org.freedesktop.DBus.ObjectManager"
>
> +#ifndef DBUS_ERROR_UNKNOWN_PROPERTY
> +#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
> +#endif
> +
> +#ifndef DBUS_ERROR_PROPERTY_READ_ONLY
> +#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
> +#endif
> +
> struct generic_data {
> unsigned int refcount;
> DBusConnection *conn;
> --
> 1.7.4.1
Ack
Lucas De Marchi
^ permalink raw reply
* Re: CSA2: User space aspect
From: Michael Knudsen @ 2012-11-14 14:55 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <509BB56A.80609@samsung.com>
On 2012-11-08 14:36, Michael Knudsen wrote:
> If anyone else has an ideas or opinions about this, please speak up,
> otherwise I'll try coming up with an interface specification with
> more details.
This diff shows the direction I'm heading:
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index 1e35c43..a565a4d 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -51,6 +51,42 @@ struct sco_conninfo {
__u8 dev_class[3];
};
+/* Audio format setting */
+#define SCO_HOST_FORMAT 0x04
+#define SCO_AIR_FORMAT 0x05
+
+#define SCO_FORMAT_ULAW 0x00
+#define SCO_FORMAT_ALAW 0x01
+#define SCO_FORMAT_CVSD 0x02
+#define SCO_FORMAT_TRANSPARENT 0x03
+#define SCO_FORMAT_PCM 0x05
+#define SCO_FORMAT_MSBC 0x05
+#define SCO_FORMAT_VENDOR 0xff
+struct sco_format_vendor {
+ __u16 vendor;
+ __u16 codec;
+};
+
+struct sco_format {
+ __u8 in_format;
+ struct sco_format_vendor in_vendor;
+
+ __u8 out_format;
+ struct sco_format_vendor out_vendor;
+};
+
+#define SCO_CODECS 0x06
+struct sco_codecs {
+ __u8 count;
+ __u8 *codec;
+};
+
+#define SCO_CODECS_VENDOR 0x07
+struct sco_codecs_vendor {
+ __u8 count;
+ struct sco_format_vendor *format;
+};
+
/* ---- SCO connections ---- */
struct sco_conn {
struct hci_conn *hcon;
@@ -74,6 +110,8 @@ struct sco_pinfo {
struct bt_sock bt;
__u32 flags;
struct sco_conn *conn;
+ struct sco_format host_format;
+ struct sco_format air_format;
};
#endif /* __SCO_H */
Basically, this adds four socket options (I'll do the audio path
stuff as well once this is done):
SCO_AIR_FORMAT
SCO_HOST_FORMAT
SCO_CODECS (ro)
SCO_CODECS_VENDOR (ro)
The SCO_CODECS ones provide the application with a list of codecs
supported by the hdev as indicated in the HCI_Read_Local_Supported_Codecs
command response, and if the hdev does not support this command a
default of linear PCM, CVSD, and transparent will be provided.
Because the result length is variable, the idea is that the application-
provided structure is modified by the kernel to hold the actual number
of results so the application can allocate a buffer accordingly, e.g.:
struct sco_codecs sc;
memset(&sc, 0, sizeof(sc));
getsockopt(sk, SOL_SCO, SCO_CODECS, &sk);
sk.codecs = malloc(sk.count);
getsockopt(sk, SOL_SCO, SCO_CODECS, &sk);
The SCO_*_FORMAT ones allows the application to set the parameters that
are to be used on host-controller and controller-controller paths. While
the spec requires the pairs (host input/output, air input/output) to be
identical, I don't see a reason to enforce this in the API, thus all are
set independently.
So, before I spend any more time on this.. comments?
-m.
^ permalink raw reply related
* Re: [PATCH v4 00/16] mSBC tests
From: Marcel Holtmann @ 2012-11-14 14:50 UTC (permalink / raw)
To: frederic.dalleau; +Cc: linux-bluetooth
In-Reply-To: <50A36BAC.4090604@linux.intel.com>
Hi Fred,
> > v4 integrate latest comments from Siarhei:
> > - remove state->pending field from sbc_encoder_state
> > - add armv6 and iwmmxt primitives
> > - use simd primitive instead of neon
> > - reorder patches so that the SBC_MSBC flag is exposed to users only when
> > implementation is complete.
>
> Any feedback ?
beside a tiny cosmetic comment, I have nothing. However I am not the
expert here. If Siarhei looks over this and is fine with it, I will be
as well.
Regards
Marcel
^ 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