Re: [PATCH] Fix managing dbus filters depending on BT state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 22, 2010 at 8:12 PM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> Hi,
>
> On Mon, Nov 22, 2010 at 4:33 PM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
>> Hi Bartosz,
>>
>> On Mon, Nov 22, 2010, Bartosz Szatkowski wrote:
>>> Previously even if BT was disabled, bluetoothd would handle some dbus
>>> singals (mostly connected with HFP). Now filters are added when
>>> BT is enabled and removed when BT is disabled.
>>> ---
>>> Âaudio/manager.c     Â|  Â4 ++--
>>> Âaudio/telephony-dummy.c Â| Â 10 ++++++++++
>>> Âaudio/telephony-maemo5.c | Â 10 ++++++++++
>>> Âaudio/telephony-maemo6.c | Â 10 ++++++++++
>>> Âaudio/telephony-ofono.c Â| Â 10 ++++++++++
>>> Âaudio/telephony.h    Â|  Â1 +
>>> Âsrc/adapter.c      Â|  Â5 +++++
>>> Â7 files changed, 48 insertions(+), 2 deletions(-)
>>
>> Nack on this one. I understand the issue you're trying to fix but it
>> needs to be done differently.
>>
>>> diff --git a/audio/manager.c b/audio/manager.c
>>> index 816c807..2fc7bf1 100644
>>> --- a/audio/manager.c
>>> +++ b/audio/manager.c
>>> @@ -1178,7 +1178,7 @@ proceed:
>>> Â Â Â Â Â Â Â btd_register_adapter_driver(&media_server_driver);
>>>
>>> Â Â Â if (enabled.headset) {
>>> - Â Â Â Â Â Â telephony_init();
>>> + Â Â Â Â Â Â telephony_set_state(1);
>>> Â Â Â Â Â Â Â btd_register_adapter_driver(&headset_server_driver);
>>> Â Â Â }
>>
>> If you're gonna call this "state" you should have proper defines or
>> enums for the values, however in this case it's essentially a boolean so
>> that's not necessary. In fact since it's a boolean you don't even need
>> to have any new function or variable at all for it: just use
>> telephony_init and telephony_exit.
>>
>>> --- a/src/adapter.c
>>> +++ b/src/adapter.c
>>> @@ -57,6 +57,7 @@
>>> Â#include "glib-helper.h"
>>> Â#include "agent.h"
>>> Â#include "storage.h"
>>> +#include "../audio/telephony.h"
>>>
>>> Â#define IO_CAPABILITY_DISPLAYONLY Â Â0x00
>>> Â#define IO_CAPABILITY_DISPLAYYESNO Â 0x01
>>> @@ -2404,6 +2405,8 @@ int adapter_start(struct btd_adapter *adapter)
>>>
>>> Â Â Â err = adapter_up(adapter, mode);
>>>
>>> + Â Â telephony_init();
>>> +
>>
>> This is just wrong. The core daemon should never have direct access to
>> the telephony driver. Instead, you should have the audio plugin
>> (probably audio/manager.c or audio/headset.c) register a adapter powered
>> callback and then call telehony_init/exit from that callback.
>
> I have an almost working version of this using adapter drivers and
> powered changes via callback registration, the tricky part here is how
> to detect when to do headset_init/headset_exit since those should be
> called only once. I didn't know there somebody working on this but
> anyway I gonna try to finish this asap.
>
> --
> Luiz Augusto von Dentz
> Computer Engineer
>

Hi Luiz,
please fell free to send it (no hard fillings :) ) Ive just getting to
know bluez so probably it would take me a while to get through whole
plugin/callback subsystem.

-- 
Pozdrowienia,
Bartosz Szatkowski
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux