Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 5/6] Bluetooth: mgmt: Add support for switching to LE peripheral mode
Date: Thu, 25 Oct 2012 01:36:35 +0300	[thread overview]
Message-ID: <20121024223635.GA11976@x220.P-661HNU-F1> (raw)
In-Reply-To: <20121024221341.GA22764@samus>

Hi Vinicius,

On Wed, Oct 24, 2012, Vinicius Costa Gomes wrote:
> On 00:09 Thu 25 Oct, Johan Hedberg wrote:
> > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> > index dc60d31..ed6b1e2 100644
> > --- a/net/bluetooth/hci_event.c
> > +++ b/net/bluetooth/hci_event.c
> > @@ -790,9 +790,24 @@ static void hci_set_le_support(struct hci_dev *hdev)
> >  		cp.simul = !!lmp_le_br_capable(hdev);
> >  	}
> >  
> > +	/* If the host features don't reflect the desired state for LE
> > +	 * then send the write_le_host_supported command. The command
> > +	 * complete handler for it will take care of any necessary
> > +	 * subsequent commands like set_adv_enable.
> > +	 *
> > +	 * If the host features for LE are already correct and
> > +	 * peripheral mode is enabled directly send the le_set_adv
> > +	 * command. The value of &cp.le is used so that advertising will
> > +	 * not be enabled in the exceptional case that LE for some
> > +	 * reason isn't enabled - something that should only be possible
> > +	 * if someone is doing direct raw access to HCI.
> > +	 */
> >  	if (cp.le != !!lmp_host_le_capable(hdev))
> >  		hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp),
> >  			     &cp);
> > +	else if (test_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags))
> > +		hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(cp.le),
> > +			     &cp.le);
> >  }
> 
> I agree with Marcel, and one point that worried me was this
> unconditional advertising, I feel that we should be smarter about when
> to start advertising, for example, here we are not taking into account
> the user's visiblity settings.

If you're a peripheral and you're not connectable/discoverable then what
good does it do to have Bluetooth enabled at all? Since a peripheral
can't scan or initiate connections you can't really do anything. So if a
higher layer doesn't want us advertising it could either set LE to off
or central role or even power off the adapter completely.

Johan

  reply	other threads:[~2012-10-24 22:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24 21:09 [PATCH 0/6] Bluetooth: Some fixes and full peripheral role support Johan Hedberg
2012-10-24 21:09 ` [PATCH 1/6] Bluetooth: Fix setting host feature bits for SSP Johan Hedberg
2012-10-24 21:45   ` Marcel Holtmann
2012-10-24 21:09 ` [PATCH 2/6] Bluetooth: Fix sending unnecessary HCI_Write_SSP_Mode command Johan Hedberg
2012-10-24 21:48   ` Marcel Holtmann
2012-10-24 21:09 ` [PATCH 3/6] Bluetooth: Fix sending unnecessary HCI_LE_Host_Enable Johan Hedberg
2012-10-24 21:48   ` Marcel Holtmann
2012-10-25 15:05   ` Gustavo Padovan
2012-10-25 15:07     ` Marcel Holtmann
2012-10-25 15:14       ` Johan Hedberg
2012-10-25 15:20         ` Gustavo Padovan
2012-10-24 21:09 ` [PATCH 4/6] Bluetooth: Fix unnecessary EIR update during powering on Johan Hedberg
2012-10-24 21:49   ` Marcel Holtmann
2012-10-25 15:08   ` Gustavo Padovan
2012-10-24 21:09 ` [PATCH 5/6] Bluetooth: mgmt: Add support for switching to LE peripheral mode Johan Hedberg
2012-10-24 22:13   ` Vinicius Costa Gomes
2012-10-24 22:36     ` Johan Hedberg [this message]
2012-10-25  0:58       ` Vinicius Costa Gomes
2012-10-25  1:54         ` Marcel Holtmann
2012-10-25  4:56           ` Vinicius Costa Gomes
2012-10-25  7:50             ` Johan Hedberg
2012-10-25 10:41               ` Anderson Lizardo
2012-10-25 11:48                 ` Johan Hedberg
2012-10-25 12:04                   ` Johan Hedberg
2012-10-25 14:31                     ` Vinicius Costa Gomes
2012-10-25 15:07                       ` Johan Hedberg
2012-10-25 18:48                         ` Vinicius Costa Gomes
2012-10-24 21:09 ` [PATCH 6/6] Bluetooth: Add support for setting LE advertising data Johan Hedberg
2012-10-24 21:53 ` [PATCH 0/6] Bluetooth: Some fixes and full peripheral role support Marcel Holtmann

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=20121024223635.GA11976@x220.P-661HNU-F1 \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.org \
    /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