linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v3 6/6] a2dp: Reword LastUsed
Date: Fri, 7 Jun 2019 15:04:34 +0200	[thread overview]
Message-ID: <20190607130434.lw5vfapnkflp65cq@pali> (raw)
In-Reply-To: <20190507185740.ywubjwgm7mer7txf@pali>

On Tuesday 07 May 2019 20:57:40 Pali Rohár wrote:
> On Tuesday 07 May 2019 13:13:17 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> > 
> > On Tue, May 7, 2019 at 11:52 AM Pali Rohár <pali.rohar@gmail.com> wrote:
> > >
> > > On Monday 06 May 2019 15:02:25 Pali Rohár wrote:
> > > > On Monday 06 May 2019 15:46:03 Luiz Augusto von Dentz wrote:
> > > > > Hi Pali,
> > > > >
> > > > > I hope this fixes the problems you have been seeing, it should at
> > > > > least take care of the issues with wrong order of SelectConfiguration
> > > > > and restoring the exact same endpoint used last time.
> > > >
> > > > Hi Luiz! Great, this should make bluez to be more deterministic.
> > >
> > > Hi! Now I looked at it and in cache file I see:
> > >
> > > LastUsed=04:01
> > >
> > > What would happen when A2DP application (e.g. pulseaudio) register DBus
> > > endpoints in different order? Or e.g. do not register some endpoints due
> > > to missing codec librayr (aptX).
> > >
> > > I guess that in this case LastUsed information stops working...
> > 
> > It would most likely fail at SelectConfiguration and then try with the
> > other endpoints.
> 
> Yes, that is truth. My point is just about validity of LastUsed value.
> 
> > >
> > > Should not be there stored rather dbus endpoint name identifier?
> > 
> > Originally I tried to avoid having the local endpoints because of this
> > problem, but now that SelectConfiguration can fail it shouldn't really
> > be a problem. At least with the seid if you have a system that didn't
> > changed the order or number of endpoints it will keep working as
> > expected,
> 
> But this may happen. And such thing is allowed. Any application,
> including unprivileged can register own new endpoint to bluez. It is not
> specific to pulseaudio. And in my opinion central bluetooth daemon which
> expose such functionality should be robust and be prepared that
> application on "other side of dbus IPC" does not have to be well
> behaved.
> 
> > if we choose to encode the D-Bus connection, etc, as soon as
> > PA is restarted, the system is rebooted, etc, the D-Bus connection may
> > have changed making the stored values in LastUsed invalid.
> 
> That is truth.
> 
> My idea was to encode just dbus path of local dbus endpoint. We can say
> (in IPC API) that client application should preserve dbus path for one
> same endpoint between dbus daemon / computer restarts. Because otherwise
> functionality of "choose last used endpoint" would not work.
> 
> This is less strict requirement and current one (that registration order
> of all existing applications in system must be same across reboots),
> less error prone and still should be easily implemented.

So what about this my idea? Is there anything wrong with such thing?

> > Anyway
> > chances are the LastUsed is only invalidated if you update PA, in
> 
> Or once we include support for dynamic codec loading (based on encoder
> library presence in system), installation of any irrelevant application
> may bring a new supported codec and therefore a new endpoint. So codecs
> can become in any order...
> 
> Or another example, when different application (not PA) register also
> some endpoint.
> 
> > which case there could be new endpoints or a change in their order and
> > package can also provide a script to clear the LastUsed if that
> > happens, but then again LastUsed setting does not actually store the
> > configuration just the endpoint so SelectConfiguration has control
> > over the configuration.
> 
> Yes, whole thing is only about initial codec selection. In the worst
> case user would have pre-selected different codec as which was last
> used.
> 
> But I think that storing dbus path of endpoint as described above should
> be more reliable solution.
> 
> Applications (e.g. PA) talking to bluetooth daemon does not register or
> request directly SEID. Instead they register their dbus path and dbus
> connection and bluetooth daemon later allocates SEID for that path.
> 

-- 
Pali Rohár
pali.rohar@gmail.com

  reply	other threads:[~2019-06-07 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 12:43 [PATCH v3 1/6] a2dp: Fix crash when endpoint respond with an error Luiz Augusto von Dentz
2019-05-06 12:43 ` [PATCH v3 2/6] a2dp: Try aborting when switching endpoints Luiz Augusto von Dentz
2019-05-06 12:43 ` [PATCH v3 3/6] a2dp: Update last used on open indication Luiz Augusto von Dentz
2019-05-06 12:43 ` [PATCH v3 4/6] a2dp: Fix reconfiguring when there multiple devices connected Luiz Augusto von Dentz
2019-05-06 12:43 ` [PATCH v3 5/6] a2dp: Fix useless statement Luiz Augusto von Dentz
2019-05-06 12:43 ` [PATCH v3 6/6] a2dp: Reword LastUsed Luiz Augusto von Dentz
2019-05-06 12:46   ` Luiz Augusto von Dentz
2019-05-06 13:02     ` Pali Rohár
2019-05-07  8:52       ` Pali Rohár
2019-05-07 10:13         ` Luiz Augusto von Dentz
2019-05-07 18:57           ` Pali Rohár
2019-06-07 13:04             ` Pali Rohár [this message]
2019-06-07 15:18               ` Luiz Augusto von Dentz
2019-06-10 12:35                 ` Pali Rohár
2019-06-10 13:02                   ` Luiz Augusto von Dentz
2019-05-07 10:17 ` [PATCH v3 1/6] a2dp: Fix crash when endpoint respond with an error Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607130434.lw5vfapnkflp65cq@pali \
    --to=pali.rohar@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).