Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3000169rwl; Thu, 13 Apr 2023 14:13:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuZ8cPySIwjIXSX9j0mdjmuixel4rJSEZxpYU7DIw0fGkSE2T01+zxyom9QJOFkHuDuY9j X-Received: by 2002:a17:90a:2a01:b0:247:271:c433 with SMTP id i1-20020a17090a2a0100b002470271c433mr3259190pjd.34.1681420419109; Thu, 13 Apr 2023 14:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681420419; cv=none; d=google.com; s=arc-20160816; b=ra+dmE3bFkxSl8WL+GEtsX3y172TDMpxtUk/+yYTcDSwwGw7T/zbRQoZLpXVgGXCta QqRvTkUIg6dz96H5jimBCGhSgVzRc5oOuA5yebdKUihMiSi+O0iXc9yyuetpg3SiC3dC fwOQ8v/bV78ITskPR57TX98KMdbPZU9pPeOqe1P7wO7FaxV9BRjZqZeKkiE5eYNdwbUu MEeY2sIsoYl9we/qWKS1higXV11toatDWpYw/e8JFH+FF1k5To+wD104AQ07f5ascBp1 doyGx1DFzRVQm3mDdUUWfvekd64E2yhaMeddvSNPUSPqatzOrD5o1w+0FWuOz28gzRXY zszw== 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=358+heE2o6OcvH2wEQoFktPRTIdMyWSY6TmCjjXXmt8=; b=wQyGmKnEpMIYYxgBW4USbZ65sXTsOHzVIO4Y2iB4jXYlzkzqpMJrOaPt4P0IfrJgmW ji3l6wkFa83JLHaLFP/OFLBcz9/wH7NdpLxnuNfxXOIDzY1HJqdumJp48iaq3CI6Hk0w 555s0h7rC1YtaF2lNCn+7ErWMDyNlouymRCuiEPqMkB6vKrtAyHnecCBG7CH9pR0hsFm SQLSvCQrHgwnlIK8cRN1yBgrFksHTJJRkbexmD0INP8awQwVWtVGwoJXNkuadKZ+SKM3 sMf+LYQMP4iGmMjY/iUg59OrVeu3bFszKCXPvJ2CqtgGFMGcmh4OkjiaCpRbXymMEG3S ClIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nsfvu8+j; 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 j70-20020a638b49000000b0051b6cf91f72si73678pge.528.2023.04.13.14.12.06; Thu, 13 Apr 2023 14:13:39 -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=nsfvu8+j; 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 S229450AbjDMVEz (ORCPT + 99 others); Thu, 13 Apr 2023 17:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbjDMVEz (ORCPT ); Thu, 13 Apr 2023 17:04:55 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F6193CF for ; Thu, 13 Apr 2023 14:04:53 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id d22-20020a17090a111600b0023d1b009f52so19531656pja.2 for ; Thu, 13 Apr 2023 14:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681419892; x=1684011892; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=358+heE2o6OcvH2wEQoFktPRTIdMyWSY6TmCjjXXmt8=; b=nsfvu8+juUcZW/v7RwAALnZZ2wKlX9Gg0WMUqALHYCHCLkEXT2kgUZNfHEpUFWmEBx qAyCUegILFIjmqtwHoJPf0E9XotuZNPbafoJUs/dN2ryEqeGRSQKChjWTShEEKLqjcLs 1WNYfi3MMuE4UswoLsMP35SPCC9++04Yjl/o2dObpRofkv7DCdwLP4w0KHL7ZlDVqum0 o+4HDX+1JO/9Wy6OH7PccF7/TosU0cmfOJr7ndcTVYyFlPE0XvR7VZKY785mVLqjrgWf EXOUUq+MG3yAqMIGTZ3E3hgjigUWJ4J9nwOiugcRzBpvqi5D/KCGyFmuMLL5equ1F42m tUmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681419892; x=1684011892; 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=358+heE2o6OcvH2wEQoFktPRTIdMyWSY6TmCjjXXmt8=; b=jHYlreXFFNQfe8lgEK0XFvVLP096CKJiK1HMbqORN/BNHOqwYwU2sjOPf3LKnjeSZa B9+doPavfTKcFfd6cfyNtBDpNyuXe39AvfsuPp8ClzR6Ai65Sm1X2FWXqmoOXAMI2b24 2xUE+sM6DWacvtbrP2Idadqh0zTnCOqIrodyk0KL6V4o0934SxcBWBR/OiJ9BSdCW/2M 7BamXGP2me2jp/kJcHq7oRsQQef7neqpkExH5xLhsfQkEyI7bByNFHynQvP8gVcLqOTA eIlpnyUtimbbu8/9PnYs51DoxAg/cWpwlSRHbgL7XVvPqXuBvsOpJO4IZPyqbDN/ol31 NtVw== X-Gm-Message-State: AAQBX9dUJwKw46b9I8xJcrCMlWiC4UKz5rm1+on2AA18vy/MLU6grssI 67oWt90A1NKZ0uNpy6i+UC3LuNnGKptjwA== X-Received: by 2002:a17:902:fb0e:b0:19e:8688:86fe with SMTP id le14-20020a170902fb0e00b0019e868886femr277257plb.42.1681419892116; Thu, 13 Apr 2023 14:04:52 -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 ij8-20020a170902ab4800b001a514d75d16sm1898509plb.13.2023.04.13.14.04.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 14:04:51 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 1/2] btdev: Fix not setting CIS parameters properly Date: Thu, 13 Apr 2023 14:04:49 -0700 Message-Id: <20230413210450.961897-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 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 The code was assuming only index 0 was to be used which doesn't work when there are multiple CIS being programmed with different parameters. --- emulator/btdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 549f93645684..a04f34d4bdb3 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -5885,6 +5885,7 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn, if (!evt.status) { struct btdev *remote = conn->link->dev; + int i = conn->handle - ISO_HANDLE; /* TODO: Figure out if these values makes sense */ memcpy(evt.cig_sync_delay, remote->le_cig.params.c_interval, @@ -5895,15 +5896,15 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn, sizeof(remote->le_cig.params.c_interval)); memcpy(evt.p_latency, &remote->le_cig.params.p_interval, sizeof(remote->le_cig.params.p_interval)); - evt.c_phy = remote->le_cig.cis[0].c_phy; - evt.p_phy = remote->le_cig.cis[0].p_phy; + evt.c_phy = remote->le_cig.cis[i].c_phy; + evt.p_phy = remote->le_cig.cis[i].p_phy; evt.nse = 0x01; evt.c_bn = 0x01; evt.p_bn = 0x01; evt.c_ft = 0x01; evt.p_ft = 0x01; - evt.c_mtu = remote->le_cig.cis[0].c_sdu; - evt.p_mtu = remote->le_cig.cis[0].p_sdu; + evt.c_mtu = remote->le_cig.cis[i].c_sdu; + evt.p_mtu = remote->le_cig.cis[i].p_sdu; evt.interval = remote->le_cig.params.c_latency; } @@ -5948,7 +5949,7 @@ static int cmd_create_cis_complete(struct btdev *dev, const void *data, evt.acl_handle = cpu_to_le16(acl->handle); evt.cis_handle = cpu_to_le16(iso->handle); evt.cig_id = iso->dev->le_cig.params.cig_id; - evt.cis_id = iso->dev->le_cig.cis[0].cis_id; + evt.cis_id = iso->dev->le_cig.cis[i].cis_id; le_meta_event(iso->link->dev, BT_HCI_EVT_LE_CIS_REQ, &evt, sizeof(evt)); -- 2.39.2