Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13027798rwd; Fri, 23 Jun 2023 14:33:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TDMsx2RAm5hj6fjuE0wof5AeBZlRejMnHzjZ1oysXn4+sJTfcBrnkK3LkU4ga2kudLkOA X-Received: by 2002:a05:6a00:a94:b0:666:8403:9f4 with SMTP id b20-20020a056a000a9400b00666840309f4mr23465894pfl.16.1687556022168; Fri, 23 Jun 2023 14:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687556022; cv=none; d=google.com; s=arc-20160816; b=DPT4yo+A5ZLEWeq82BeblGNikDMeDRUvbctSIdTFkv4qQyqMCmkqqCK6e/MQwG0xkx pxlZN/NZYslZxvJxG0yaCqWUvL92kYuxal3MnD/mKt8vRImI8sgUdQd8+Zs65ezrdOwC snW7wrDQdgUF7dMrRy+h00qDvIbOBbg5JknPO48AyssCU1MelDWqGqjB9DKBhuSJcexZ NtZqep4rHTv9b9dWiwu9iHtOfF+QqkK/ZgAR8N4uM8pq1HL8LVaWwzKGuD3FiqhjfrAJ RLWXPsUzqbAs/th/rwrcrnjJJtlHyjdIyt1XY24FdmZKSl5CIJo1sCguFibLOiktIkKm pmTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=y0+JcJh53G8KrzGIubrj8DDWH3139d9wNlcvJVBjv+s=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=yN8e0D4EyLGL67ClPQ73D1b8NGTGj5P+cZN7zkfNJacEIpyQCe+lwF9Dad7G50XAHp i3bvIIERB+5cai3XA6YcUlzl/7f+ly62iqlmtecOLy4CK+l8iW8HH5dscPGGOorlS1zO bmd+xyrQN4G/wmhdmhXITLvGIDc2sZlqv7APZhMnBMY4mcpEMbOLZBOUBeFlr2YgebXr LZNnKFbfbX/VEP2MAtDXz/uWC56cpphtbUSumJ+v/5hJQmJWelNJ7m+n00n1qsNaitQ2 VkWMeE74KrFDEAacmn87KOPX7q5bLL7u0IIKacRVoH+C0spa4O9idY9s7e55THPoLqmr rgaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="qB71/EcR"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y30-20020a634b1e000000b00534780446d9si264979pga.640.2023.06.23.14.33.29; Fri, 23 Jun 2023 14:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="qB71/EcR"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbjFWV0q (ORCPT + 99 others); Fri, 23 Jun 2023 17:26:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbjFWVYf (ORCPT ); Fri, 23 Jun 2023 17:24:35 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFE41997 for ; Fri, 23 Jun 2023 14:24:33 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1b53e1cd0ffso7255445ad.0 for ; Fri, 23 Jun 2023 14:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687555472; x=1690147472; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=y0+JcJh53G8KrzGIubrj8DDWH3139d9wNlcvJVBjv+s=; b=qB71/EcRl4VIvsMsdYsQNyGrIX9dEtEetSLtXGLFZYss0bSIwbOebeObgZlXv6Ib3a rVq5egXma8ZBcziDDZjGm2H2WI796gfp+3wYSVrgzeS2oJinIhvNvlM0xTwtkl+O0ybL +eX/OUpsocs8/dY1BTNJiHLY0Idb6ymJJxhT7jcSzhJ1aHRGTbDSa59PRDWeyNDGnaYW AZQcbKWUlyLSE2FZFlJEZ5dPqjpZJzBwvbf3g4CZHqBLsAAW+R/QBHUX56SrdyCK351y DS/PPSuBKDJfpC2P9wklhq0+9I+4Iw+fSQU+ZxEa1diUvS+8YHvs3k36rqW6bf0KGmIx fmEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687555472; x=1690147472; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y0+JcJh53G8KrzGIubrj8DDWH3139d9wNlcvJVBjv+s=; b=JN78KO0JatoSHSQLBfkFIaQLRZQJA2oafC0gsh1E2nbKoptUZOE51pFdi5l/WsgxVK 5jRSL0AZvaobMXx0Kqtlv50HqnXc+csR1m7gWHRgm6RRyPF1ftIi5pm/yVneRH+J41Q1 IU5hAbyNhCM2dtA/Ouo+SsRr76DrZljb/CRPBKL72jMe7o0vfywyv0M2IcNSvYUZC9LH KCf3TAfxa+hKofZuNSGh5jB4xNX2W/ncVGqyRceFAmaAhRbVWoROpWkCmPPdPpr0r+5Z T0M+Xy6NNKBc9hUR3UK6WzxFKs/S80GhyKrxLyWkIWSjgyhZZZ+MNsS6Dq7Pret2kkXl gMgw== X-Gm-Message-State: AC+VfDxeEZnnaBe6Emb5ClirbzmF910mrigWI+ZhOi2G4SdjkUAM3hPl KPSVQi4BrIlMgc7nIW6c2VeiywIo6DhoHQ== X-Received: by 2002:a17:902:f689:b0:1b2:1943:e291 with SMTP id l9-20020a170902f68900b001b21943e291mr243655plg.57.1687555472388; Fri, 23 Jun 2023 14:24:32 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id bb6-20020a170902bc8600b001b694140d96sm20481plb.170.2023.06.23.14.24.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 14:24:31 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] btdev: Fix CIS Established Event parameters Date: Fri, 23 Jun 2023 14:24:29 -0700 Message-Id: <20230623212430.1702254-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz ISO Interval and Transport Latency were inverted. --- emulator/btdev.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index d5450190c38e..637f0bb98057 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -5940,8 +5940,14 @@ static int cmd_create_cis(struct btdev *dev, const void *data, uint8_t len) return 0; } -static uint32_t le_cis_transport_latecy(uint8_t ft, uint8_t iso_interval, - uint8_t sdu_interval[3]) +static uint8_t le_cis_interval(uint8_t sdu_interval[3]) +{ + /* ISO Interval (slots of 1.25 ms) = SDU_Interval (us) */ + return get_le24(sdu_interval) / 1250; +} + +static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval, + uint8_t sdu_interval[3]) { uint32_t latency; uint32_t interval = get_le24(sdu_interval); @@ -5949,7 +5955,7 @@ static uint32_t le_cis_transport_latecy(uint8_t ft, uint8_t iso_interval, /* Transport_Latency = FT × ISO_Interval - SDU_Interval */ latency = ft * (iso_interval * 1250) - interval; - return latency <= interval ? latency : interval; + return latency >= interval ? latency : interval; } static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn, @@ -5983,7 +5989,7 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn, evt.p_ft = 0x02; evt.c_mtu = le_cig->cis[cis_idx].c_sdu; evt.p_mtu = le_cig->cis[cis_idx].p_sdu; - evt.interval = (le_cig->params.c_latency + 0.625) / 1.25; + evt.interval = le_cis_interval(le_cig->params.c_interval); /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 6, Part G * page 3050: @@ -5993,9 +5999,9 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn, * Transport_Latency_P_To_C = CIG_Sync_Delay + FT_P_To_C × * ISO_Interval - SDU_Interval_P_To_C */ - put_le24(le_cis_transport_latecy(evt.c_ft, evt.interval, + put_le24(le_cis_latecy(evt.c_ft, evt.interval, le_cig->params.c_interval), evt.c_latency); - put_le24(le_cis_transport_latecy(evt.p_ft, evt.interval, + put_le24(le_cis_latecy(evt.p_ft, evt.interval, le_cig->params.p_interval), evt.p_latency); } -- 2.40.1