Skip to content

Commit

Permalink
adapter: Fix adding SDP records when operating on LE only mode
Browse files Browse the repository at this point in the history
If mode is set to BT_MODE_LE SDP protocol won't be operational so it is
useless to attempt to add records.
  • Loading branch information
Vudentz committed Mar 28, 2022
1 parent 2a2b027 commit 4fefa24
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,13 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
{
int ret;

/*
* If the controller does not support BR/EDR operation,
* there is no point in trying to add SDP records.
*/
if (btd_opts.mode == BT_MODE_LE)
return -ENOTSUP;

DBG("%s", adapter->path);

ret = add_record_to_server(&adapter->bdaddr, rec);
Expand All @@ -1233,10 +1240,17 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)

void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
{
sdp_record_t *rec = sdp_record_find(handle);
sdp_record_t *rec;
/*
* If the controller does not support BR/EDR operation,
* there is no point in trying to remote SDP records.
*/
if (btd_opts.mode == BT_MODE_LE)
return;

DBG("%s", adapter->path);

rec = sdp_record_find(handle);
if (!rec)
return;

Expand Down

0 comments on commit 4fefa24

Please sign in to comment.