Re: [PR] nimble/host: Avoid slave instance reset inside extract_cb [mynewt-nimble]

2024-05-08 Thread via GitHub


rahult-github commented on PR #1773:
URL: https://github.com/apache/mynewt-nimble/pull/1773#issuecomment-2101963861

   Hi @sjanc  , have pushed new version to have a separate API. This will 
ensure existing code remains same to avoid any race condition. Please have a 
look 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100707861

   AutoPTS Bot results:
   Failed testsMESHMESH/NODE/BCN/SNB/BV-01-C
   FAIL
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100692241

   Scheduled PR 
#https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100690719 
after 16:17:45.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


sjanc commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100690719

   #AutoPTS run mynewt MESH/NODE/BCN/SNB/BV-01-C


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/controller: Add Channel Sounding setup phase [mynewt-nimble]

2024-05-08 Thread via GitHub


sjanc commented on code in PR #1765:
URL: https://github.com/apache/mynewt-nimble/pull/1765#discussion_r1594083001


##
nimble/controller/src/ble_ll_cs.c:
##
@@ -26,75 +26,956 @@
 #include "controller/ble_ll_conn.h"
 #include "controller/ble_ll_hci.h"
 #include "controller/ble_ll_cs.h"
+#include "ble_ll_conn_priv.h"
+#include "ble_ll_cs_priv.h"
+
+static struct ble_ll_cs_supp_cap g_ble_ll_cs_local_cap;
+static struct ble_ll_cs_sm g_ble_ll_cs_sm[MYNEWT_VAL(BLE_MAX_CONNECTIONS)];
+static const uint8_t t_ip1[] = {10, 20, 30, 40, 50, 60, 80, 145};
+static const uint8_t t_ip2[] = {10, 20, 30, 40, 50, 60, 80, 145};
+static const uint8_t t_fcs[] = {15, 20, 30, 40, 50, 60, 80, 100, 120, 150};
+static const uint8_t t_pm[] = {10, 20, 40};
+static const uint8_t default_channel_classification[10] = {
+0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F
+};
+static uint8_t g_ble_ll_cs_chan_class[10];
+static uint8_t g_ble_ll_cs_chan_count = 0;
+static uint8_t g_ble_ll_cs_chan_indices[72];
 
 int
 ble_ll_cs_hci_rd_loc_supp_cap(uint8_t *rspbuf, uint8_t *rsplen)
 {
-return BLE_ERR_UNSUPPORTED;
+const struct ble_ll_cs_supp_cap *cap = &g_ble_ll_cs_local_cap;
+struct ble_hci_le_cs_rd_loc_supp_cap_rp *rsp = (void *)rspbuf;
+
+rsp->num_config_supported = cap->max_number_of_configs;
+rsp->max_consecutive_procedures_supported = 
htole16(cap->max_number_of_procedures);
+rsp->num_antennas_supported = cap->number_of_antennas;
+rsp->max_antenna_paths_supported = cap->max_number_of_antenna_paths;
+rsp->roles_supported = cap->roles_supported;
+rsp->optional_modes_supported = cap->mode_types;
+rsp->rtt_capability = cap->rtt_capability;
+rsp->rtt_aa_only_n = cap->rtt_aa_only_n;
+rsp->rtt_sounding_n = cap->rtt_sounding_n;
+rsp->rtt_random_payload_n = cap->rtt_random_sequence_n;
+rsp->optional_nadm_sounding_capability = 
htole16(cap->nadm_sounding_capability);
+rsp->optional_nadm_random_capability = 
htole16(cap->nadm_random_sequence_capability);
+rsp->optional_cs_sync_phys_supported = cap->cs_sync_phy_capability;
+rsp->optional_subfeatures_supported = htole16(0x000f &
+  (cap->no_fae << 1 |
+   cap->channel_selection << 2 
|
+   cap->sounding_pct_estimate 
<< 3));
+rsp->optional_t_ip1_times_supported = htole16(cap->t_ip1_capability);
+rsp->optional_t_ip2_times_supported = htole16(cap->t_ip2_capability);
+rsp->optional_t_fcs_times_supported = htole16(cap->t_fcs_capability);
+rsp->optional_t_pm_times_supported = htole16(cap->t_pm_capability);
+rsp->t_sw_time_supported = cap->t_sw;
+rsp->optional_tx_snr_capability = cap->tx_snr_capablity;
+
+*rsplen = sizeof(*rsp);
+
+return BLE_ERR_SUCCESS;
+}
+
+void
+ble_ll_cs_capabilities_pdu_make(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
+{
+const struct ble_ll_cs_supp_cap *cap = &g_ble_ll_cs_local_cap;
+
+*dptr = cap->mode_types;
+dptr[1] = cap->rtt_capability;
+dptr[2] = cap->rtt_aa_only_n;
+dptr[3] = cap->rtt_sounding_n;
+dptr[4] = cap->rtt_random_sequence_n;
+put_le16(dptr + 5, cap->nadm_sounding_capability);
+put_le16(dptr + 7, cap->nadm_random_sequence_capability);
+dptr[9] = cap->cs_sync_phy_capability;
+dptr[10] = cap->number_of_antennas | cap->max_number_of_antenna_paths << 4;
+dptr[11] = cap->roles_supported |
+   cap->no_fae << 3 |
+   cap->channel_selection << 4 |
+   cap->sounding_pct_estimate << 5;
+dptr[12] = cap->max_number_of_configs;
+put_le16(dptr + 13, cap->max_number_of_procedures);
+dptr[15] = cap->t_sw;
+put_le16(dptr + 16, cap->t_ip1_capability);
+put_le16(dptr + 18, cap->t_ip2_capability);
+put_le16(dptr + 20, cap->t_fcs_capability);
+put_le16(dptr + 22, cap->t_pm_capability);
+dptr[24] = cap->tx_snr_capablity << 1;
+}
+
+static void
+ble_ll_cs_update_rem_capabilities(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
+{
+struct ble_ll_cs_supp_cap *cap = &connsm->cssm->remote_cap;
+
+cap->mode_types = *dptr;
+cap->rtt_capability = dptr[1];
+cap->rtt_aa_only_n = dptr[2];
+cap->rtt_sounding_n = dptr[3];
+cap->rtt_random_sequence_n = dptr[4];
+cap->nadm_sounding_capability = get_le16(dptr + 5);
+cap->nadm_random_sequence_capability = get_le16(dptr + 7);
+cap->cs_sync_phy_capability = dptr[9];
+
+cap->number_of_antennas = dptr[10] & 0b;
+cap->max_number_of_antenna_paths = dptr[10] >> 4;
+
+cap->roles_supported = dptr[11] & 0b0011;
+cap->no_fae = (dptr[11] & 0b1000) >> 3;
+cap->channel_selection = (dptr[11] & 0b0001) >> 4;
+cap->sounding_pct_estimate = (dptr[11] & 0b0010) >> 5;
+
+cap->max_number_of_configs = dptr[12];
+cap->max_number_of_procedures = get_le16(dptr + 13);
+cap->t_sw = dptr[15];
+cap->t_ip1_c

Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100648482

   AutoPTS Bot results:
   Failed testsMESHMESH/NODE/CFG/AKL/BV-02-C
   FAIL
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100634058

   Scheduled PR 
#https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100341558 
after 15:54:59.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Avoid slave instance reset inside extract_cb [mynewt-nimble]

2024-05-08 Thread via GitHub


rahult-github commented on code in PR #1773:
URL: https://github.com/apache/mynewt-nimble/pull/1773#discussion_r1594059291


##
nimble/host/src/ble_gap.c:
##
@@ -924,6 +923,11 @@ ble_gap_adv_finished(uint8_t instance, int reason, 
uint16_t conn_handle,
 ble_gap_event_listener_call(&event);
 
 ble_gap_slave_extract_cb(instance, &cb, &cb_arg);
+
+ble_hs_lock();

Review Comment:
   Ok . in that case, i guess making a new function to just extract cb and not 
reset state would be needed ?  Please let me know if this works, and i can 
update PR accordingly 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add support for PACS autopts tests [mynewt-nimble]

2024-05-08 Thread via GitHub


szymon-czapracki commented on code in PR #1747:
URL: https://github.com/apache/mynewt-nimble/pull/1747#discussion_r1593987991


##
apps/bttester/src/btp_pacs.c:
##
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* btp_pacs.c - Bluetooth Published Audio Capacity Service Tester */
+
+#include "audio/ble_audio.h"
+#include "audio/ble_audio_codec.h"
+#include "btp/bttester.h"
+#include "host/ble_gap.h"
+#include "syscfg/syscfg.h"
+#include 
+
+#if MYNEWT_VAL(BLE_AUDIO)
+
+#include "btp/btp.h"
+#include "btp/btp_pacs.h"
+#include "services/pacs/ble_audio_svc_pacs.h"
+#include "services/pacs/ble_audio_svc_pacs_lc3.h"
+
+#define BLE_SVC_AUDIO_PACS_LC3_CODEC_ID 0x06
+
+struct set_avail_cb_data {
+uint16_t src_ctxts;
+uint16_t snk_ctxts;
+};
+
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SNK_METADATA
+static uint8_t ble_svc_audio_pacs_lc3_snk_metadata[] =
+{ UNMANGLE_MYNEWT_VAL(MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_METADATA)) };
+#endif
+
+static uint8_t ble_svc_audio_pacs_lc3_snk_codec_spec_caps[] = 
BLE_AUDIO_BUILD_CODEC_CAPS(
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_SAMPLING_FREQUENCIES),
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_FRAME_DURATIONS),
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SRC_AUDIO_CHANNEL_COUNTS
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_AUDIO_CHANNEL_COUNTS),
+#else
+,
+#endif
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_MIN_OCTETS_PER_CODEC_FRAME),
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_MAX_OCTETS_PER_CODEC_FRAME),
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SRC_MAX_CODEC_FRAMES_PER_SDU
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SNK_MAX_CODEC_FRAMES_PER_SDU),
+#endif
+);
+
+static uint8_t ble_svc_audio_pacs_lc3_src_codec_spec_caps[] = 
BLE_AUDIO_BUILD_CODEC_CAPS(
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_SAMPLING_FREQUENCIES),
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_FRAME_DURATIONS),
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SRC_AUDIO_CHANNEL_COUNTS
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_AUDIO_CHANNEL_COUNTS),
+#else
+,
+#endif
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_MIN_OCTETS_PER_CODEC_FRAME),
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_MAX_OCTETS_PER_CODEC_FRAME),
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SRC_MAX_CODEC_FRAMES_PER_SDU
+MYNEWT_VAL(BLE_SVC_AUDIO_PACS_LC3_SRC_MAX_CODEC_FRAMES_PER_SDU),
+#endif
+);
+
+static struct ble_audio_codec_register_params snk_codec_params = {
+.codec_id = {
+.format = BLE_SVC_AUDIO_PACS_LC3_CODEC_ID,
+.company_id = 0x00,
+.vendor_specific = 0x00
+},
+.codec_spec_caps_len = sizeof(ble_svc_audio_pacs_lc3_snk_codec_spec_caps),
+.codec_spec_caps = ble_svc_audio_pacs_lc3_snk_codec_spec_caps,
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SNK_METADATA
+.metadata_len = sizeof(ble_svc_audio_pacs_lc3_snk_metadata),
+.metadata = ble_svc_audio_pacs_lc3_snk_metadata,
+#else
+.metadata_len = 0,
+#endif
+
+.direction = BLE_AUDIO_CODEC_DIR_SINK_BIT
+};
+
+static struct ble_audio_codec_register_params src_codec_params = {
+.codec_id = {
+.format = BLE_SVC_AUDIO_PACS_LC3_CODEC_ID,
+.company_id = 0x00,
+.vendor_specific = 0x00
+},
+.codec_spec_caps_len = sizeof(ble_svc_audio_pacs_lc3_src_codec_spec_caps),
+.codec_spec_caps = ble_svc_audio_pacs_lc3_src_codec_spec_caps,
+#ifdef MYNEWT_VAL_BLE_SVC_AUDIO_PACS_LC3_SRC_METADATA
+.metadata_len = sizeof(ble_svc_audio_pacs_lc3_src_metadata),
+.metadata = ble_svc_audio_pacs_lc3_src_metadata,
+#else
+.metadata_len = 0,
+#endif
+.direction = BLE_AUDIO_CODEC_DIR_SOURCE_BIT
+};
+
+int
+set_available(uint16_t conn_handle, void *arg)
+{
+int rc;
+struct set_avail_cb_data *avail_data = arg;
+
+rc = ble_svc_audio_pacs_avail_contexts_set(conn_handle,
+   avail_data->snk_ctxts,
+   avail_data->src_ctxts);
+if (rc) {
+return BTP_STATUS_FAILED;
+}
+
+return BTP_STATUS_SUCCESS;
+}
+
+static uint8_t
+pacs_set_available_contexts(const void *cmd, uint16_t cmd_len,
+void *rsp, uint16_t *rsp_len)
+{

Review Comment:
   They are 

Re: [PR] nimble/host: Avoid slave instance reset inside extract_cb [mynewt-nimble]

2024-05-08 Thread via GitHub


sjanc commented on code in PR #1773:
URL: https://github.com/apache/mynewt-nimble/pull/1773#discussion_r1593967346


##
nimble/host/src/ble_gap.c:
##
@@ -924,6 +923,11 @@ ble_gap_adv_finished(uint8_t instance, int reason, 
uint16_t conn_handle,
 ble_gap_event_listener_call(&event);
 
 ble_gap_slave_extract_cb(instance, &cb, &cb_arg);
+
+ble_hs_lock();

Review Comment:
   this means that cb extraction and state reset is not longer atomic opration, 
  wouldn't this introduce a race condition?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] apps/auracast_usb: broadcast improvements [mynewt-nimble]

2024-05-08 Thread via GitHub


KKopyscinski opened a new pull request, #1776:
URL: https://github.com/apache/mynewt-nimble/pull/1776

   this commit:
   - adds fix for crash on to much/corrupted data on USD
   - adds support for all LC3 samplerates (besides 44.1kHz - unsupported)
   - fixes broadcast with HCI feedback disabled
   - by default resampler is disabled - only works for low samplerates, or low 
quality


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Zero initialize buffer after allocation [mynewt-nimble]

2024-05-08 Thread via GitHub


rahult-github commented on PR #1687:
URL: https://github.com/apache/mynewt-nimble/pull/1687#issuecomment-2100388705

   Hello @sjanc  , please take a look 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100349329

   AutoPTS Bot failed:
   Build and flash step failed


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


codecoup-tester commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100345547

   Scheduled PR 
#https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100341558 
after 13:19:23.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


sjanc commented on PR #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775#issuecomment-2100341558

   #AutoPTS run mynewt MESH/NODE/CFG/AKL/BV-02-C


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] nimble/host: Fix legacy advertising API with EXT_ADV enabled [mynewt-nimble]

2024-05-08 Thread via GitHub


sjanc opened a new pull request, #1775:
URL: https://github.com/apache/mynewt-nimble/pull/1775

   Configured advertisign instance is required in order to set advertising data 
when extended advertising HCI is used. Since when legacy PDU are in use we can 
set both AD and SCAN_RSP we can easily pre-configure selected instance just for 
this purpose and re-configure it before starting advertising without affecting 
set AD/SCAN_RSP.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org