All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Help understanding BLE Advertising and Scan Response packets...
@ 2021-05-12  1:35 Patrick Doyle
  0 siblings, 0 replies; only message in thread
From: Patrick Doyle @ 2021-05-12  1:35 UTC (permalink / raw)
  To: linux-bluetooth

I'm confused by how Bluez assigns data the to BLE and Scan Response
packets.  In src/advertising.c, in the refresh_legacy_adv() function,
I see the following:


adv_data = generate_adv_data(client, &flags, &adv_data_len);
..
scan_rsp = generate_scan_rsp(client, &flags, &scan_rsp_len);

Looking in generate_adv_data() and generate_scan_rsp(), I see that
they both end with:

return bt_ad_generate(client->data, len);

So, then I look at bt_ad_generate() in src/shared/ad.c and I see code
much like the following:

serialize_service_uuids(ad->service_uuids, adv_data, &pos);
serialize_solicit_uuids(ad->solicit_uuids, adv_data, &pos);
serialize_manuf_data(ad->manufacturer_data, adv_data, &pos);
serialize_service_data(ad->service_data, adv_data, &pos);
serialize_name(ad->name, adv_data, &pos);
serialize_appearance(ad->appearance, adv_data, &pos);
serialize_data(ad->data, adv_data, &pos);

return adv_data;

From inspecting the code, it seems to me that Bluez stuffs the same
data in both the advertising_data packet, and in the scan_repsonse
packet.  This is especially confusing to me because, examining the
packets on the air with a BLE sniffer, that is NOT what I see... but I
can't figure why not.

On a somewhat related note, I have constructed my D-Bus object with
its org.bluez.LEAdvertisement1 interface to specify the data I want in
my BLE peripheral advertising packet, and I overflowed the size of the
advertising_data packet.  I would like to figure out how to indicate
to Bluez that I would like the "service_data" portion of my
advertisement to go into the scan_response packet instead of the
advertising_data packet.  Any tips on how to do that?

Thanks

--wpd

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-12  1:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  1:35 Help understanding BLE Advertising and Scan Response packets Patrick Doyle

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.