[pulseaudio-discuss] [PATCH 5/5] bluetooth: Set device_info_valid to -1 when the device's adapter disappears
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Sun Nov 17 08:56:38 PST 2013
On Sun, 2013-11-17 at 18:05 +0200, Luiz Augusto von Dentz wrote:
> Hi Tanu,
>
> On Fri, Nov 15, 2013 at 4:29 PM, Tanu Kaskinen
> <tanu.kaskinen at linux.intel.com> wrote:
> > When parsing device properties, missing adapter will result in
> > device_info_valid being set to -1. It is then logical that if the
> > adapter goes missing at a later point, device_info_valid gets set to
> > -1 also in that situation.
> > ---
> > src/modules/bluetooth/bluez5-util.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
> > index 73e65d1..c8ff219 100644
> > --- a/src/modules/bluetooth/bluez5-util.c
> > +++ b/src/modules/bluetooth/bluez5-util.c
> > @@ -477,8 +477,10 @@ static void adapter_free(pa_bluetooth_adapter *a) {
> > pa_assert(a->discovery);
> >
> > PA_HASHMAP_FOREACH(d, a->discovery->devices, state)
> > - if (d->adapter == a)
> > + if (d->adapter == a) {
> > + set_device_info_valid(d, -1);
> > d->adapter = NULL;
> > + }
> >
> > pa_xfree(a->path);
> > pa_xfree(a->address);
> > --
> > 1.8.3.1
>
> Is this some bug in BlueZ Im not aware of? There is an Adapter
> property that should always be present, if the adapter goes away we
> should probably cleanup its devices as their are no use without the
> adapter. Note the adapter will only disappear if it is really
> unplugged, if the adapter is just powered down it will continue to be
> present, so Im not really sure what is benefit of having a invalid
> devices around.
No, this is not a fix for any particular real-world problem that I'm
having. I'm just making the code consistent with regard to missing
adapter handling.
I guess by "we should probably cleanup its devices" you mean that we
should remove devices that belong to the removed adapter. I disagree. We
should keep in sync with the state of BlueZ. If BlueZ removes the
devices when the adapter is removed, then PA will remove the device too
when it gets the InterfacesRemoved signal for the devices. If BlueZ
keeps the devices around, PA should keep them around too.
--
Tanu
More information about the pulseaudio-discuss
mailing list