Re: [PATCH BlueZ v4 2/2] profiles: Register RAS UUID reactively instead of probing
Naga Bhavani Akella <[email protected]>
| Newsgroups | org.kernel.vger.linux-bluetooth |
|---|---|
| Message-ID | <[email protected]> |
Hi Luiz, On 7/17/2026 7:36 PM, Luiz Augusto von Dentz wrote: > Hi Naga, > > On Fri, Jul 17, 2026 at 10:02 AM Luiz Augusto von Dentz > <[email protected]> wrote: >> >> Hi Naga, >> >> On Fri, Jul 17, 2026 at 8:41 AM Naga Bhavani Akella >> <[email protected]> wrote: >>> >>> Replace the unconditional reflector-role GATT_UUID probe in >>> gatt_client_init() with a reactive registration driven by actual >>> remote RAS access, using the notification API added in shared/rap. >> >> It seems you already have something like that in bt_rap_register >> attached callback, it is just never used, which explains why >> rap_attached is never called and you need the likes of probe in order >> to create rap_data_new. > > In case I wasn't clear, I meant shared/bap.c needs to call > rap->attached callback whenever a session is connected, just follow > what was done in the likes of shared/bap.c which does bt_bap_attach -> > bap->attached, so bt_rap_attach shall probably call rap->attached. > Understood. I will include the requested changes in the next revision.>> >>> --- >>> profiles/ranging/rap.c | 25 +++++++++++++++++++++++++ >>> 1 file changed, 25 insertions(+) >>> >>> diff --git a/profiles/ranging/rap.c b/profiles/ranging/rap.c >>> index 3ffc0da76..4f6d7f2db 100644 >>> --- a/profiles/ranging/rap.c >>> +++ b/profiles/ranging/rap.c >>> @@ -308,6 +308,27 @@ static void rap_attached(struct bt_rap *rap, void *user_data) >>> rap_data_add(data); >>> } >>> >>> +static void rap_ras_accessed(struct bt_att *att, void *user_data) >>> +{ >>> + struct btd_device *device; >>> + struct btd_service *service; >>> + >>> + device = btd_adapter_find_device_by_fd(bt_att_get_fd(att)); >>> + if (!device) { >>> + error("unable to find device for RAS access"); >>> + return; >>> + } >>> + >>> + service = btd_device_get_service(device, GATT_UUID); >>> + if (!service) { >>> + btd_device_add_uuid(device, GATT_UUID); >>> + service = btd_device_get_service(device, GATT_UUID); >>> + } >>> + >>> + if (service) >>> + service_accept(service, btd_device_is_initiator(device)); >>> +} >>> + >>> enum cs_dict_target { >>> CS_TARGET_SETTINGS, >>> CS_TARGET_CFG, >>> @@ -830,6 +851,7 @@ static struct btd_profile rap_profile = { >>> }; >>> >>> static unsigned int rap_id; >>> +static unsigned int rap_ras_accessed_id; >>> >>> static int rap_init(void) >>> { >>> @@ -840,6 +862,8 @@ static int rap_init(void) >>> return err; >>> >>> rap_id = bt_rap_register(rap_attached, rap_detached, NULL); >>> + rap_ras_accessed_id = bt_rap_ras_accessed_register(rap_ras_accessed, >>> + NULL); >>> >>> return 0; >>> } >>> @@ -848,6 +872,7 @@ static void rap_exit(void) >>> { >>> btd_profile_unregister(&rap_profile); >>> bt_rap_unregister(rap_id); >>> + bt_rap_ras_accessed_unregister(rap_ras_accessed_id); >>> } >>> >>> BLUETOOTH_PLUGIN_DEFINE(rap, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, >>> -- >>> >> >> >> -- >> Luiz Augusto von Dentz > > > Thanks, Bhavani