All of lore.kernel.org
 help / color / mirror / Atom feed
* BLE Advertise and Scan at the same time?
@ 2015-06-22 10:13 dogan yazar
  2015-06-22 10:22 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: dogan yazar @ 2015-06-22 10:13 UTC (permalink / raw)
  To: linux-bluetooth

Is it possible to advertise (leadv) and scan (scan on) using the same
ble adaper?
The moment that I enable scanning (scan on) with bluetoothctl, leadv
is disabled.

The reason I want is to have a GATT client and server at the same time.
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BLE Advertise and Scan at the same time?
  2015-06-22 10:13 BLE Advertise and Scan at the same time? dogan yazar
@ 2015-06-22 10:22 ` Marcel Holtmann
  2015-06-22 12:49   ` dogan yazar
  2015-06-22 12:51   ` dogan yazar
  0 siblings, 2 replies; 5+ messages in thread
From: Marcel Holtmann @ 2015-06-22 10:22 UTC (permalink / raw)
  To: dogan yazar; +Cc: linux-bluetooth

Hi Dogan,

> Is it possible to advertise (leadv) and scan (scan on) using the same
> ble adaper?
> The moment that I enable scanning (scan on) with bluetoothctl, leadv
> is disabled.

that depends on the Bluetooth chip you are using. Inside the kernel we currently play it safe and disable one when we start the other. It will be however re-enabled when the scan finished. You need to use btmgmt and not hcitool. Using hcitool messes with raw HCI packets. The kernel logic will always overwrite these as it sees fit.

To allow simultaneous states, someone would have to work on that and figure out which chips support what. Once that is done, there is no problem in lifting some of the restrictions we imposed.

> The reason I want is to have a GATT client and server at the same time.

Actually that has never been a problem. You can have a GATT client and server at the same time and most likely you do already anyway. The question you are asking is if you can be in central and peripheral role at the same time.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BLE Advertise and Scan at the same time?
  2015-06-22 10:22 ` Marcel Holtmann
@ 2015-06-22 12:49   ` dogan yazar
  2015-06-22 12:51   ` dogan yazar
  1 sibling, 0 replies; 5+ messages in thread
From: dogan yazar @ 2015-06-22 12:49 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]

Thanks for the answer. I tried this by enabling advertisement (hciconfig
hci0 leadv) and then "btmgmt find" but then hci adapter got into some weird
state. Was not possible to disable scanning anymore. Same problem when I
did bluetoothctl scan on. Probably my chip does not support it.

I also tried "btmgmt advertising on" rather than hciconfig leadv but it did
not do anything at all. Is "hciconfig hci0 leadv" only way to enable
advertising until we move to kernel 4.1 and do it via DBUS api?

And lastly, still I seem to need hcitool to be able to set the
advertisement data otherwise android ble clients refuse to connect (they
think it is a classic bluetooth I think). It is no longer a issue after I
set GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED via hcitool cmd
i.e. hcitool -i hci0 cmd 0x08 0x0008 3 02 01 05

On Mon, Jun 22, 2015 at 12:22 PM Marcel Holtmann <marcel@holtmann.org>
wrote:

> Hi Dogan,
>
> > Is it possible to advertise (leadv) and scan (scan on) using the same
> > ble adaper?
> > The moment that I enable scanning (scan on) with bluetoothctl, leadv
> > is disabled.
>
> that depends on the Bluetooth chip you are using. Inside the kernel we
> currently play it safe and disable one when we start the other. It will be
> however re-enabled when the scan finished. You need to use btmgmt and not
> hcitool. Using hcitool messes with raw HCI packets. The kernel logic will
> always overwrite these as it sees fit.
>
> To allow simultaneous states, someone would have to work on that and
> figure out which chips support what. Once that is done, there is no problem
> in lifting some of the restrictions we imposed.
>
> > The reason I want is to have a GATT client and server at the same time.
>
> Actually that has never been a problem. You can have a GATT client and
> server at the same time and most likely you do already anyway. The question
> you are asking is if you can be in central and peripheral role at the same
> time.
>
> Regards
>
> Marcel
>
>

[-- Attachment #2: Type: text/html, Size: 2379 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BLE Advertise and Scan at the same time?
  2015-06-22 10:22 ` Marcel Holtmann
  2015-06-22 12:49   ` dogan yazar
@ 2015-06-22 12:51   ` dogan yazar
  1 sibling, 0 replies; 5+ messages in thread
From: dogan yazar @ 2015-06-22 12:51 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Thanks for the answer Marcel. I tried this by enabling advertisement
(hciconfig hci0 leadv) and then "btmgmt find" but then hci adapter got
into some weird state. Was not possible to disable scanning anymore.
Same problem when I did bluetoothctl scan on. Probably my chip does
not support it.

I also tried "btmgmt advertising on" rather than hciconfig leadv but
it did not do anything at all. Is "hciconfig hci0 leadv" only way to
enable advertising until we move to kernel 4.1 and do it via DBUS api?

And lastly, still I seem to need hcitool to be able to set the
advertisement data otherwise android ble clients refuse to connect
(they think it is a classic bluetooth I think). It is no longer a
issue after I set GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED via hcitool cmd
i.e. hcitool -i hci0 cmd 0x08 0x0008 3 02 01 05

On Mon, Jun 22, 2015 at 12:22 PM, Marcel Holtmann <marcel@holtmann.org> wro=
te:
> Hi Dogan,
>
>> Is it possible to advertise (leadv) and scan (scan on) using the same
>> ble adaper?
>> The moment that I enable scanning (scan on) with bluetoothctl, leadv
>> is disabled.
>
> that depends on the Bluetooth chip you are using. Inside the kernel we cu=
rrently play it safe and disable one when we start the other. It will be ho=
wever re-enabled when the scan finished. You need to use btmgmt and not hci=
tool. Using hcitool messes with raw HCI packets. The kernel logic will alwa=
ys overwrite these as it sees fit.
>
> To allow simultaneous states, someone would have to work on that and figu=
re out which chips support what. Once that is done, there is no problem in =
lifting some of the restrictions we imposed.
>
>> The reason I want is to have a GATT client and server at the same time.
>
> Actually that has never been a problem. You can have a GATT client and se=
rver at the same time and most likely you do already anyway. The question y=
ou are asking is if you can be in central and peripheral role at the same t=
ime.
>
> Regards
>
> Marcel
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BLE Advertise and Scan at the same time?
@ 2015-08-31  6:51 Arun K. Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Arun K. Singh @ 2015-08-31  6:51 UTC (permalink / raw)
  To: linux-bluetooth

Hi Marcel,

>> Is it possible to advertise (leadv) and scan (scan on) using the same
>> ble adaper?
>> The moment that I enable scanning (scan on) with bluetoothctl, leadv
>> is disabled.

>that depends on the Bluetooth chip you are using. Inside the kernel we currently play it safe and >disable one when we start the other. It will be however re-enabled when the scan finished. You >need to use btmgmt and not hcitool. Using hcitool messes with raw HCI packets. The kernel logic >will always overwrite these as it sees fit.

>To allow simultaneous states, someone would have to work on that and figure out which chips >support what. Once that is done, there is no problem in lifting some of the restrictions we imposed.

May I know what these restrictions are? I have a CSR8510 based USB
dongle which seems to support simultaneous BLE scan/adv. My only
problem would be to get rid of these restrictions in kernel to achieve
a simultaneous BLE adv/scan operation.

Thanks,
-Arun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-31  6:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 10:13 BLE Advertise and Scan at the same time? dogan yazar
2015-06-22 10:22 ` Marcel Holtmann
2015-06-22 12:49   ` dogan yazar
2015-06-22 12:51   ` dogan yazar
2015-08-31  6:51 Arun K. Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.