Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp652917rwd; Wed, 7 Jun 2023 05:18:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6q6mEA1igFMyxQ26AkqD7i9SnKlAP7Lf7+r2Ki48Bh1zyIlFgQ1jQNR/YMggVRDZiu6nQI X-Received: by 2002:a05:6a00:98c:b0:653:ac91:89a with SMTP id u12-20020a056a00098c00b00653ac91089amr8159776pfg.9.1686140333219; Wed, 07 Jun 2023 05:18:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686140333; cv=pass; d=google.com; s=arc-20160816; b=W3dvrB1M19ySf3b0FFsMjziMOcSM/CrrpBfiCDw45rN1wQeFrYlEppVCBFG2yoaVms FKHVbl7U7MUHDP/lpFgxSlOQxeTfGVz420e3zoB8ERnJ/mf3HvR01GwofAd0X4oU6EIn pI28Q+/EEG5kpI9r9zstMRVWXucvRjxw1NeoxtBQJYV7lAg1MLT65MnnBuXn+tTaSapi 9pya4ShF7vPWSuDUCdMooBFz9Q9R+HddDFLYf/7ljVa6Vz//Wng998syXK5bJxHbCXXy NnPq+oKPnnIq0Rq60EI+jzi/JBLoB5aUMnynpwVvavHcJouXEB4x1M6zrjhlGo0ShrUb 2xUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U32rteFPZhBvqPBZOT5DB6FLUnNyhc34GkoNTvAuqqw=; b=TuTyi0zMzW+i4EMDaJBnYb4KNwdk/E91VXRNykfwhVi3r2IluuUdinIUBS9/smHD6B P9iA7JNISNyx1LyWrz0doyYmRlpvZ+hSRsDc9ykF1uL5VoFMT6mZjpaJWWowyw2cMFfs n/aNLxYIbPFoYe0+veP8zuOmftMZZ5kjp1xtZJTyQsoQOHin2+FUrSNzdHnQRFaEmt4B TaX7861DtA1CPeIbLtldNREtpXlIe5zZqjIO8/EZNDN2FA/RQ5CA2I2ibwBTm1ezesaN hl1gPHP4kAjhji7Ri/fwMloJEPPUj73jwtUp4qpHKufdLmoxo2xgjhGxSsCyYaHQgF3p RqyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Gz8Re7pk; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a621c15000000b0063d3aed5eb3si8552316pfc.197.2023.06.07.05.18.27; Wed, 07 Jun 2023 05:18:53 -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=@nxp.com header.s=selector2 header.b=Gz8Re7pk; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240258AbjFGMO0 (ORCPT + 99 others); Wed, 7 Jun 2023 08:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240248AbjFGMOY (ORCPT ); Wed, 7 Jun 2023 08:14:24 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2088.outbound.protection.outlook.com [40.107.14.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8CB1BE3 for ; Wed, 7 Jun 2023 05:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CeEX7UOHAcLGO4BY2C5mTJeFbv0VIo1KqDUR2/5Q2nkWbqA2Iz3J2Jl+/lIbWmc+1fsgrgy+JMBVBM0CYfSP8lvwaYh+gjQNgwTaNAFQa404MWsxZgU63LXLMDQCJSRRLawfb+y5EgIy7egGoLX1gnYX6qNT8crq5ZfoJUx1POe7xcahExsBtJe0ujkc3VCwivJHGYMkCKoU//XsvrpSLxP0xN+SSBzazyR50kAA+RNQhD5NUU8whQN1sEGGxvNA9+vxaANOnuUIh13euyi+ZAwyS2i0A59DD+2wIBXoY25r9Tvz25LZkCVeaYOHHAEMJtuyIRTj7PQuyAQFs2xozA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U32rteFPZhBvqPBZOT5DB6FLUnNyhc34GkoNTvAuqqw=; b=ngZsFMy/pYqZS/q3644YeyUKNbb2ioc1XzM5O9po5Po5dvah/t2E7WmLFbdaw2VaeLbe44RN4EiMw46XvIXteamHjKkeC0obwPAuQ5/uljIc+ayt5InfO2LiJS5qMEKjDCONoTxfPu5EcX4fAU65HognphSphTiZEg1BQrnADlQjYicU6rKKc/DNhRZaxThb+rg9g9XqBXAymXt2gM89buPs+ZA+dzTvV9/kCLAsCeatc06rxFsoe6v224fUa+0rD5oRMdHGEYs6+37Mk43MVjRlWELyIZWWhqwIgy6kx3sLRsKKaD13H1EADTw5IoIrFqqCCwhN5inw4PDfvzTJlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U32rteFPZhBvqPBZOT5DB6FLUnNyhc34GkoNTvAuqqw=; b=Gz8Re7pk9ACozxyFraBTSD7d/iZX2hMeKGEYUAXQUx1biJM38XBeC47kQR2XyBWM9xE3m2h0cwQCKJGuzmzMVfG67s69SN7kJuxd8yJXCDVvYqTixmNep9vDmaavuEdLnHrY2CuELnla2IcRLgQIKZlgcf0fh6nhCBXMUH3/pqM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) by AS4PR04MB9434.eurprd04.prod.outlook.com (2603:10a6:20b:4ea::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 12:14:21 +0000 Received: from AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::ad2c:857b:a144:9af4]) by AS8PR04MB9126.eurprd04.prod.outlook.com ([fe80::ad2c:857b:a144:9af4%3]) with mapi id 15.20.6455.030; Wed, 7 Jun 2023 12:14:21 +0000 From: Nitin Jadhav To: linux-bluetooth@vger.kernel.org Cc: devyani.godbole@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, nitin.jadhav@nxp.com Subject: [PATCH BlueZ v2 2/2] Make VOCS (Secondary) as an included service of VCS (Primary) Date: Wed, 7 Jun 2023 15:13:42 +0300 Message-Id: <20230607121342.6136-3-nitin.jadhav@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607121342.6136-1-nitin.jadhav@nxp.com> References: <20230607121342.6136-1-nitin.jadhav@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0110.apcprd02.prod.outlook.com (2603:1096:4:92::26) To AS8PR04MB9126.eurprd04.prod.outlook.com (2603:10a6:20b:449::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB9126:EE_|AS4PR04MB9434:EE_ X-MS-Office365-Filtering-Correlation-Id: 551fbafc-0deb-4ac4-6a32-08db6750b961 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /hcT0ZaETit8AF1LGbltX4NdfHCyiWYRwC770Pd/+00TjW79yj1j3Jg3Cwa4KuszXpAffxPC7HP9XbaLusFcYzdjxSKLGTOiB8qZvxb0VdL8ON2eqqSyj6+PvFPwq8f9n+rwtPRY/0fY+VGqaY6Aapp73yboZizQwHFOLDMosIBbwox+lTfpf8XniWi5VudwtMycMyGZZcvRTr17gzmD4WnQutoEyP4griQ515GQMiIUhSyRwNh8k9VSk3gRl3g3HLvOxX25gm++/JFeOSclSoWuRpoZmDpy3nyFAr8FAXvRFJe3cI0zCrKVrHraD2UNvansJQ5A3zaq19X2trDOQ+ZF6Z8uu/llJK3JEcaNLTnoypvsdBOIn6x8l84wwOVl/5HnoDKpyzUPkeCA5AJMVFPpa44hew8rS2RTZZpN4tf8k7HHu6oT3eSL5RksyDV4iw26CmOWviVWTntZcwoeQJMJ8gieb2qfrxPJf0+GmGxSL49nlBu/HKxfLmY++9jaeQGo227M9HzQFZSDF2scceRsOk1v2K3eCXBXFo3Oc3kT48DSXkRh19KS+ESbf13GIlsNQuE0HFzyM7+5YPDxhZOULBFLT9FJP6YKHnBeIOA+/GX3jZBCNgO0aXrSZXdu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB9126.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39860400002)(366004)(376002)(396003)(451199021)(478600001)(5660300002)(8936002)(44832011)(8676002)(36756003)(86362001)(2906002)(66556008)(66476007)(6916009)(66946007)(316002)(4326008)(6506007)(41300700001)(38350700002)(2616005)(38100700002)(6512007)(1076003)(26005)(83380400001)(6486002)(52116002)(186003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yZ5FzMek5SnpwCV641dWWh43Xa4qcIWPJx0CtcMKfEIdDRQQvg+HWoQrf+XN?= =?us-ascii?Q?urgVBajAinggeoJvYLQ5Id2b48Ax0Iezjl76HGlywfEytykkM/xtch3ynwIw?= =?us-ascii?Q?xr8XIHMRSrWVNw0jfJDynMZQjJycBH7NWT2U7Q9tSMhTKKbqiNyQ57CKbmlu?= =?us-ascii?Q?KkzAyMUT6NlpF8mYsgjeYswz7F6YqepcxX3Ys8Bx902p2vj70p0suTyo3ip9?= =?us-ascii?Q?iiGRPTmNB4RVIoz0RSuZD0sZcDNqZFVu0Ula4yIliMMHWrW35ajIwXAEvbeD?= =?us-ascii?Q?lBA18UmDFrCFMhr96X/a8CLy+pfY9BjfmgFsS0+SuFNiwsOfaODIFiMDphPK?= =?us-ascii?Q?qgiOjC+eJSObQZEhhNUzf6leeaNsL7Smnxb+kASkC5rZq4I6DN8/yUc+r8IP?= =?us-ascii?Q?m5vdmrBPnnXAf8lPwxrbcru7+Q45OB+FDpnigH2pqIksmtA7MkDAZcN+kB1I?= =?us-ascii?Q?J6lme3lFe2b4Asotk3TCKWvM5C+v7JwHVY3XEIIKmo98e562E8p0RsieMZ/m?= =?us-ascii?Q?RKvAOf2Kkl4jI4NefiJLwjpTjsO1cEB/1xiPwwxMTf4nElh+r/tkbBMWO7d6?= =?us-ascii?Q?IXJyIYE1s7iH8vIKrmTPxs3C/CbmzqObWUoa7FBLYGsWV0h8g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MHrT5qi4MgzfWCue39k/TxfrylykidswDZA8UPxFo?= =?us-ascii?Q?JbKpkU9OYnOkvhnJwek7VFJUbrxmqR4R2lWy74v5?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 551fbafc-0deb-4ac4-6a32-08db6750b961 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB9126.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 12:14:21.0751 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4lclQkQI+P5JWHl90SPy2dEwv88Aeyq/SbwlOv/XVVQEc5R3VHjOieuIeZ177UrileYbIHmWfuB9nYaoFu5muQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9434 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Fixed the following issue observed during PTS testing - Specified Upper and Lower Limit for Volume offset - Corrected the number of handles for VOCS - VOCS is made as included service of VCS (VOCS is secondary service and VSC is primary service) --- v2: Cosmetic Changes (Bluez Test Bot) --- src/shared/vcp.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/shared/vcp.c b/src/shared/vcp.c index e9bd6e88b..7a9a6c9ed 100644 --- a/src/shared/vcp.c +++ b/src/shared/vcp.c @@ -32,9 +32,13 @@ #define VCP_STEP_SIZE 1 +#define VOCS_VOL_OFFSET_UPPER_LIMIT 255 +#define VOCS_VOL_OFFSET_LOWER_LIMIT -255 + /* Apllication Error Code */ #define BT_ATT_ERROR_INVALID_CHANGE_COUNTER 0x80 #define BT_ATT_ERROR_OPCODE_NOT_SUPPORTED 0x81 +#define BT_ATT_ERROR_VALUE_OUT_OF_RANGE 0x82 #define BT_VCP_NA 0x00000000 #define BT_VCP_FRONT_LEFT 0x00000001 @@ -100,7 +104,7 @@ struct bt_vcs_ab_vol { struct bt_vocs_set_vol_off { uint8_t change_counter; - uint8_t set_vol_offset; + int16_t set_vol_offset; } __packed; struct bt_vcp_cb { @@ -167,7 +171,7 @@ struct bt_vcs { /* Contains local bt_vcp_db */ struct vol_offset_state { - uint16_t vol_offset; + int16_t vol_offset; uint8_t counter; } __packed; @@ -705,6 +709,11 @@ static uint8_t vocs_set_vol_offset(struct bt_vocs *vocs, struct bt_vcp *vcp, return BT_ATT_ERROR_INVALID_CHANGE_COUNTER; } + if (req->set_vol_offset > VOCS_VOL_OFFSET_UPPER_LIMIT || + req->set_vol_offset < VOCS_VOL_OFFSET_LOWER_LIMIT) { + DBG(vcp, "error: Value Out of Range"); + return BT_ATT_ERROR_VALUE_OUT_OF_RANGE; + } vstate->vol_offset = req->set_vol_offset; vstate->counter = -~vstate->counter; /*Increment Change Counter*/ @@ -971,7 +980,7 @@ static void vocs_voaodec_read(struct gatt_db_attribute *attrib, iov.iov_len); } -static struct bt_vcs *vcs_new(struct gatt_db *db) +static struct bt_vcs *vcs_new(struct gatt_db *db, struct bt_vcp_db *vdb) { struct bt_vcs *vcs; struct vol_state *vstate; @@ -990,6 +999,8 @@ static struct bt_vcs *vcs_new(struct gatt_db *db) /* Populate DB with VCS attributes */ bt_uuid16_create(&uuid, VCS_UUID); vcs->service = gatt_db_add_service(db, &uuid, true, 9); + gatt_db_service_add_included(vcs->service, vdb->vocs->service); + gatt_db_service_set_active(vdb->vocs->service, true); bt_uuid16_create(&uuid, VOL_STATE_CHRC_UUID); vcs->vs = gatt_db_service_add_characteristic(vcs->service, @@ -1048,7 +1059,8 @@ static struct bt_vocs *vocs_new(struct gatt_db *db) /* Populate DB with VOCS attributes */ bt_uuid16_create(&uuid, VOL_OFFSET_CS_UUID); - vocs->service = gatt_db_add_service(db, &uuid, true, 9); + + vocs->service = gatt_db_add_service(db, &uuid, false, 12); bt_uuid16_create(&uuid, VOCS_STATE_CHAR_UUID); vocs->vos = gatt_db_service_add_characteristic(vocs->service, @@ -1110,11 +1122,10 @@ static struct bt_vcp_db *vcp_db_new(struct gatt_db *db) if (!vcp_db) vcp_db = queue_new(); - vdb->vcs = vcs_new(db); - vdb->vcs->vdb = vdb; - vdb->vocs = vocs_new(db); vdb->vocs->vdb = vdb; + vdb->vcs = vcs_new(db, vdb); + vdb->vcs->vdb = vdb; queue_push_tail(vcp_db, vdb); -- 2.34.1