Re: bluez: Disable GATT client at non-initiator side?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



вт, 19 мар. 2019 г. в 23:22, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx>:
>
> Hi Yauhen,
>
> On Tue, Mar 19, 2019 at 5:07 PM Yauhen Kharuzhy <jekhor@xxxxxxxxx> wrote:
> >
> > Hello,
> >
> > I am trying to implement GATT services with bluez API.
> >
> > If external device initiated LE connection to device with bluez
> > running, bluez start to discover services at initiator and, if one of
> > characteristics required pairing, request pairing. This is not
> > intended behaviour for some reason in my case, so I need to disable
> > GATT client if bluez is not initiator side of the connection, similar
> > to ReverseServiceDiscovery config option for non-LE.
> >
> > Is it possible by any way? As i see code, device_attach_att() function
> > in src/device.c initializes GATT client unconditionally in both cases.
> > For debug, I disabled client initializing and this seems works for
> > external-initiated connections.
>
> We could perhaps reuse the same logic to disable the GATT service
> discovery, though the should not cause any pairing request since the
> discovery don't actually read any value, apart from characteristic
> declaration which shall not require authentication.

Yes, problem really in BATT profile accept stage:

164    16.407237    localhost (jeknotez)    5c:ca:67:f8:3b:11 ()
ATT    12    Sent Read Request, Handle: 0x0016 (Battery Service:
Battery Level)
166    16.466794    5c:ca:67:f8:3b:11 ()    localhost (jeknotez)
ATT    14    Rcvd Error Response - Insufficient Encryption, Handle:
0x0016 (Battery Service: Battery Level)
167    16.467125    localhost (jeknotez)    5c:ca:67:f8:3b:11 ()
SMP    11    Sent Security Request: AuthReq: Bonding,
SecureConnection, Reserved

сак 20 13:53:42 jeknotez bluetoothd[4945]:
profiles/battery/battery.c:batt_probe() BATT profile probe
(74:E0:C9:69:D2:8C)
сак 20 13:53:42 jeknotez bluetoothd[4945]:
src/service.c:change_state() 0x5557fcda23b0: device 74:E0:C9:69:D2:8C
profile batt-profile state changed: unavailable -> disconnected (0)
сак 20 13:53:42 jeknotez bluetoothd[4945]:
profiles/battery/battery.c:batt_accept() BATT profile accept
(74:E0:C9:69:D2:8C)
сак 20 13:53:42 jeknotez bluetoothd[4945]:
src/service.c:change_state() 0x5557fcda23b0: device 74:E0:C9:69:D2:8C
profile batt-profile state changed: disconnected -> connected (0)

device_probe_profiles()
...
batt_accept()
  gatt_db_foreach_service()
    foreach_batt_service()
      handle_batt_service()
        gatt_db_service_foreach_char()
          handle_characteristic()
                    if (uuid_cmp(GATT_CHARAC_BATTERY_LEVEL, &uuid)) {
                         handle_battery_level(batt, value_handle);
                    }



-- 
Yauhen Kharuzhy




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux