Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4387395ybb; Tue, 14 Apr 2020 06:23:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIsszpz6uYvhiK0N1bWsr8Jzt7h4eTlq2UO9hcMjUPN83s8tTj7i0yhWw7uSp84mV+J249p X-Received: by 2002:a17:906:3289:: with SMTP id 9mr102003ejw.130.1586870581881; Tue, 14 Apr 2020 06:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586870581; cv=none; d=google.com; s=arc-20160816; b=skAWCxm1PmP3pq5VxmBsZa1hRDaGsbJFSLp/Dafe6f7oPw/6mhOJT6nUcDC7eKrPFk 8eIPCdofB3m6cb5RJOFtVGpuxoK/VOG4OQBCCPjFy/KG+B+LquFxx1dGCIjmQGpkFG9t RqzI0mLNeKZS0/PZFm/ZKlYsxdG1YcSvX9YkPedvhkfA5olKYCX8V7kwr9hzAvgYJGOY 6y3pGeqA95uod+BjNiAZVi91kpAh4O1Y4WyP8DLZIQT5Zp7rSnayijxWeyz6obnFBfDW ViPWnh4H4s+Iu8ap/r1iAkW0IbJhSE9rGzUCn7RDMnvoVdPv0N/A7zlQu42vbRR2B0ot ZSYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bD8OOxQSkhm1djvffC43ApSw9FDhdLdKttGhd815JLs=; b=fHSS8cbRPDbfGyJoLxkpsFRFU6eJpOJKqVrfWoFJwXBIgYOVDcBOk7DjWx49JeiLZ+ GXpaYrJSSx/aiJv4NZ4+gOdJMEHqszhVCTnhieJs3kmiDXEU6rV1lHKrqXnuq5enllNO RbevEpnvYjRZ+QTEucCoIzpDVhgKR13oSY2VXrykon+48ZdCoj8n8rhecvABwrVRFZL5 09zqpZ4fUSkjFiBIUVn3SSd4CweK+oawR2Uw3sP/7tE1I67dCRI/dzkejyuK2wdc4wAg Eo6vqgbgaWY1kTr5QXLRdPzHcKkZlKaVxIyiX4RyImGLTb/BxkclwH0eu6p54hgUq8fF 56yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U2yn9Q1e; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si8338577eje.513.2020.04.14.06.22.37; Tue, 14 Apr 2020 06:23:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U2yn9Q1e; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731832AbgDMQwK (ORCPT + 99 others); Mon, 13 Apr 2020 12:52:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:43304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731759AbgDMQwJ (ORCPT ); Mon, 13 Apr 2020 12:52:09 -0400 Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D02A20739; Mon, 13 Apr 2020 16:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586796728; bh=pTtx7jrQuuTSyduuJyBYmmbOSwvefc7wAJXX7xNe8eo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U2yn9Q1eX7lsFrvg0/qwY/qQmc86UIUeP8ToPOQHzkba7aOXSC/ZzM6KTXaWSYnnG CG4GrGfo4S3Ad5vDnTmyZ8Bq48+0u/wp4XiKcVgejN8i1P0CZRy1w+mKzVZJbDOX1P 3yVt0BNWa2/rdjsauT67gEX320HkKC/IC+WDAGzw= Received: by pali.im (Postfix) id 85D57895; Mon, 13 Apr 2020 18:52:06 +0200 (CEST) Date: Mon, 13 Apr 2020 18:52:06 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" , David Heidelberg Subject: Re: [PATCH 1/3] src/profile: Distinguish between zero-set HFP AG features and unset HFP AG features Message-ID: <20200413165206.xluhkwi76cfpiv7z@pali> References: <20200321195404.fvyku5hmcuqxt7sg@pali> <20200413162513.2221-1-pali@kernel.org> <20200413162513.2221-2-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Monday 13 April 2020 09:44:14 Luiz Augusto von Dentz wrote: > On Mon, Apr 13, 2020 at 9:25 AM Pali Rohár wrote: > > @@ -1750,15 +1758,19 @@ static int ext_disconnect_dev(struct btd_service *service) > > static char *get_hfp_hf_record(struct ext_profile *ext, struct ext_io *l2cap, > > struct ext_io *rfcomm) > > { > > + /* HFP 1.7.2: By default features bitfield is 0b000000 */ > > return g_strdup_printf(HFP_HF_RECORD, rfcomm->chan, ext->version, > > - ext->name, ext->features); > > + ext->name, > > + ext->have_features ? ext->features : 0x0); > > } > > > > static char *get_hfp_ag_record(struct ext_profile *ext, struct ext_io *l2cap, > > struct ext_io *rfcomm) > > { > > + /* HFP 1.7.2: By default features bitfield is 0b001001 */ > > return g_strdup_printf(HFP_AG_RECORD, rfcomm->chan, ext->version, > > - ext->name, ext->features); > > + ext->name, > > + ext->have_features ? ext->features : 0x9); > > I wonder why you didn't just initialize the features wiht 0x9 instead > of adding a flag to track it, btw add a define with value 0x09 like > HFP_DEFAULT_FEATURES that way it is clearer why we are doing this. This function get_hfp_ag_record() is for parsing local features. You are right that for local features we do not need a flag to track it. But flag for tracking is needed for parsing remote features. And to have unified code for storing local and remote features it is easier to have always a flag for checking if features were provided or not. I can put these default values in profile-role specific macros e.g.: #define HFP_AG_DEFAULT_FEATURES 0x09 #define HFP_HF_DEFAULT_FEATURES 0x00 #define HSP_HS_DEFAULT_VOLCNTRL "false" Or do you prefer different names?