Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4394440ybb; Tue, 14 Apr 2020 06:31:04 -0700 (PDT) X-Google-Smtp-Source: APiQypLfFsCGrZioEp/vC95COyf+Ksn/AG613FE49yshi7OzrNzwkWphmmBpebTDLN9ywd3qCG0w X-Received: by 2002:a17:906:6444:: with SMTP id l4mr55581ejn.313.1586871064332; Tue, 14 Apr 2020 06:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586871064; cv=none; d=google.com; s=arc-20160816; b=JHrOO1QT8rwviJdFRZSJ5SunTakByNrdK+qrXP6o4u5UV3EBxN4TTBmNMv44T9sz68 LOV16Nur9iS6YbJZrvAKqBqDYdZY6WEy3587eYLm13qfat9VQiJlsOcQHBERIdiwSJB3 ev4VweZywdW9fTwCPc83Ysm/JYCKpB3mV5V8Vf79QVBuuJMveulW+7mnzCUsqmlUw5j6 J+HFARCLR9R3dExrwQlnotPWjbmLvz6pwefRwzilv7CXIv7/5LJBsVzttmtJ9C1livVi mSDl7eXTzRWlI7VRJNQcJLHbGSErarP5EJTvyV5bl3KGqb400svo/bCMf8vTeGYNh6y9 C5Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KXwsEvmr3zGzp5z62Z8VdqltGux3+eny0IvNqgRcTnU=; b=Pw3o8TGyl9ERskGr9ZxMeSDbeNmkS7E2Gfd3ESi0CLyhS1hogg4/HNF8Q+lq6S4IjP O8DPmSqj17ODDF2Zkf+WCQS9ApRAQPxQARWee0Gl+3ZygqOMiUVGmcog5QuHgh2cTLsB M849e2KPIJ2nEHJZWuPK9wRcNoa/GOgH0Hb9u1eF6Oc5n5WWMTirQmJNK0mosxvNLW9V DAm1siDnCX42o9YFqV8dQ2/E4rZ72fNNHX3H9wnqHiE8tqzoVaCV7ELymKdpZRk5e6Y4 1dsc4ysr55hFo4E5WsgLHH0GDTC9XrdtNIYS96AtOdOHydmtHoJkfpFDKmj8xLzVFBrd TzKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CtiE5hRF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si2391668edq.21.2020.04.14.06.30.38; Tue, 14 Apr 2020 06:31:04 -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=@gmail.com header.s=20161025 header.b=CtiE5hRF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387995AbgDMTl6 (ORCPT + 99 others); Mon, 13 Apr 2020 15:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387935AbgDMTl6 (ORCPT ); Mon, 13 Apr 2020 15:41:58 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA498C0A3BDC for ; Mon, 13 Apr 2020 12:41:57 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id k133so7670070oih.12 for ; Mon, 13 Apr 2020 12:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=KXwsEvmr3zGzp5z62Z8VdqltGux3+eny0IvNqgRcTnU=; b=CtiE5hRFygjNEShiapvKBGhx5Ikn19Ye4Vy4AXvB8Qm5ukugEavm4fM4L+3yDSIOFZ 4iM0SgEvwzvEwfs1q/CUmKHNzrCdUpWJ9OgylQ4sCcRAaGLwfawZDDXm+Q9j1ehzAnSR lmchqN3k/2rkZP/YeDFzRKGBMLPx5WsayVoqCd/GCGg7+vSABNfg+FszZbup+Q7Pqd97 hso0z9TCK/0mPwLCsnQWP9cgnoBQZLpPYxOkwKT2VMqctdFjjVBYsAwm0ChYx3HXwuJC x8DcGGjaZolKpYLIPVIpCYcsgq8oWh4q+6RWK5uVaTkmMRRFi7rKE/Lj/fkH6P29VMud rXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=KXwsEvmr3zGzp5z62Z8VdqltGux3+eny0IvNqgRcTnU=; b=b1FbQfLLSnjQUFTOguCYZ7qd49S0G/Hirj9YH8bfCuPULqUsZfIlvmxnYSM2DdQ1AT sONWlIlGvYaaYy1azq/TYe2KN/ePJoPIj9UKptEx1qVs9rT9KBz6DEws1UEPbk4D0fmj 3/Nv7etS7PIyhUFAOwdGYEPWv6Kxtvl+6aJzmzfHp/ROPyUQ1V5sQriEzvRUGK6FUGn1 HQ/qB2RK0GvBpQFADKAXh6jms11he38choxZqXtoz44jJ+WLuQMr5L/8U1Xs/421EBWT tKaF2pbDxQyE3XQJauPzg3Xq1GMxKuv3dPS50qx+JOL2MAofQwaadh4J3ImW1T2md8gW cNdQ== X-Gm-Message-State: AGi0PubBiYvTNPwsww5zsSWhA8tegiRdbKnXxbzFu7LxLR+TgnM8xASr HBNjQuuH+4NS+82Hb7FeQkW1vMXo913ZqUpNopecH9mi X-Received: by 2002:aca:f584:: with SMTP id t126mr11133964oih.108.1586806916899; Mon, 13 Apr 2020 12:41:56 -0700 (PDT) MIME-Version: 1.0 References: <20200321195404.fvyku5hmcuqxt7sg@pali> <20200413162513.2221-1-pali@kernel.org> <20200413162513.2221-2-pali@kernel.org> <20200413165206.xluhkwi76cfpiv7z@pali> <20200413171722.ilawhisu67onrifn@pali> <20200413175833.di53ucocat5tdrke@pali> In-Reply-To: <20200413175833.di53ucocat5tdrke@pali> From: Luiz Augusto von Dentz Date: Mon, 13 Apr 2020 12:41:44 -0700 Message-ID: Subject: Re: [PATCH 1/3] src/profile: Distinguish between zero-set HFP AG features and unset HFP AG features To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: "linux-bluetooth@vger.kernel.org" , David Heidelberg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Pali, On Mon, Apr 13, 2020 at 10:58 AM Pali Roh=C3=A1r wrote: > > On Monday 13 April 2020 10:47:04 Luiz Augusto von Dentz wrote: > > Hi Pali, > > > > On Mon, Apr 13, 2020 at 10:17 AM Pali Roh=C3=A1r wrot= e: > > > > > > On Monday 13 April 2020 09:58:34 Luiz Augusto von Dentz wrote: > > > > Hi Pali, > > > > > > > > On Mon, Apr 13, 2020 at 9:52 AM Pali Roh=C3=A1r w= rote: > > > > > > > > > > On Monday 13 April 2020 09:44:14 Luiz Augusto von Dentz wrote: > > > > > > On Mon, Apr 13, 2020 at 9:25 AM Pali Roh=C3=A1r wrote: > > > > > > > @@ -1750,15 +1758,19 @@ static int ext_disconnect_dev(struct = btd_service *service) > > > > > > > static char *get_hfp_hf_record(struct ext_profile *ext, stru= ct ext_io *l2cap, > > > > > > > struc= t ext_io *rfcomm) > > > > > > > { > > > > > > > + /* HFP 1.7.2: By default features bitfield is 0b00000= 0 */ > > > > > > > return g_strdup_printf(HFP_HF_RECORD, rfcomm->chan, e= xt->version, > > > > > > > - ext->name, ex= t->features); > > > > > > > + ext->name, > > > > > > > + ext->have_features ? ext->fea= tures : 0x0); > > > > > > > } > > > > > > > > > > > > > > static char *get_hfp_ag_record(struct ext_profile *ext, stru= ct ext_io *l2cap, > > > > > > > struc= t ext_io *rfcomm) > > > > > > > { > > > > > > > + /* HFP 1.7.2: By default features bitfield is 0b00100= 1 */ > > > > > > > return g_strdup_printf(HFP_AG_RECORD, rfcomm->chan, e= xt->version, > > > > > > > - ext->name, ex= t->features); > > > > > > > + ext->name, > > > > > > > + ext->have_features ? ext->fea= tures : 0x9); > > > > > > > > > > > > I wonder why you didn't just initialize the features wiht 0x9 i= nstead > > > > > > 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 th= is. > > > > > > > > > > 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 t= o have > > > > > always a flag for checking if features were provided or not. > > > > > > > > Im not following you about the remote features beinf different, I > > > > though both would be could be initialized in the same way and then = if > > > > we read a different value from the SDP record we just overwrite it. > > > > > > But in this case we put these default remote features to HFP DBus age= nt > > > like if they were specified in SDP. Default value is specific for > > > profile version. And if e.g. new HFP version defines a new bit in > > > features with its own default value then HFP DBus agent would not be > > > able to distinguish between state when remote device did not specifie= d > > > any value (as bluez will put there some defaults) and when remote dev= ice > > > specified same features as bluez has defined in its current default > > > value. > > > > Different version may have different defaults but we can initialize > > them correctly. > > But we do not know default values for future versions which have not > been released yet. There would be a problem if user run current > bluez daemon e.g. in 5 years when new version of HFP profile would be > released and remote device would use it. We would have to match what is the features that the agent can handle. > > > Before and also after this change remote features are not send to HFP > > > DBus agent when they were not specified by remote device. > > > > > > After your suggestion HFP DBus agent would not be able to check if > > > remote device provided features or not. And this is I think a > > > regression. > > > > I don't think we can consider a regression to always provide features, > > besides what would be the reason for the agent to know if the features > > were from the SDP record or they are auto initiliazed? > > Autoinitialized for which version? Bluez has currently defined default > values for HFP 1.7. But DBus agent can register HFP profile also for > version 1.5 or also 1.8. > > To which value should it be autoinitialized when remote device announce > that is in version 1.8 but does not specify features (=3D default for > version 1.8 should be used)? The only option which make sense is to not > autoinitiaze this value as version 1.8 was not released yet and now we > do not know what would be the default value. We should probably use the mininum version of the client and server, so if the device supports 1.8 but our agent is 1.5 it should default to 1.5, this actually would have to be done anyway because othewise we would make agents duplicating the logic of handling the features properly so we might as well try to consolidate this on the daemon and only expose the features that can actually be used in the session, that means the autoinitilize logic the to take into account both the device and agent version. > > I that was > > really necessary Id just dump the whole record as a ServiceRecord > > option and leave it up to the client to parse it. > > > > > > > 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" > > > > > > > > Don't bother with default that are 0x00/false, we can assume this i= s > > > > implicit when allocating the memory everything is set to 0 so these > > > > defines wouldn't be needed in the first place. > > > > > > > > > Or do you prefer different names? > > > > > > > > > > > > > > > > -- > > > > Luiz Augusto von Dentz > > > > > > > > -- > > Luiz Augusto von Dentz --=20 Luiz Augusto von Dentz