2020-12-25 04:31:16

by Ordit Gross

[permalink] [raw]
Subject: getting address type from scan result

hi,

Up till now the peripheral device we worked against was configured
with public address,
now it might also be random (both BDADDR_LE_RANDOM, BDADDR_LE_PUBLIC).
The type of address is needed to connect correctly to the device
(using l2cap_connect).

How can I get the address type from the scan report?
I'm currently using bluetoothctl, which seems not to expose this
information in Device1 interface.
thanks in advance! and happy holidays

--


2020-12-28 12:27:01

by Ordit Gross

[permalink] [raw]
Subject: Re: getting address type from scan result

just to clarify, the needed information is:
> HCI Event: LE Meta Event (0x3e) plen 37 #324 [hci0] 1064.855314
LE Advertising Report (0x02)
Num reports: 1
Event type: Connectable undirected - ADV_IND (0x00)
Address type: Random (0x01)
Address: 5B:6C:86:BE:2C:40 (Resolvable)

the only way I could think of is by opening an hci socket.. is there
any other way?
thanks for your help!


On Fri, Dec 25, 2020 at 6:28 AM Ordit Gross <[email protected]> wrote:
>
> hi,
>
> Up till now the peripheral device we worked against was configured
> with public address,
> now it might also be random (both BDADDR_LE_RANDOM, BDADDR_LE_PUBLIC).
> The type of address is needed to connect correctly to the device
> (using l2cap_connect).
>
> How can I get the address type from the scan report?
> I'm currently using bluetoothctl, which seems not to expose this
> information in Device1 interface.
> thanks in advance! and happy holidays
>
> --



--

2020-12-28 12:34:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: getting address type from scan result

Hi Ordit,

> Up till now the peripheral device we worked against was configured
> with public address,
> now it might also be random (both BDADDR_LE_RANDOM, BDADDR_LE_PUBLIC).
> The type of address is needed to connect correctly to the device
> (using l2cap_connect).
>
> How can I get the address type from the scan report?
> I'm currently using bluetoothctl, which seems not to expose this
> information in Device1 interface.
> thanks in advance! and happy holidays

it is in the Device1 interface for the Identity Address. Why are you going to connect an L2CAP socket in the first place for a LE device.

Regards

Marcel

2020-12-29 01:24:36

by Ordit Gross

[permalink] [raw]
Subject: Re: getting address type from scan result

hi Marcel, appreciate your answer, I am using code sample
btgatt-client.c which uses function:
static int l2cap_le_att_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t
dst_type, int sec)
is there a way to implement connect without stating the dst_type?
thanks again


> On Mon, Dec 28, 2020 at 2:33 PM Marcel Holtmann <[email protected]> wrote:
>>
>> Hi Ordit,
>>
>> > Up till now the peripheral device we worked against was configured
>> > with public address,
>> > now it might also be random (both BDADDR_LE_RANDOM, BDADDR_LE_PUBLIC).
>> > The type of address is needed to connect correctly to the device
>> > (using l2cap_connect).
>> >
>> > How can I get the address type from the scan report?
>> > I'm currently using bluetoothctl, which seems not to expose this
>> > information in Device1 interface.
>> > thanks in advance! and happy holidays
>>
>> it is in the Device1 interface for the Identity Address. Why are you going to connect an L2CAP socket in the first place for a LE device.
>>
>> Regards
>>
>> Marcel
>>
>
>
> --
>


--