* Re: Feedback on potential fix for issue while advertising Feature List
From: Bart Westgeest @ 2012-11-12 19:36 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <20121110122535.GA26532@x220.P-661HNU-F1>
> I think the option of looking at the length and using the old
> type for < 256 and a 16-bit type for greater lengths would be the
> safest.
Thanks for the feedback. I'll start working on a patch.
^ permalink raw reply
* [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Anderson Lizardo @ 2012-11-12 21:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
suspend.c is a symlink generated at build time, therefore it should be
created on build directory. Additionally, it is necessary to add
-I$(srcdir)/profiles/input to CPPFLAGS so suspend.h can be found (the
compiler does not follow symlinks prior to resolving #include
directives).
---
Makefile.am | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index d49e8a0..c398e74 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -366,6 +366,10 @@ if MCAP
AM_CPPFLAGS += -I$(builddir)/health
endif
+if HOGPLUGIN
+AM_CPPFLAGS += -I$(srcdir)/profiles/input
+endif
+
unit_objects =
if TEST
@@ -405,7 +409,7 @@ profiles/sap/sap.c: profiles/sap/@SAP_DRIVER@
$(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@
profiles/input/suspend.c: profiles/input/@HOG_SUSPEND_DRIVER@
- $(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@
+ $(AM_V_GEN)$(LN_S) $(abs_top_builddir)/$< $@
scripts/%.rules:
$(AM_V_GEN)cp $(subst 97-,,$@) $@
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Johan Hedberg @ 2012-11-13 8:05 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1352754221-29672-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Lizardo,
On Mon, Nov 12, 2012, Anderson Lizardo wrote:
> suspend.c is a symlink generated at build time, therefore it should be
> created on build directory. Additionally, it is necessary to add
> -I$(srcdir)/profiles/input to CPPFLAGS so suspend.h can be found (the
> compiler does not follow symlinks prior to resolving #include
> directives).
> ---
> Makefile.am | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Update dbusoob API
From: Johan Hedberg @ 2012-11-13 8:09 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1352735596-731-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Mon, Nov 12, 2012, Szymon Janc wrote:
> This updates AddRemoteData method to create and return device object path.
>
> With recent change on how new device objects are created it is no
> longer possible to create device object from string with
> org.bluez.Adapter interface. When adding OOB data for specified
> address device object is created if it was not yet existing.
>
> Path to object is returned in AddRemoteData to avoid need for extra
> FindDevice() call on org.bluez.Adapter to get object maching specified
> address.
>
> Question:
> Should RemoveRemoteData be updated to accept device path instead of address?
> (and therefore require existing object, this method doesn't remove object or
> any storage data but only deletes hash/rand kept in kernel).
I'm not sure about this one. Usually passing object paths as a parameter
means you should be instead having the method on top of the object path
itself. Maybe we just keep this symmetric for now by using the address
instead.
Anyway, I went ahead and applied the AddRemoteData patch (after removing
the Change-Id tag - please remember to remove those in the future).
Johan
^ permalink raw reply
* Re: [PATCH] device: Defer write to storage
From: Johan Hedberg @ 2012-11-13 8:11 UTC (permalink / raw)
To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1352735024-2733-1-git-send-email-frederic.danis@linux.intel.com>
Hi Frederic,
On Mon, Nov 12, 2012, Frédéric Danis wrote:
> Defere write to storage using g_idle_add() to avoid multiple
> open/write/close operations when device properties are changed
> in sequence.
> ---
> src/device.c | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
Applied after a couple of cosmetic fixes (we try to use > 0 for testing
for valid GSource IDs). Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] gatt: Update characteristic names translation table
From: Johan Hedberg @ 2012-11-13 8:12 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1352722128-12100-1-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
On Mon, Nov 12, 2012, Andrzej Kaczmarek wrote:
> ---
> attrib/client.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [RFC v0 0/7] Manager/Adapter transition to ObjectManager
From: Mikel Astiz @ 2012-11-13 10:44 UTC (permalink / raw)
To: Mikel Astiz, linux-bluetooth, Mikel Astiz
In-Reply-To: <20121112192607.GA6300@x220.P-661HNU-F1>
Hi Johan,
On Mon, Nov 12, 2012 at 8:26 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Mikel,
>
>> > Mikel Astiz (7):
>> > manager: Expose default adapter using property
>> > manager: Remove redundant D-Bus signals
>> > manager: Remove redundant Adapters property
>> > adapter: Remove redundant D-Bus signals
>> > adapter: Remove DevicesFound signal
>> > adapter: Remove redundant Devices property
>> > adapter: Remove FindDevice method from D-Bus API
>> >
>> > doc/adapter-api.txt | 32 +--------
>> > doc/manager-api.txt | 28 +-------
>> > src/adapter.c | 187 +---------------------------------------------------
>> > src/manager.c | 103 +++++++----------------------
>> > 4 files changed, 29 insertions(+), 321 deletions(-)
>>
>> All patches except 5/7 (which needs a bit more discussion) have been
>> applied. Thanks.
>
> I had to revert all of these since I didn't realize you hadn't updated
> the test scripts (all of which broke with these patches). Also, it seems
> the DefaultAdapter patch is also broken since I never saw that property
> (e.g. with test/get-managed-objects). Please send a new patch set once
> you've got the scripts converted and the DefaultAdapter patch fixed.
> Thanks.
You're right, we should keep the test scripts in sync all the time. I
tried to warn you about this in the cover-letter but no problem, I
will send v2 with the changes you suggest.
Regarding the DefaultAdapter property, it was working for me, but I
was using the Properties interface. The test script you mention is
indeed not reporting the property, but this is because the root object
is not a "managed object", and this property is associated to the
root. This is no real issue IMO but still, for convenience reasons: do
you think we should move the org.bluez.Manager interface to some other
object path such as /adapters? As a side effect, this could make it
possible that clients filter out signals (i.e. InterfacesAdded) based
on the object path.
Cheers,
Mikel
^ permalink raw reply
* Re: [PATCH v2] neard: Set device name in cache
From: Johan Hedberg @ 2012-11-13 11:32 UTC (permalink / raw)
To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1352299230-6201-1-git-send-email-frederic.danis@linux.intel.com>
Hi Frederic,
On Wed, Nov 07, 2012, Frédéric Danis wrote:
> If device existed previously, it has been removed before calling of
> btd_event_remote_name(), so this just update storage cache and name
> property change of device object is not emitted.
> ---
> plugins/neard.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Lucas De Marchi @ 2012-11-13 12:21 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1352754221-29672-1-git-send-email-anderson.lizardo@openbossa.org>
On Mon, Nov 12, 2012 at 7:03 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> suspend.c is a symlink generated at build time, therefore it should be
> created on build directory. Additionally, it is necessary to add
> -I$(srcdir)/profiles/input to CPPFLAGS so suspend.h can be found (the
> compiler does not follow symlinks prior to resolving #include
> directives).
> ---
> Makefile.am | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index d49e8a0..c398e74 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -366,6 +366,10 @@ if MCAP
> AM_CPPFLAGS += -I$(builddir)/health
> endif
>
> +if HOGPLUGIN
> +AM_CPPFLAGS += -I$(srcdir)/profiles/input
> +endif
Humn... maybe we need to review these CPPFLAGS for plugins. Appending
it to AM_CPPFLAGS means that every single source file has
"-I$(srcdir)/profiles/input". Even those sources not at all related to
HOGPLUGIN.
However the only way I can think to fix it is by creating convenience
libs since autofoo doesn't support CPPFLAGS per source file.
Lucas De Marchi
^ permalink raw reply
* [PATCH 1/3] avctp: Fix dead assignment in control_response
From: Szymon Janc @ 2012-11-13 12:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Value stored to req is never read before writing it again.
---
audio/avctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/audio/avctp.c b/audio/avctp.c
index 6ba25e4..29756f6 100644
--- a/audio/avctp.c
+++ b/audio/avctp.c
@@ -577,7 +577,7 @@ static void control_response(struct avctp_channel *control,
size_t operand_count)
{
struct avctp_pending_req *p = control->p;
- struct avctp_control_req *req = p->data;
+ struct avctp_control_req *req;
GSList *l;
if (p && p->transaction == avctp->transaction) {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/3] avrcp: Fix dead assignments in ct_set_setting
From: Szymon Janc @ 2012-11-13 12:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1352811160-12722-1-git-send-email-szymon.janc@tieto.com>
Value stored in val is never read before writing it again. After
fixing val same applies to attr variable.
---
audio/avrcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/audio/avrcp.c b/audio/avrcp.c
index e3ce2fb..2517df8 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1944,8 +1944,8 @@ static bool ct_set_setting(struct media_player *mp, const char *key,
const char *value, void *user_data)
{
struct avrcp_player *player = user_data;
- int attr = attr_to_val(key);
- int val = attrval_to_val(attr, value);
+ int attr;
+ int val;
struct avrcp *session;
session = player->sessions->data;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/3] network: Fix dead assignment in connect_cb
From: Szymon Janc @ 2012-11-13 12:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1352811160-12722-1-git-send-email-szymon.janc@tieto.com>
Value stored to err_msg is never read in case err was not NULL.
Simply remove err_msg and pass strerror() directly where it is used.
---
profiles/network/connection.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index abcbee8..1a1fb4d 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -371,19 +371,16 @@ static int bnep_connect(struct network_conn *nc)
static void connect_cb(GIOChannel *chan, GError *err, gpointer data)
{
struct network_conn *nc = data;
- const char *err_msg;
int perr;
if (err) {
error("%s", err->message);
- err_msg = err->message;
goto failed;
}
perr = bnep_connect(nc);
if (perr < 0) {
- err_msg = strerror(-perr);
- error("bnep connect(): %s (%d)", err_msg, -perr);
+ error("bnep connect(): %s (%d)", strerror(-perr), -perr);
goto failed;
}
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Anderson Lizardo @ 2012-11-13 12:52 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: linux-bluetooth
In-Reply-To: <CAMOw1v4h9wfcFLL-j5+fmEUNF=ShHZryw93aOC+_8d2NsbMFag@mail.gmail.com>
Hi Lucas,
On Tue, Nov 13, 2012 at 8:21 AM, Lucas De Marchi
<lucas.demarchi@profusion.mobi> wrote:
> On Mon, Nov 12, 2012 at 7:03 PM, Anderson Lizardo
> <anderson.lizardo@openbossa.org> wrote:
>> suspend.c is a symlink generated at build time, therefore it should be
>> created on build directory. Additionally, it is necessary to add
>> -I$(srcdir)/profiles/input to CPPFLAGS so suspend.h can be found (the
>> compiler does not follow symlinks prior to resolving #include
>> directives).
>> ---
>> Makefile.am | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index d49e8a0..c398e74 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -366,6 +366,10 @@ if MCAP
>> AM_CPPFLAGS += -I$(builddir)/health
>> endif
>>
>> +if HOGPLUGIN
>> +AM_CPPFLAGS += -I$(srcdir)/profiles/input
>> +endif
>
> Humn... maybe we need to review these CPPFLAGS for plugins. Appending
> it to AM_CPPFLAGS means that every single source file has
> "-I$(srcdir)/profiles/input". Even those sources not at all related to
> HOGPLUGIN.
>
> However the only way I can think to fix it is by creating convenience
> libs since autofoo doesn't support CPPFLAGS per source file.
I agree it is not the best solution. Actually, I think we can overcome
the problem completely by getting rid of symlinks for "drivers" (like
sap-{u8500,dummy}.c, suspend-dummy.c,
telephony-{dummy,maemo5,maemo6,ofono}.c) and having everything
built-in and enabled/disabled based on which D-Bus services are
running on the system (or, if not possible, by using config options).
This would also help with spotting build breakages, since all BlueZ
code could be compiled by a single "./bootstrap-configure && make"
call.
This was suggested by Marcel sometime ago on the mailing list, but no
one has come up with actually implementing this.
This commit for now will fix make distcheck breakage, and in my tests
it did not break anything else.
I will propose a TODO entry for this, so someone can work on it.
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Lucas De Marchi @ 2012-11-13 12:55 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_NsCEmcjhtfSNh8mN5keoLzTtJsdN4+bpmdtJVzPgf4-Q@mail.gmail.com>
On Tue, Nov 13, 2012 at 10:52 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Lucas,
>
> On Tue, Nov 13, 2012 at 8:21 AM, Lucas De Marchi
> <lucas.demarchi@profusion.mobi> wrote:
>> On Mon, Nov 12, 2012 at 7:03 PM, Anderson Lizardo
>> <anderson.lizardo@openbossa.org> wrote:
>>> suspend.c is a symlink generated at build time, therefore it should be
>>> created on build directory. Additionally, it is necessary to add
>>> -I$(srcdir)/profiles/input to CPPFLAGS so suspend.h can be found (the
>>> compiler does not follow symlinks prior to resolving #include
>>> directives).
>>> ---
>>> Makefile.am | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Makefile.am b/Makefile.am
>>> index d49e8a0..c398e74 100644
>>> --- a/Makefile.am
>>> +++ b/Makefile.am
>>> @@ -366,6 +366,10 @@ if MCAP
>>> AM_CPPFLAGS += -I$(builddir)/health
>>> endif
>>>
>>> +if HOGPLUGIN
>>> +AM_CPPFLAGS += -I$(srcdir)/profiles/input
>>> +endif
>>
>> Humn... maybe we need to review these CPPFLAGS for plugins. Appending
>> it to AM_CPPFLAGS means that every single source file has
>> "-I$(srcdir)/profiles/input". Even those sources not at all related to
>> HOGPLUGIN.
>>
>> However the only way I can think to fix it is by creating convenience
>> libs since autofoo doesn't support CPPFLAGS per source file.
>
> I agree it is not the best solution. Actually, I think we can overcome
> the problem completely by getting rid of symlinks for "drivers" (like
> sap-{u8500,dummy}.c, suspend-dummy.c,
> telephony-{dummy,maemo5,maemo6,ofono}.c) and having everything
> built-in and enabled/disabled based on which D-Bus services are
> running on the system (or, if not possible, by using config options).
what do you mean by "running on the system"?
Lucas De Marchi
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Szymon Janc @ 2012-11-13 12:57 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: Lucas De Marchi, linux-bluetooth@vger.kernel.org
In-Reply-To: <CAJdJm_NsCEmcjhtfSNh8mN5keoLzTtJsdN4+bpmdtJVzPgf4-Q@mail.gmail.com>
Hi,
> > Humn... maybe we need to review these CPPFLAGS for plugins. Appending
> > it to AM_CPPFLAGS means that every single source file has
> > "-I$(srcdir)/profiles/input". Even those sources not at all related to
> > HOGPLUGIN.
> >
> > However the only way I can think to fix it is by creating convenience
> > libs since autofoo doesn't support CPPFLAGS per source file.
>
> I agree it is not the best solution. Actually, I think we can overcome
> the problem completely by getting rid of symlinks for "drivers" (like
> sap-{u8500,dummy}.c, suspend-dummy.c,
> telephony-{dummy,maemo5,maemo6,ofono}.c) and having everything
> built-in and enabled/disabled based on which D-Bus services are
> running on the system (or, if not possible, by using config options).
> This would also help with spotting build breakages, since all BlueZ
> code could be compiled by a single "./bootstrap-configure && make"
> call.
All code is compiled, it is just not linked.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Anderson Lizardo @ 2012-11-13 13:02 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: linux-bluetooth
In-Reply-To: <CAMOw1v58=ZfoG919+N3ARNRbr6UEmoPhRKcuzfzRELa8G=9GeQ@mail.gmail.com>
Hi Lucas,
On Tue, Nov 13, 2012 at 8:55 AM, Lucas De Marchi
<lucas.demarchi@profusion.mobi> wrote:
>> I agree it is not the best solution. Actually, I think we can overcome
>> the problem completely by getting rid of symlinks for "drivers" (like
>> sap-{u8500,dummy}.c, suspend-dummy.c,
>> telephony-{dummy,maemo5,maemo6,ofono}.c) and having everything
>> built-in and enabled/disabled based on which D-Bus services are
>> running on the system (or, if not possible, by using config options).
>
> what do you mean by "running on the system"?
In situations where it is appropriate, we have a
g_dbus_add_service_watch() which will trigger the support code
specific for that service, instead of relying on enabling the service
support at compile time. In practice the support code will be always
compiled.
For situations where the driver code is not related to any D-Bus
service, a config option (in e.g. /etc/bluetooth/<profile>.conf) could
enable/disable the support. The main benefit here is that there will
be no "dead code" that never gets compiled because bootstrap-configure
is not able to enable all drivers.
Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH BlueZ] build: Fix make distcheck for input plugin
From: Anderson Lizardo @ 2012-11-13 13:06 UTC (permalink / raw)
To: Szymon Janc; +Cc: Lucas De Marchi, linux-bluetooth@vger.kernel.org
In-Reply-To: <6569845.L3ZsFuOrP2@uw000953>
Hi Szymon,
On Tue, Nov 13, 2012 at 8:57 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
>> I agree it is not the best solution. Actually, I think we can overcome
>> the problem completely by getting rid of symlinks for "drivers" (like
>> sap-{u8500,dummy}.c, suspend-dummy.c,
>> telephony-{dummy,maemo5,maemo6,ofono}.c) and having everything
>> built-in and enabled/disabled based on which D-Bus services are
>> running on the system (or, if not possible, by using config options).
>> This would also help with spotting build breakages, since all BlueZ
>> code could be compiled by a single "./bootstrap-configure && make"
>> call.
>
> All code is compiled, it is just not linked.
Sorry, I meant "linked" instead of "compiled" on my explanation. See
the original thread where this was first brought up:
http://thread.gmane.org/gmane.linux.bluez.kernel/30175/focus=30190
It is easier for testing code if it can be enabled/disabled at
runtime, instead of rebuilding with different configure options.
Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH 1/3] avctp: Fix dead assignment in control_response
From: Luiz Augusto von Dentz @ 2012-11-13 13:14 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1352811160-12722-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Tue, Nov 13, 2012 at 2:52 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> Value stored to req is never read before writing it again.
>
> ---
> audio/avctp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/audio/avctp.c b/audio/avctp.c
> index 6ba25e4..29756f6 100644
> --- a/audio/avctp.c
> +++ b/audio/avctp.c
> @@ -577,7 +577,7 @@ static void control_response(struct avctp_channel *control,
> size_t operand_count)
> {
> struct avctp_pending_req *p = control->p;
> - struct avctp_control_req *req = p->data;
> + struct avctp_control_req *req;
> GSList *l;
>
> if (p && p->transaction == avctp->transaction) {
> --
> 1.7.9.5
Pushed, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH BlueZ 00/13] Remove HFP implementation
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
These changes remove HFP implemention from audio plugin and move audio under
profiles directory.
HFP can be emulated by test-profile -u hfp, all the telephony backends are
gone as well since this is now suppose to be a external profile probably
done inside the telephony stack e.g. oFono in use in the platform.
Luiz Augusto von Dentz (13):
audio: Remove HFP and HSP headset role support
audio: Remove HFP option from audio.conf
audio: Remove code using headset
build: Remove telephony-maemo5.c
build: Remove telephony-maemo6.c
build: Remove telephony-ofono.c
build: Remove telephony-dummy.c
build: Remove telephony.h
build: Remove headset.c and headset.h
audio: Remove code HFP and HS gateway role
build: Remove gateway.c and gateway.h
audio: Move to profiles directory
audio: Add support for passing endpoints as custom property
Makefile.am | 48 +-
audio/gateway.c | 1048 ------------
audio/gateway.h | 75 -
audio/headset.c | 2825 -------------------------------
audio/headset.h | 112 --
audio/manager.c | 1387 ---------------
audio/telephony-dummy.c | 444 -----
audio/telephony-maemo5.c | 2102 -----------------------
audio/telephony-maemo6.c | 2196 ------------------------
audio/telephony-ofono.c | 1636 ------------------
audio/telephony.h | 244 ---
{audio => profiles/audio}/a2dp-codecs.h | 0
{audio => profiles/audio}/a2dp.c | 0
{audio => profiles/audio}/a2dp.h | 0
{audio => profiles/audio}/audio.conf | 4 -
{audio => profiles/audio}/avctp.c | 0
{audio => profiles/audio}/avctp.h | 0
{audio => profiles/audio}/avdtp.c | 0
{audio => profiles/audio}/avdtp.h | 0
{audio => profiles/audio}/avrcp.c | 0
{audio => profiles/audio}/avrcp.h | 0
{audio => profiles/audio}/control.c | 0
{audio => profiles/audio}/control.h | 0
{audio => profiles/audio}/device.c | 198 +--
{audio => profiles/audio}/device.h | 2 -
{audio => profiles/audio}/main.c | 98 +-
profiles/audio/manager.c | 552 ++++++
{audio => profiles/audio}/manager.h | 7 +-
{audio => profiles/audio}/media.c | 245 ++-
{audio => profiles/audio}/media.h | 0
{audio => profiles/audio}/player.c | 0
{audio => profiles/audio}/player.h | 0
{audio => profiles/audio}/rtp.h | 0
{audio => profiles/audio}/sink.c | 0
{audio => profiles/audio}/sink.h | 0
{audio => profiles/audio}/source.c | 0
{audio => profiles/audio}/source.h | 0
{audio => profiles/audio}/transport.c | 380 -----
{audio => profiles/audio}/transport.h | 0
39 files changed, 673 insertions(+), 12930 deletions(-)
delete mode 100644 audio/gateway.c
delete mode 100644 audio/gateway.h
delete mode 100644 audio/headset.c
delete mode 100644 audio/headset.h
delete mode 100644 audio/manager.c
delete mode 100644 audio/telephony-dummy.c
delete mode 100644 audio/telephony-maemo5.c
delete mode 100644 audio/telephony-maemo6.c
delete mode 100644 audio/telephony-ofono.c
delete mode 100644 audio/telephony.h
rename {audio => profiles/audio}/a2dp-codecs.h (100%)
rename {audio => profiles/audio}/a2dp.c (100%)
rename {audio => profiles/audio}/a2dp.h (100%)
rename {audio => profiles/audio}/audio.conf (93%)
rename {audio => profiles/audio}/avctp.c (100%)
rename {audio => profiles/audio}/avctp.h (100%)
rename {audio => profiles/audio}/avdtp.c (100%)
rename {audio => profiles/audio}/avdtp.h (100%)
rename {audio => profiles/audio}/avrcp.c (100%)
rename {audio => profiles/audio}/avrcp.h (100%)
rename {audio => profiles/audio}/control.c (100%)
rename {audio => profiles/audio}/control.h (100%)
rename {audio => profiles/audio}/device.c (69%)
rename {audio => profiles/audio}/device.h (96%)
rename {audio => profiles/audio}/main.c (53%)
create mode 100644 profiles/audio/manager.c
rename {audio => profiles/audio}/manager.h (89%)
rename {audio => profiles/audio}/media.c (91%)
rename {audio => profiles/audio}/media.h (100%)
rename {audio => profiles/audio}/player.c (100%)
rename {audio => profiles/audio}/player.h (100%)
rename {audio => profiles/audio}/rtp.h (100%)
rename {audio => profiles/audio}/sink.c (100%)
rename {audio => profiles/audio}/sink.h (100%)
rename {audio => profiles/audio}/source.c (100%)
rename {audio => profiles/audio}/source.h (100%)
rename {audio => profiles/audio}/transport.c (72%)
rename {audio => profiles/audio}/transport.h (100%)
--
1.7.11.7
^ permalink raw reply
* [PATCH BlueZ 01/13] audio: Remove HFP and HSP headset role support
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The support for these profiles are intended to be external, probably directly
integrated in the telephony stack of the platform in use e.g. oFono.
---
audio/manager.c | 502 --------------------------------------------------------
1 file changed, 502 deletions(-)
diff --git a/audio/manager.c b/audio/manager.c
index 4ea61bf..26dde60 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -91,7 +91,6 @@ static GSList *devices = NULL;
static struct enabled_interfaces enabled = {
.hfp = TRUE,
- .headset = TRUE,
.gateway = FALSE,
.sink = TRUE,
.source = FALSE,
@@ -111,62 +110,6 @@ static struct audio_adapter *find_adapter(GSList *list,
return NULL;
}
-static sdp_record_t *hsp_ag_record(uint8_t ch)
-{
- sdp_list_t *svclass_id, *pfseq, *apseq, *root;
- uuid_t root_uuid, svclass_uuid, ga_svclass_uuid;
- uuid_t l2cap_uuid, rfcomm_uuid;
- sdp_profile_desc_t profile;
- sdp_record_t *record;
- sdp_list_t *aproto, *proto[2];
- sdp_data_t *channel;
-
- record = sdp_record_alloc();
- if (!record)
- return NULL;
-
- sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
- root = sdp_list_append(0, &root_uuid);
- sdp_set_browse_groups(record, root);
-
- sdp_uuid16_create(&svclass_uuid, HEADSET_AGW_SVCLASS_ID);
- svclass_id = sdp_list_append(0, &svclass_uuid);
- sdp_uuid16_create(&ga_svclass_uuid, GENERIC_AUDIO_SVCLASS_ID);
- svclass_id = sdp_list_append(svclass_id, &ga_svclass_uuid);
- sdp_set_service_classes(record, svclass_id);
-
- sdp_uuid16_create(&profile.uuid, HEADSET_PROFILE_ID);
- profile.version = 0x0102;
- pfseq = sdp_list_append(0, &profile);
- sdp_set_profile_descs(record, pfseq);
-
- sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
- proto[0] = sdp_list_append(0, &l2cap_uuid);
- apseq = sdp_list_append(0, proto[0]);
-
- sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
- proto[1] = sdp_list_append(0, &rfcomm_uuid);
- channel = sdp_data_alloc(SDP_UINT8, &ch);
- proto[1] = sdp_list_append(proto[1], channel);
- apseq = sdp_list_append(apseq, proto[1]);
-
- aproto = sdp_list_append(0, apseq);
- sdp_set_access_protos(record, aproto);
-
- sdp_set_info_attr(record, "Headset Audio Gateway", 0, 0);
-
- sdp_data_free(channel);
- sdp_list_free(proto[0], 0);
- sdp_list_free(proto[1], 0);
- sdp_list_free(apseq, 0);
- sdp_list_free(pfseq, 0);
- sdp_list_free(aproto, 0);
- sdp_list_free(root, 0);
- sdp_list_free(svclass_id, 0);
-
- return record;
-}
-
static sdp_record_t *hfp_hs_record(uint8_t ch)
{
sdp_list_t *svclass_id, *pfseq, *apseq, *root;
@@ -223,206 +166,6 @@ static sdp_record_t *hfp_hs_record(uint8_t ch)
return record;
}
-static sdp_record_t *hfp_ag_record(uint8_t ch, uint32_t feat)
-{
- sdp_list_t *svclass_id, *pfseq, *apseq, *root;
- uuid_t root_uuid, svclass_uuid, ga_svclass_uuid;
- uuid_t l2cap_uuid, rfcomm_uuid;
- sdp_profile_desc_t profile;
- sdp_list_t *aproto, *proto[2];
- sdp_record_t *record;
- sdp_data_t *channel, *features;
- uint8_t netid = 0x01;
- uint16_t sdpfeat;
- sdp_data_t *network;
-
- record = sdp_record_alloc();
- if (!record)
- return NULL;
-
- network = sdp_data_alloc(SDP_UINT8, &netid);
- if (!network) {
- sdp_record_free(record);
- return NULL;
- }
-
- sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
- root = sdp_list_append(0, &root_uuid);
- sdp_set_browse_groups(record, root);
-
- sdp_uuid16_create(&svclass_uuid, HANDSFREE_AGW_SVCLASS_ID);
- svclass_id = sdp_list_append(0, &svclass_uuid);
- sdp_uuid16_create(&ga_svclass_uuid, GENERIC_AUDIO_SVCLASS_ID);
- svclass_id = sdp_list_append(svclass_id, &ga_svclass_uuid);
- sdp_set_service_classes(record, svclass_id);
-
- sdp_uuid16_create(&profile.uuid, HANDSFREE_PROFILE_ID);
- profile.version = 0x0105;
- pfseq = sdp_list_append(0, &profile);
- sdp_set_profile_descs(record, pfseq);
-
- sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
- proto[0] = sdp_list_append(0, &l2cap_uuid);
- apseq = sdp_list_append(0, proto[0]);
-
- sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
- proto[1] = sdp_list_append(0, &rfcomm_uuid);
- channel = sdp_data_alloc(SDP_UINT8, &ch);
- proto[1] = sdp_list_append(proto[1], channel);
- apseq = sdp_list_append(apseq, proto[1]);
-
- sdpfeat = (uint16_t) feat & 0xF;
- features = sdp_data_alloc(SDP_UINT16, &sdpfeat);
- sdp_attr_add(record, SDP_ATTR_SUPPORTED_FEATURES, features);
-
- aproto = sdp_list_append(0, apseq);
- sdp_set_access_protos(record, aproto);
-
- sdp_set_info_attr(record, "Hands-Free Audio Gateway", 0, 0);
-
- sdp_attr_add(record, SDP_ATTR_EXTERNAL_NETWORK, network);
-
- sdp_data_free(channel);
- sdp_list_free(proto[0], 0);
- sdp_list_free(proto[1], 0);
- sdp_list_free(apseq, 0);
- sdp_list_free(pfseq, 0);
- sdp_list_free(aproto, 0);
- sdp_list_free(root, 0);
- sdp_list_free(svclass_id, 0);
-
- return record;
-}
-
-static void headset_auth_cb(DBusError *derr, void *user_data)
-{
- struct audio_device *device = user_data;
- GError *err = NULL;
- GIOChannel *io;
-
- device->hs_auth_id = 0;
-
- if (device->hs_preauth_id) {
- g_source_remove(device->hs_preauth_id);
- device->hs_preauth_id = 0;
- }
-
- if (derr && dbus_error_is_set(derr)) {
- error("Access denied: %s", derr->message);
- headset_set_state(device, HEADSET_STATE_DISCONNECTED);
- return;
- }
-
- io = headset_get_rfcomm(device);
-
- if (!bt_io_accept(io, headset_connect_cb, device, NULL, &err)) {
- error("bt_io_accept: %s", err->message);
- g_error_free(err);
- headset_set_state(device, HEADSET_STATE_DISCONNECTED);
- return;
- }
-}
-
-static gboolean hs_preauth_cb(GIOChannel *chan, GIOCondition cond,
- gpointer user_data)
-{
- struct audio_device *device = user_data;
-
- DBG("Headset disconnected during authorization");
-
- btd_cancel_authorization(device->hs_auth_id);
- device->hs_auth_id = 0;
-
- headset_set_state(device, HEADSET_STATE_DISCONNECTED);
-
- device->hs_preauth_id = 0;
-
- return FALSE;
-}
-
-static void ag_confirm(GIOChannel *chan, gpointer data)
-{
- const char *server_uuid, *remote_uuid;
- struct audio_device *device;
- gboolean hfp_active;
- bdaddr_t src, dst;
- GError *err = NULL;
- uint8_t ch;
-
- bt_io_get(chan, &err,
- BT_IO_OPT_SOURCE_BDADDR, &src,
- BT_IO_OPT_DEST_BDADDR, &dst,
- BT_IO_OPT_CHANNEL, &ch,
- BT_IO_OPT_INVALID);
- if (err) {
- error("%s", err->message);
- g_error_free(err);
- goto drop;
- }
-
- if (ch == DEFAULT_HS_AG_CHANNEL) {
- hfp_active = FALSE;
- server_uuid = HSP_AG_UUID;
- remote_uuid = HSP_HS_UUID;
- } else {
- hfp_active = TRUE;
- server_uuid = HFP_AG_UUID;
- remote_uuid = HFP_HS_UUID;
- }
-
- device = manager_get_device(&src, &dst, TRUE);
- if (!device)
- goto drop;
-
- if (!manager_allow_headset_connection(device)) {
- DBG("Refusing headset: too many existing connections");
- goto drop;
- }
-
- if (!device->headset) {
- btd_device_add_uuid(device->btd_dev, remote_uuid);
- if (!device->headset)
- goto drop;
- }
-
- if (headset_get_state(device) > HEADSET_STATE_DISCONNECTED) {
- DBG("Refusing new connection since one already exists");
- goto drop;
- }
-
- headset_set_hfp_active(device, hfp_active);
- headset_set_rfcomm_initiator(device, TRUE);
-
- if (headset_connect_rfcomm(device, chan) < 0) {
- error("headset_connect_rfcomm failed");
- goto drop;
- }
-
- headset_set_state(device, HEADSET_STATE_CONNECTING);
-
- device->hs_auth_id = btd_request_authorization(&device->src,
- &device->dst,
- server_uuid,
- headset_auth_cb,
- device);
- if (device->hs_auth_id == 0) {
- DBG("Authorization denied");
- headset_set_state(device, HEADSET_STATE_DISCONNECTED);
- return;
- }
-
- device->hs_preauth_id = g_io_add_watch(chan,
- G_IO_NVAL | G_IO_HUP | G_IO_ERR,
- hs_preauth_cb, device);
-
- device->auto_connect = auto_connect;
-
- return;
-
-drop:
- g_io_channel_shutdown(chan, TRUE, NULL);
-}
-
static void gateway_auth_cb(DBusError *derr, void *user_data)
{
struct audio_device *device = user_data;
@@ -499,108 +242,6 @@ drop:
g_io_channel_shutdown(chan, TRUE, NULL);
}
-static int headset_server_init(struct audio_adapter *adapter)
-{
- uint8_t chan = DEFAULT_HS_AG_CHANNEL;
- sdp_record_t *record;
- gboolean master = TRUE;
- GError *err = NULL;
- uint32_t features;
- GIOChannel *io;
- const bdaddr_t *src;
-
- if (config) {
- gboolean tmp;
-
- tmp = g_key_file_get_boolean(config, "General", "Master",
- &err);
- if (err) {
- DBG("audio.conf: %s", err->message);
- g_clear_error(&err);
- } else
- master = tmp;
- }
-
- src = adapter_get_address(adapter->btd_adapter);
-
- io = bt_io_listen(NULL, ag_confirm, adapter, NULL, &err,
- BT_IO_OPT_SOURCE_BDADDR, src,
- BT_IO_OPT_CHANNEL, chan,
- BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
- BT_IO_OPT_MASTER, master,
- BT_IO_OPT_INVALID);
- if (!io)
- goto failed;
-
- adapter->hsp_ag_server = io;
-
- record = hsp_ag_record(chan);
- if (!record) {
- error("Unable to allocate new service record");
- goto failed;
- }
-
- if (add_record_to_server(src, record) < 0) {
- error("Unable to register HS AG service record");
- sdp_record_free(record);
- goto failed;
- }
- adapter->hsp_ag_record_id = record->handle;
-
- features = headset_config_init(config);
-
- if (!enabled.hfp)
- return 0;
-
- chan = DEFAULT_HF_AG_CHANNEL;
-
- io = bt_io_listen(NULL, ag_confirm, adapter, NULL, &err,
- BT_IO_OPT_SOURCE_BDADDR, src,
- BT_IO_OPT_CHANNEL, chan,
- BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
- BT_IO_OPT_MASTER, master,
- BT_IO_OPT_INVALID);
- if (!io)
- goto failed;
-
- adapter->hfp_ag_server = io;
-
- record = hfp_ag_record(chan, features);
- if (!record) {
- error("Unable to allocate new service record");
- goto failed;
- }
-
- if (add_record_to_server(src, record) < 0) {
- error("Unable to register HF AG service record");
- sdp_record_free(record);
- goto failed;
- }
- adapter->hfp_ag_record_id = record->handle;
-
- return 0;
-
-failed:
- if (err) {
- error("%s", err->message);
- g_error_free(err);
- }
-
- if (adapter->hsp_ag_server) {
- g_io_channel_shutdown(adapter->hsp_ag_server, TRUE, NULL);
- g_io_channel_unref(adapter->hsp_ag_server);
- adapter->hsp_ag_server = NULL;
- }
-
- if (adapter->hfp_ag_server) {
- g_io_channel_shutdown(adapter->hfp_ag_server, TRUE, NULL);
- g_io_channel_unref(adapter->hfp_ag_server);
- adapter->hfp_ag_server = NULL;
- }
-
- return -1;
-}
-
static int gateway_server_init(struct audio_adapter *adapter)
{
uint8_t chan = DEFAULT_HFP_HS_CHANNEL;
@@ -683,26 +324,6 @@ static void audio_remove(struct btd_profile *p, struct btd_device *device)
audio_device_unregister(dev);
}
-static int hs_probe(struct btd_profile *p, struct btd_device *device,
- GSList *uuids)
-{
- struct audio_device *audio_dev;
-
- audio_dev = get_audio_dev(device);
- if (!audio_dev) {
- DBG("unable to get a device object");
- return -1;
- }
-
- if (audio_dev->headset)
- headset_update(audio_dev, audio_dev->headset, uuids);
- else
- audio_dev->headset = headset_init(audio_dev, uuids,
- enabled.hfp);
-
- return 0;
-}
-
static int ag_probe(struct btd_profile *p, struct btd_device *device,
GSList *uuids)
{
@@ -813,112 +434,6 @@ static struct audio_adapter *audio_adapter_get(struct btd_adapter *adapter)
return adp;
}
-static void state_changed(struct btd_adapter *adapter, gboolean powered)
-{
- struct audio_adapter *adp;
- static gboolean telephony = FALSE;
- GSList *l;
-
- DBG("%s powered %s", adapter_get_path(adapter),
- powered ? "on" : "off");
-
- /* ignore powered change, adapter is powering down */
- if (powered && adapter_powering_down(adapter))
- return;
-
- adp = find_adapter(adapters, adapter);
- if (!adp)
- return;
-
- adp->powered = powered;
-
- if (powered) {
- /* telephony driver already initialized*/
- if (telephony == TRUE)
- return;
- telephony_init();
- telephony = TRUE;
- return;
- }
-
- /* telephony not initialized just ignore power down */
- if (telephony == FALSE)
- return;
-
- for (l = adapters; l; l = l->next) {
- adp = l->data;
-
- if (adp->powered == TRUE)
- return;
- }
-
- telephony_exit();
- telephony = FALSE;
-}
-
-static int headset_server_probe(struct btd_profile *p,
- struct btd_adapter *adapter)
-{
- struct audio_adapter *adp;
- const gchar *path = adapter_get_path(adapter);
- int err;
-
- DBG("path %s", path);
-
- adp = audio_adapter_get(adapter);
- if (!adp)
- return -EINVAL;
-
- err = headset_server_init(adp);
- if (err < 0) {
- audio_adapter_unref(adp);
- return err;
- }
-
- btd_adapter_register_powered_callback(adapter, state_changed);
-
- return 0;
-}
-
-static void headset_server_remove(struct btd_profile *p,
- struct btd_adapter *adapter)
-{
- struct audio_adapter *adp;
- const gchar *path = adapter_get_path(adapter);
-
- DBG("path %s", path);
-
- btd_adapter_unregister_powered_callback(adapter, state_changed);
-
- adp = find_adapter(adapters, adapter);
- if (!adp)
- return;
-
- if (adp->hsp_ag_record_id) {
- remove_record_from_server(adp->hsp_ag_record_id);
- adp->hsp_ag_record_id = 0;
- }
-
- if (adp->hsp_ag_server) {
- g_io_channel_shutdown(adp->hsp_ag_server, TRUE, NULL);
- g_io_channel_unref(adp->hsp_ag_server);
- adp->hsp_ag_server = NULL;
- }
-
- if (adp->hfp_ag_record_id) {
- remove_record_from_server(adp->hfp_ag_record_id);
- adp->hfp_ag_record_id = 0;
- }
-
- if (adp->hfp_ag_server) {
- g_io_channel_shutdown(adp->hfp_ag_server, TRUE, NULL);
- g_io_channel_unref(adp->hfp_ag_server);
- adp->hfp_ag_server = NULL;
- }
-
- audio_adapter_unref(adp);
-}
-
static int gateway_server_probe(struct btd_profile *p,
struct btd_adapter *adapter)
{
@@ -1068,17 +583,6 @@ static void media_server_remove(struct btd_adapter *adapter)
audio_adapter_unref(adp);
}
-static struct btd_profile headset_profile = {
- .name = "audio-headset",
-
- .remote_uuids = BTD_UUIDS(HSP_HS_UUID, HFP_HS_UUID),
- .device_probe = hs_probe,
- .device_remove = audio_remove,
-
- .adapter_probe = headset_server_probe,
- .adapter_remove = headset_server_remove,
-};
-
static struct btd_profile gateway_profile = {
.name = "audio-gateway",
@@ -1187,9 +691,6 @@ int audio_manager_init(GKeyFile *conf, gboolean *enable_sco)
max_connected_headsets = i;
proceed:
- if (enabled.headset)
- btd_profile_register(&headset_profile);
-
if (enabled.gateway)
btd_profile_register(&gateway_profile);
@@ -1213,9 +714,6 @@ void audio_manager_exit(void)
config = NULL;
}
- if (enabled.headset)
- btd_profile_unregister(&headset_profile);
-
if (enabled.gateway)
btd_profile_unregister(&gateway_profile);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 1/3] avctp: Fix dead assignment in control_response
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Szymon Janc <szymon.janc@tieto.com>
Value stored to req is never read before writing it again.
---
audio/avctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/audio/avctp.c b/audio/avctp.c
index 6ba25e4..29756f6 100644
--- a/audio/avctp.c
+++ b/audio/avctp.c
@@ -577,7 +577,7 @@ static void control_response(struct avctp_channel *control,
size_t operand_count)
{
struct avctp_pending_req *p = control->p;
- struct avctp_control_req *req = p->data;
+ struct avctp_control_req *req;
GSList *l;
if (p && p->transaction == avctp->transaction) {
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 02/13] audio: Remove HFP option from audio.conf
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
It is not in use anymore
---
audio/audio.conf | 4 ----
audio/manager.c | 8 --------
audio/manager.h | 1 -
3 files changed, 13 deletions(-)
diff --git a/audio/audio.conf b/audio/audio.conf
index d1c57d3..6bf4482 100644
--- a/audio/audio.conf
+++ b/audio/audio.conf
@@ -25,10 +25,6 @@
# service interacts with remote headset devices)
[Headset]
-# Set to true to support HFP, false means only HSP is supported
-# Defaults to true
-HFP=true
-
# Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
MaxConnected=1
diff --git a/audio/manager.c b/audio/manager.c
index 26dde60..e949509 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -90,7 +90,6 @@ static GSList *adapters = NULL;
static GSList *devices = NULL;
static struct enabled_interfaces enabled = {
- .hfp = TRUE,
.gateway = FALSE,
.sink = TRUE,
.source = FALSE,
@@ -674,13 +673,6 @@ int audio_manager_init(GKeyFile *conf, gboolean *enable_sco)
} else
auto_connect = b;
- b = g_key_file_get_boolean(config, "Headset", "HFP",
- &err);
- if (err)
- g_clear_error(&err);
- else
- enabled.hfp = b;
-
err = NULL;
i = g_key_file_get_integer(config, "Headset", "MaxConnected",
&err);
diff --git a/audio/manager.h b/audio/manager.h
index 08d814f..8fb208c 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -23,7 +23,6 @@
*/
struct enabled_interfaces {
- gboolean hfp;
gboolean headset;
gboolean gateway;
gboolean sink;
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 2/3] avrcp: Fix dead assignments in ct_set_setting
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Szymon Janc <szymon.janc@tieto.com>
Value stored in val is never read before writing it again. After
fixing val same applies to attr variable.
---
audio/avrcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/audio/avrcp.c b/audio/avrcp.c
index e3ce2fb..2517df8 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1944,8 +1944,8 @@ static bool ct_set_setting(struct media_player *mp, const char *key,
const char *value, void *user_data)
{
struct avrcp_player *player = user_data;
- int attr = attr_to_val(key);
- int val = attrval_to_val(attr, value);
+ int attr;
+ int val;
struct avrcp *session;
session = player->sessions->data;
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 03/13] audio: Remove code using headset
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This is to be replaced with external profile support.
---
audio/device.c | 191 +-----------------------------------------------
audio/headset.c | 3 -
audio/main.c | 28 +------
audio/manager.c | 48 +-----------
audio/manager.h | 3 -
audio/media.c | 74 +------------------
audio/transport.c | 215 ------------------------------------------------------
7 files changed, 9 insertions(+), 553 deletions(-)
diff --git a/audio/device.c b/audio/device.c
index aee4161..aaa666d 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -53,7 +53,6 @@
#include "control.h"
#include "avctp.h"
#include "avrcp.h"
-#include "headset.h"
#include "gateway.h"
#include "sink.h"
#include "source.h"
@@ -74,7 +73,6 @@ typedef enum {
struct dev_priv {
audio_state_t state;
- headset_state_t hs_state;
sink_state_t sink_state;
avctp_state_t avctp_state;
@@ -92,7 +90,6 @@ struct dev_priv {
static unsigned int sink_callback_id = 0;
static unsigned int avctp_callback_id = 0;
static unsigned int avdtp_callback_id = 0;
-static unsigned int headset_callback_id = 0;
static void device_free(struct audio_device *dev)
{
@@ -208,8 +205,6 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
sink_shutdown(dev->sink);
- else if (priv->hs_state != HEADSET_STATE_DISCONNECTED)
- headset_shutdown(dev);
else
priv->disconnecting = FALSE;
}
@@ -270,84 +265,6 @@ static void device_set_state(struct audio_device *dev, audio_state_t new_state)
DBUS_TYPE_STRING, &state_str);
}
-static gboolean avdtp_connect_timeout(gpointer user_data)
-{
- struct audio_device *dev = user_data;
-
- dev->priv->avdtp_timer = 0;
-
- if (dev->sink) {
- struct avdtp *session = avdtp_get(&dev->src, &dev->dst);
-
- if (!session)
- return FALSE;
-
- sink_setup_stream(dev->sink, session);
- avdtp_unref(session);
- }
-
- return FALSE;
-}
-
-static gboolean device_set_avdtp_timer(struct audio_device *dev)
-{
- struct dev_priv *priv = dev->priv;
- guint timeout = AVDTP_CONNECT_TIMEOUT;
-
- if (!dev->sink)
- return FALSE;
-
- if (priv->avdtp_timer)
- return FALSE;
-
- /* If the headset is the HSP/HFP RFCOMM initiator, give the headset
- * time to initiate AVDTP signalling (and avoid further racing) */
- if (dev->headset && headset_get_rfcomm_initiator(dev))
- timeout += AVDTP_CONNECT_TIMEOUT_BOOST;
-
- priv->avdtp_timer = g_timeout_add_seconds(timeout,
- avdtp_connect_timeout,
- dev);
-
- return TRUE;
-}
-
-static gboolean headset_connect_timeout(gpointer user_data)
-{
- struct audio_device *dev = user_data;
- struct dev_priv *priv = dev->priv;
-
- dev->priv->headset_timer = 0;
-
- if (dev->headset == NULL)
- return FALSE;
-
- if (headset_config_stream(dev, FALSE, NULL, NULL) == 0) {
- if (priv->state != AUDIO_STATE_CONNECTED &&
- (priv->sink_state == SINK_STATE_CONNECTED ||
- priv->sink_state == SINK_STATE_PLAYING))
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- }
-
- return FALSE;
-}
-
-static gboolean device_set_headset_timer(struct audio_device *dev)
-{
- struct dev_priv *priv = dev->priv;
-
- if (!dev->headset)
- return FALSE;
-
- if (priv->headset_timer)
- return FALSE;
-
- priv->headset_timer = g_timeout_add_seconds(HEADSET_CONNECT_TIMEOUT,
- headset_connect_timeout, dev);
-
- return TRUE;
-}
-
static void device_avdtp_cb(struct audio_device *dev, struct avdtp *session,
avdtp_session_state_t old_state,
avdtp_session_state_t new_state,
@@ -382,44 +299,17 @@ static void device_sink_cb(struct audio_device *dev,
device_remove_control_timer(dev);
avrcp_disconnect(dev);
}
- if (priv->hs_state != HEADSET_STATE_DISCONNECTED &&
- (priv->dc_req || priv->disconnecting)) {
- headset_shutdown(dev);
- break;
- }
- if (priv->hs_state == HEADSET_STATE_DISCONNECTED)
- device_set_state(dev, AUDIO_STATE_DISCONNECTED);
- else if (old_state == SINK_STATE_CONNECTING) {
- switch (priv->hs_state) {
- case HEADSET_STATE_CONNECTED:
- case HEADSET_STATE_PLAY_IN_PROGRESS:
- case HEADSET_STATE_PLAYING:
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- default:
- break;
- }
- }
+
+ device_set_state(dev, AUDIO_STATE_DISCONNECTED);
break;
case SINK_STATE_CONNECTING:
device_remove_avdtp_timer(dev);
- if (priv->hs_state == HEADSET_STATE_DISCONNECTED)
- device_set_state(dev, AUDIO_STATE_CONNECTING);
+ device_set_state(dev, AUDIO_STATE_CONNECTING);
break;
case SINK_STATE_CONNECTED:
if (old_state == SINK_STATE_PLAYING)
break;
- if (dev->auto_connect) {
- if (!dev->headset)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- else if (priv->hs_state == HEADSET_STATE_DISCONNECTED)
- device_set_headset_timer(dev);
- else if (priv->hs_state == HEADSET_STATE_CONNECTED ||
- priv->hs_state == HEADSET_STATE_PLAY_IN_PROGRESS ||
- priv->hs_state == HEADSET_STATE_PLAYING)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- } else if (priv->hs_state == HEADSET_STATE_DISCONNECTED ||
- priv->hs_state == HEADSET_STATE_CONNECTING)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
+ device_set_state(dev, AUDIO_STATE_CONNECTED);
break;
case SINK_STATE_PLAYING:
break;
@@ -447,62 +337,6 @@ static void device_avctp_cb(struct audio_device *dev,
}
}
-static void device_headset_cb(struct audio_device *dev,
- headset_state_t old_state,
- headset_state_t new_state,
- void *user_data)
-{
- struct dev_priv *priv = dev->priv;
-
- if (!dev->headset)
- return;
-
- priv->hs_state = new_state;
-
- switch (new_state) {
- case HEADSET_STATE_DISCONNECTED:
- device_remove_avdtp_timer(dev);
- if (priv->sink_state != SINK_STATE_DISCONNECTED && dev->sink &&
- (priv->dc_req || priv->disconnecting)) {
- sink_shutdown(dev->sink);
- break;
- }
- if (priv->sink_state == SINK_STATE_DISCONNECTED)
- device_set_state(dev, AUDIO_STATE_DISCONNECTED);
- else if (old_state == HEADSET_STATE_CONNECTING &&
- (priv->sink_state == SINK_STATE_CONNECTED ||
- priv->sink_state == SINK_STATE_PLAYING))
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- break;
- case HEADSET_STATE_CONNECTING:
- device_remove_headset_timer(dev);
- if (priv->sink_state == SINK_STATE_DISCONNECTED)
- device_set_state(dev, AUDIO_STATE_CONNECTING);
- break;
- case HEADSET_STATE_CONNECTED:
- if (old_state == HEADSET_STATE_CONNECTED ||
- old_state == HEADSET_STATE_PLAY_IN_PROGRESS ||
- old_state == HEADSET_STATE_PLAYING)
- break;
- if (dev->auto_connect) {
- if (!dev->sink)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- else if (priv->sink_state == SINK_STATE_DISCONNECTED)
- device_set_avdtp_timer(dev);
- else if (priv->sink_state == SINK_STATE_CONNECTED ||
- priv->sink_state == SINK_STATE_PLAYING)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- } else if (priv->sink_state == SINK_STATE_DISCONNECTED ||
- priv->sink_state == SINK_STATE_CONNECTING)
- device_set_state(dev, AUDIO_STATE_CONNECTED);
- break;
- case HEADSET_STATE_PLAY_IN_PROGRESS:
- break;
- case HEADSET_STATE_PLAYING:
- break;
- }
-}
-
static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -516,9 +350,6 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
dev->auto_connect = TRUE;
- if (dev->headset)
- headset_config_stream(dev, FALSE, NULL, NULL);
-
if (priv->state != AUDIO_STATE_CONNECTING && dev->sink) {
struct avdtp *session = avdtp_get(&dev->src, &dev->dst);
@@ -561,8 +392,6 @@ static DBusMessage *dev_disconnect(DBusConnection *conn, DBusMessage *msg,
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
sink_shutdown(dev->sink);
- else if (priv->hs_state != HEADSET_STATE_DISCONNECTED)
- headset_shutdown(dev);
else {
dbus_message_unref(priv->dc_req);
priv->dc_req = NULL;
@@ -652,10 +481,6 @@ struct audio_device *audio_device_register(struct btd_device *device,
if (avctp_callback_id == 0)
avctp_callback_id = avctp_add_state_cb(device_avctp_cb, NULL);
- if (headset_callback_id == 0)
- headset_callback_id = headset_add_state_cb(device_headset_cb,
- NULL);
-
return dev;
}
@@ -666,17 +491,12 @@ gboolean audio_device_is_active(struct audio_device *dev,
if ((dev->sink || dev->source) &&
avdtp_is_connected(&dev->src, &dev->dst))
return TRUE;
- if (dev->headset && headset_is_active(dev))
- return TRUE;
} else if (!strcmp(interface, AUDIO_SINK_INTERFACE) && dev->sink &&
avdtp_is_connected(&dev->src, &dev->dst))
return TRUE;
else if (!strcmp(interface, AUDIO_SOURCE_INTERFACE) && dev->source &&
avdtp_is_connected(&dev->src, &dev->dst))
return TRUE;
- else if (!strcmp(interface, AUDIO_HEADSET_INTERFACE) && dev->headset &&
- headset_is_active(dev))
- return TRUE;
else if (!strcmp(interface, AUDIO_CONTROL_INTERFACE) && dev->control &&
control_is_active(dev))
return TRUE;
@@ -694,9 +514,6 @@ void audio_device_unregister(struct audio_device *device)
device->hs_preauth_id = 0;
}
- if (device->headset)
- headset_unregister(device);
-
if (device->gateway)
gateway_unregister(device);
diff --git a/audio/headset.c b/audio/headset.c
index 5e42a61..fb660f5 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1614,9 +1614,6 @@ static int rfcomm_connect(struct audio_device *dev, headset_stream_cb_t cb,
char address[18];
GError *err = NULL;
- if (!manager_allow_headset_connection(dev))
- return -ECONNREFUSED;
-
if (hs->rfcomm_ch < 0)
return get_records(dev, cb, user_data, cb_id);
diff --git a/audio/main.c b/audio/main.c
index f7bb32a..a423b79 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -42,7 +42,6 @@
#include "plugin.h"
#include "log.h"
#include "device.h"
-#include "headset.h"
#include "manager.h"
#include "gateway.h"
@@ -89,36 +88,12 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
goto drop;
}
- device = manager_find_device(NULL, &src, &dst, AUDIO_HEADSET_INTERFACE,
- FALSE);
- if (!device)
- device = manager_find_device(NULL, &src, &dst,
+ device = manager_find_device(NULL, &src, &dst,
AUDIO_GATEWAY_INTERFACE,
FALSE);
-
if (!device)
goto drop;
- if (device->headset) {
- if (headset_get_state(device) < HEADSET_STATE_CONNECTED) {
- DBG("Refusing SCO from non-connected headset");
- goto gateway;
- }
-
- if (!headset_get_hfp_active(device)) {
- error("Refusing non-HFP SCO connect attempt from %s",
- addr);
- goto drop;
- }
-
- if (headset_connect_sco(device, chan) < 0)
- goto drop;
-
- headset_set_state(device, HEADSET_STATE_PLAYING);
- goto connect;
- }
-
-gateway:
if (device->gateway) {
if (!gateway_is_connected(device)) {
DBG("Refusing SCO from non-connected AG");
@@ -130,7 +105,6 @@ gateway:
} else
goto drop;
-connect:
sk = g_io_channel_unix_get_fd(chan);
fcntl(sk, F_SETFL, 0);
diff --git a/audio/manager.c b/audio/manager.c
index e949509..d151f16 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -61,7 +61,6 @@
#include "avdtp.h"
#include "media.h"
#include "a2dp.h"
-#include "headset.h"
#include "gateway.h"
#include "sink.h"
#include "source.h"
@@ -637,9 +636,7 @@ int audio_manager_init(GKeyFile *conf, gboolean *enable_sco)
list = g_key_file_get_string_list(config, "General", "Enable",
NULL, NULL);
for (i = 0; list && list[i] != NULL; i++) {
- if (g_str_equal(list[i], "Headset"))
- enabled.headset = TRUE;
- else if (g_str_equal(list[i], "Gateway"))
+ if (g_str_equal(list[i], "Gateway"))
enabled.gateway = TRUE;
else if (g_str_equal(list[i], "Sink"))
enabled.sink = TRUE;
@@ -653,9 +650,7 @@ int audio_manager_init(GKeyFile *conf, gboolean *enable_sco)
list = g_key_file_get_string_list(config, "General", "Disable",
NULL, NULL);
for (i = 0; list && list[i] != NULL; i++) {
- if (g_str_equal(list[i], "Headset"))
- enabled.headset = FALSE;
- else if (g_str_equal(list[i], "Gateway"))
+ if (g_str_equal(list[i], "Gateway"))
enabled.gateway = FALSE;
else if (g_str_equal(list[i], "Sink"))
enabled.sink = FALSE;
@@ -694,7 +689,7 @@ proceed:
btd_register_adapter_driver(&media_driver);
- *enable_sco = (enabled.gateway || enabled.headset);
+ *enable_sco = enabled.gateway;
return 0;
}
@@ -740,10 +735,6 @@ GSList *manager_find_devices(const char *path,
if ((dst && bacmp(dst, BDADDR_ANY)) && bacmp(&dev->dst, dst))
continue;
- if (interface && !strcmp(AUDIO_HEADSET_INTERFACE, interface)
- && !dev->headset)
- continue;
-
if (interface && !strcmp(AUDIO_GATEWAY_INTERFACE, interface)
&& !dev->gateway)
continue;
@@ -829,43 +820,10 @@ struct audio_device *manager_get_device(const bdaddr_t *src,
return dev;
}
-gboolean manager_allow_headset_connection(struct audio_device *device)
-{
- GSList *l;
- int connected = 0;
-
- for (l = devices; l != NULL; l = l->next) {
- struct audio_device *dev = l->data;
- struct headset *hs = dev->headset;
-
- if (dev == device)
- continue;
-
- if (device && bacmp(&dev->src, &device->src) != 0)
- continue;
-
- if (!hs)
- continue;
-
- if (headset_get_state(dev) > HEADSET_STATE_DISCONNECTED)
- connected++;
-
- if (connected >= max_connected_headsets)
- return FALSE;
- }
-
- return TRUE;
-}
-
void manager_set_fast_connectable(gboolean enable)
{
GSList *l;
- if (enable && !manager_allow_headset_connection(NULL)) {
- DBG("Refusing enabling fast connectable");
- return;
- }
-
for (l = adapters; l != NULL; l = l->next) {
struct audio_adapter *adapter = l->data;
diff --git a/audio/manager.h b/audio/manager.h
index 8fb208c..d3b5692 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -23,7 +23,6 @@
*/
struct enabled_interfaces {
- gboolean headset;
gboolean gateway;
gboolean sink;
gboolean source;
@@ -50,8 +49,6 @@ struct audio_device *manager_get_device(const bdaddr_t *src,
const bdaddr_t *dst,
gboolean create);
-gboolean manager_allow_headset_connection(struct audio_device *device);
-
/* TRUE to enable fast connectable and FALSE to disable fast connectable for all
* audio adapters. */
void manager_set_fast_connectable(gboolean enable);
diff --git a/audio/media.c b/audio/media.c
index cec938a..ea0b44e 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -46,7 +46,6 @@
#include "transport.h"
#include "a2dp.h"
#include "avrcp.h"
-#include "headset.h"
#include "gateway.h"
#include "manager.h"
@@ -141,9 +140,6 @@ static void media_endpoint_destroy(struct media_endpoint *endpoint)
{
DBG("sender=%s path=%s", endpoint->sender, endpoint->path);
- if (endpoint->hs_watch)
- headset_remove_state_cb(endpoint->hs_watch);
-
if (endpoint->ag_watch)
gateway_remove_state_cb(endpoint->ag_watch);
@@ -185,17 +181,6 @@ static void media_endpoint_exit(DBusConnection *connection, void *user_data)
media_endpoint_remove(endpoint);
}
-static void headset_setconf_cb(struct media_endpoint *endpoint, void *ret,
- int size, void *user_data)
-{
- struct audio_device *dev = user_data;
-
- if (ret != NULL)
- return;
-
- headset_shutdown(dev);
-}
-
static void clear_configuration(struct media_endpoint *endpoint,
struct media_transport *transport)
{
@@ -449,41 +434,6 @@ done:
media_endpoint_remove(endpoint);
}
-static void headset_state_changed(struct audio_device *dev,
- headset_state_t old_state,
- headset_state_t new_state,
- void *user_data)
-{
- struct media_endpoint *endpoint = user_data;
- struct media_transport *transport;
-
- DBG("");
-
- if (bacmp(&endpoint->adapter->src, &dev->src) != 0)
- return;
-
- switch (new_state) {
- case HEADSET_STATE_DISCONNECTED:
- transport = find_device_transport(endpoint, dev);
-
- if (transport != NULL) {
- DBG("Clear endpoint %p", endpoint);
- clear_configuration(endpoint, transport);
- }
- break;
- case HEADSET_STATE_CONNECTING:
- set_configuration(endpoint, dev, NULL, 0, headset_setconf_cb,
- dev, NULL);
- break;
- case HEADSET_STATE_CONNECTED:
- break;
- case HEADSET_STATE_PLAY_IN_PROGRESS:
- break;
- case HEADSET_STATE_PLAYING:
- break;
- }
-}
-
static const char *get_name(struct a2dp_sep *sep, void *user_data)
{
struct media_endpoint *endpoint = user_data;
@@ -671,28 +621,6 @@ static gboolean endpoint_init_a2dp_sink(struct media_endpoint *endpoint,
return TRUE;
}
-static gboolean endpoint_init_ag(struct media_endpoint *endpoint, int *err)
-{
- GSList *list;
- GSList *l;
-
- endpoint->hs_watch = headset_add_state_cb(headset_state_changed,
- endpoint);
- list = manager_find_devices(NULL, &endpoint->adapter->src, BDADDR_ANY,
- AUDIO_HEADSET_INTERFACE, TRUE);
-
- for (l = list; l != NULL; l = l->next) {
- struct audio_device *dev = l->data;
-
- set_configuration(endpoint, dev, NULL, 0,
- headset_setconf_cb, dev, NULL);
- }
-
- g_slist_free(list);
-
- return TRUE;
-}
-
static gboolean endpoint_init_hs(struct media_endpoint *endpoint, int *err)
{
GSList *list;
@@ -750,7 +678,7 @@ static struct media_endpoint *media_endpoint_create(struct media_adapter *adapte
delay_reporting, err);
else if (strcasecmp(uuid, HFP_AG_UUID) == 0 ||
strcasecmp(uuid, HSP_AG_UUID) == 0)
- succeeded = endpoint_init_ag(endpoint, err);
+ succeeded = TRUE;
else if (strcasecmp(uuid, HFP_HS_UUID) == 0 ||
strcasecmp(uuid, HSP_HS_UUID) == 0)
succeeded = endpoint_init_hs(endpoint, err);
diff --git a/audio/transport.c b/audio/transport.c
index 7ad7033..74562ea 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -44,7 +44,6 @@
#include "media.h"
#include "transport.h"
#include "a2dp.h"
-#include "headset.h"
#include "gateway.h"
#include "sink.h"
#include "source.h"
@@ -212,9 +211,6 @@ void media_transport_destroy(struct media_transport *transport)
{
char *path;
- if (transport->hs_watch)
- headset_remove_state_cb(transport->hs_watch);
-
if (transport->ag_watch)
gateway_remove_state_cb(transport->ag_watch);
@@ -465,116 +461,6 @@ static void cancel_a2dp(struct media_transport *transport, guint id)
a2dp_cancel(transport->device, id);
}
-static void headset_resume_complete(struct audio_device *dev, void *user_data)
-{
- struct media_owner *owner = user_data;
- struct media_request *req = owner->pending;
- struct media_transport *transport = owner->transport;
- int fd;
- uint16_t imtu, omtu;
- gboolean ret;
-
- req->id = 0;
-
- if (dev == NULL)
- goto fail;
-
- fd = headset_get_sco_fd(dev);
- if (fd < 0)
- goto fail;
-
- imtu = 48;
- omtu = 48;
-
- media_transport_set_fd(transport, fd, imtu, omtu);
-
- if ((owner->lock & TRANSPORT_LOCK_READ) == 0)
- imtu = 0;
-
- if ((owner->lock & TRANSPORT_LOCK_WRITE) == 0)
- omtu = 0;
-
- ret = g_dbus_send_reply(btd_get_dbus_connection(), req->msg,
- DBUS_TYPE_UNIX_FD, &fd,
- DBUS_TYPE_UINT16, &imtu,
- DBUS_TYPE_UINT16, &omtu,
- DBUS_TYPE_INVALID);
- if (ret == FALSE)
- goto fail;
-
- media_owner_remove(owner);
-
- transport_set_state(transport, TRANSPORT_STATE_ACTIVE);
-
- return;
-
-fail:
- media_transport_remove(transport, owner);
-}
-
-static guint resume_headset(struct media_transport *transport,
- struct media_owner *owner)
-{
- struct audio_device *device = transport->device;
-
- if (state_in_use(transport->state))
- goto done;
-
- if (headset_lock(device, HEADSET_LOCK_READ |
- HEADSET_LOCK_WRITE) == FALSE)
- return 0;
-
- if (transport->state == TRANSPORT_STATE_IDLE)
- transport_set_state(transport, TRANSPORT_STATE_REQUESTING);
-
-done:
- return headset_request_stream(device, headset_resume_complete,
- owner);
-}
-
-static void headset_suspend_complete(struct audio_device *dev, void *user_data)
-{
- struct media_owner *owner = user_data;
- struct media_transport *transport = owner->transport;
-
- /* Release always succeeds */
- if (owner->pending) {
- owner->pending->id = 0;
- media_request_reply(owner->pending, 0);
- media_owner_remove(owner);
- }
-
- headset_unlock(dev, HEADSET_LOCK_READ | HEADSET_LOCK_WRITE);
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
- media_transport_remove(transport, owner);
-}
-
-static guint suspend_headset(struct media_transport *transport,
- struct media_owner *owner)
-{
- struct audio_device *device = transport->device;
-
- if (!owner) {
- headset_state_t state = headset_get_state(device);
-
- headset_unlock(device, HEADSET_LOCK_READ | HEADSET_LOCK_WRITE);
-
- if (state == HEADSET_STATE_PLAYING)
- transport_set_state(transport, TRANSPORT_STATE_PENDING);
- else
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
-
- return 0;
- }
-
- return headset_suspend_stream(device, headset_suspend_complete, owner);
-}
-
-static void cancel_headset(struct media_transport *transport, guint id)
-{
- headset_cancel_stream(transport->device, id);
-}
-
static void gateway_resume_complete(struct audio_device *dev, GError *err,
void *user_data)
{
@@ -920,33 +806,6 @@ static int set_property_a2dp(struct media_transport *transport,
return -EINVAL;
}
-static int set_property_headset(struct media_transport *transport,
- const char *property,
- DBusMessageIter *value)
-{
- if (g_strcmp0(property, "NREC") == 0) {
- gboolean nrec;
-
- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
- return -EINVAL;
- dbus_message_iter_get_basic(value, &nrec);
-
- /* FIXME: set new nrec */
- return 0;
- } else if (g_strcmp0(property, "InbandRingtone") == 0) {
- gboolean inband;
-
- if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
- return -EINVAL;
- dbus_message_iter_get_basic(value, &inband);
-
- /* FIXME: set new inband */
- return 0;
- }
-
- return -EINVAL;
-}
-
static int set_property_gateway(struct media_transport *transport,
const char *property,
DBusMessageIter *value)
@@ -1012,22 +871,6 @@ static void get_properties_a2dp(struct media_transport *transport,
&a2dp->volume);
}
-static void get_properties_headset(struct media_transport *transport,
- DBusMessageIter *dict)
-{
- gboolean nrec, inband;
- const char *routing;
-
- nrec = headset_get_nrec(transport->device);
- dict_append_entry(dict, "NREC", DBUS_TYPE_BOOLEAN, &nrec);
-
- inband = headset_get_inband(transport->device);
- dict_append_entry(dict, "InbandRingtone", DBUS_TYPE_BOOLEAN, &inband);
-
- routing = headset_get_sco_hci(transport->device) ? "HCI" : "PCM";
- dict_append_entry(dict, "Routing", DBUS_TYPE_STRING, &routing);
-}
-
static void get_properties_gateway(struct media_transport *transport,
DBusMessageIter *dict)
{
@@ -1123,16 +966,6 @@ static void destroy_a2dp(void *data)
g_free(a2dp);
}
-static void destroy_headset(void *data)
-{
- struct headset_transport *headset = data;
-
- if (headset->nrec_id > 0)
- headset_remove_nrec_cb(headset->device, headset->nrec_id);
-
- g_free(headset);
-}
-
static void media_transport_free(void *data)
{
struct media_transport *transport = data;
@@ -1154,18 +987,6 @@ static void media_transport_free(void *data)
g_free(transport);
}
-static void headset_nrec_changed(struct audio_device *dev, gboolean nrec,
- void *user_data)
-{
- struct media_transport *transport = user_data;
-
- DBG("");
-
- emit_property_changed(transport->path,
- MEDIA_TRANSPORT_INTERFACE, "NREC",
- DBUS_TYPE_BOOLEAN, &nrec);
-}
-
static void transport_update_playing(struct media_transport *transport,
gboolean playing)
{
@@ -1188,22 +1009,6 @@ static void transport_update_playing(struct media_transport *transport,
transport_set_state(transport, TRANSPORT_STATE_PENDING);
}
-static void headset_state_changed(struct audio_device *dev,
- headset_state_t old_state,
- headset_state_t new_state,
- void *user_data)
-{
- struct media_transport *transport = user_data;
-
- if (dev != transport->device)
- return;
-
- if (new_state == HEADSET_STATE_PLAYING)
- transport_update_playing(transport, TRUE);
- else
- transport_update_playing(transport, FALSE);
-}
-
static void gateway_state_changed(struct audio_device *dev,
gateway_state_t old_state,
gateway_state_t new_state,
@@ -1295,26 +1100,6 @@ struct media_transport *media_transport_create(struct media_endpoint *endpoint,
transport->source_watch = source_add_state_cb(
source_state_changed,
transport);
- } else if (strcasecmp(uuid, HFP_AG_UUID) == 0 ||
- strcasecmp(uuid, HSP_AG_UUID) == 0) {
- struct headset_transport *headset;
-
- headset = g_new0(struct headset_transport, 1);
- headset->device = device;
- headset->nrec_id = headset_add_nrec_cb(device,
- headset_nrec_changed,
- transport);
-
- transport->resume = resume_headset;
- transport->suspend = suspend_headset;
- transport->cancel = cancel_headset;
- transport->get_properties = get_properties_headset;
- transport->set_property = set_property_headset;
- transport->data = headset;
- transport->destroy = destroy_headset;
- transport->hs_watch = headset_add_state_cb(
- headset_state_changed,
- transport);
} else if (strcasecmp(uuid, HFP_HS_UUID) == 0 ||
strcasecmp(uuid, HSP_HS_UUID) == 0) {
transport->resume = resume_gateway;
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 3/3] network: Fix dead assignment in connect_cb
From: Luiz Augusto von Dentz @ 2012-11-13 13:21 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1352812880-7306-1-git-send-email-luiz.dentz@gmail.com>
From: Szymon Janc <szymon.janc@tieto.com>
Value stored to err_msg is never read in case err was not NULL.
Simply remove err_msg and pass strerror() directly where it is used.
---
profiles/network/connection.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index abcbee8..1a1fb4d 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -371,19 +371,16 @@ static int bnep_connect(struct network_conn *nc)
static void connect_cb(GIOChannel *chan, GError *err, gpointer data)
{
struct network_conn *nc = data;
- const char *err_msg;
int perr;
if (err) {
error("%s", err->message);
- err_msg = err->message;
goto failed;
}
perr = bnep_connect(nc);
if (perr < 0) {
- err_msg = strerror(-perr);
- error("bnep connect(): %s (%d)", err_msg, -perr);
+ error("bnep connect(): %s (%d)", strerror(-perr), -perr);
goto failed;
}
--
1.7.11.7
^ 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