Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp824802ybl; Sat, 18 Jan 2020 11:50:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyDuvIYcJfJ3b0V3zBffP8L+Qoehd9YeH7MwgZnXKT+fugVIYA1p/tDwm85Gtdq9aEH5Js3 X-Received: by 2002:a05:6830:10d7:: with SMTP id z23mr10713577oto.114.1579377023986; Sat, 18 Jan 2020 11:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579377023; cv=none; d=google.com; s=arc-20160816; b=MQa4UnM/F31VOIPEmKaJGdhz8zSTu//BPTFyEu6C//HH6TsHLlXmHHoh1Sv7qbA66O i0hf6yDkONrXZxnIHCCojOCPse3YX0Zo3aV3BIuHI49kJZz1+cuT4sY9qEhlEsxWZZOD QLOBCe1w7CDJqQyxKfKa9JHFrH0xd6asNurpsWOR5/xsiq9aPEBYWZqUBI0FckqE2uI8 uTzUetsC6yJIYXo100jM7iUQgyMgHLpEA242wntjBFE3KbVyCuG8I/hjgJPX/1HNpfu/ g6AhL1IVrv997gunVQO/kCTkOcwG1wQcKLfBwfz1y95QiPN+UllZ55s9eMJqREhRuGrf 4Gww== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WuskuInYv7N8uJRw5NS75RZA2eDShoZ2nwXfzXtCKAg=; b=H4FBj/xaBdGKFMu9zBTyTbunzJDzN2qRBrK8DFnJXYDlorSz8bQ/ahzsB2xye4ZCfb QlJfepnlTekL5wB+Y2cYrWhspUM3AR3XjMRB8xaBGCcY1cXyWCSKOt4EAhaX/lKKyojq JoPZxOJoXBFQv+C3dtWCRxfFLFP9MMaLiZ2K8zeQCad6MFEWHSDLNxKxXdYUn9iRfF1g PE4aQNCqS7pxxnONp2/NMi6zmn/O7mJOn/YswgQ565H9BSjFyFRTnuFCT66kCk1yDxRO gjJo/xqK3fhQdyR3RTrRO6X1hEVJweTgi2gw8osYS2V2NTZaQGihJQvp1dan5FkCobrm gcsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M+XzbOso; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z1si17626429otq.21.2020.01.18.11.49.52; Sat, 18 Jan 2020 11:50:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M+XzbOso; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1726957AbgARTtt (ORCPT + 99 others); Sat, 18 Jan 2020 14:49:49 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:34656 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgARTtt (ORCPT ); Sat, 18 Jan 2020 14:49:49 -0500 Received: by mail-wm1-f65.google.com with SMTP id w5so11837104wmi.1 for ; Sat, 18 Jan 2020 11:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WuskuInYv7N8uJRw5NS75RZA2eDShoZ2nwXfzXtCKAg=; b=M+XzbOsoQ3mQ596Nds6VJrYmPzzOsOGMqckmM7Cx8xTox8fgWbp+tRW7SdrncH2isp 0yaH175HxVUFbDtRFPs8bFdRJRTQ9LXBc8saz4l2TVhxFTW8W17MDv/HUnwG+X0AuHBR OvotqEdXWFSvj3LwQRPmq4POvaEzya1fjxpfLuDjLbBFzaLW5eNe8z+/Nov2EXJ4+KXT KibRuD5CAP91H455PmfoKa/iblD+P2yoBeo21c3VyqUKnGLvgmWMkQZ32PFjYiINByzY 7iXVQ3fAA0R7+FVyxvDcPYf53j1aOcfq1gj4Ev/i4u32o51QgDLEDAHFXLda+2veUCSd B+yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WuskuInYv7N8uJRw5NS75RZA2eDShoZ2nwXfzXtCKAg=; b=XdGvt1GD2GEZmBCczI+IMKcRPuzfpUY4UWtMC8wYS1Q6TKHZ+1FC6BFmiPP64ArZ/3 B5kVQacmIeMLd42BXE3hNWMNM6ML/Nk6DL091Lm1KVIjPncgPOvdwr2TiOfa9qMMSo0T gnDkx/reIX0P147jZuF7G9cAZ4lHqGuuFv5+8EVyqHfiLVQ828uOGS4suP/3LQRa19d9 01yLgSsQcV2gC4H8RhRldNpZPbHu4WkSIzhuiaGUfvo/OHZSGTHe3kj9+Y/pE0YTEBgn c2w4532i6TN0VEZwYO/Sq53FaNxjEHKzEuSIwNeQj31ZA9gx/sXP9N4fWreu3q5xLkuk 4Svw== X-Gm-Message-State: APjAAAUdnByu4omu01C6Hm2PLtX3Y+a0tPuldGyIpaQ3hCqNlrnFv0dQ EDBY0n5YtwdLzbq6+OLit1ItNcWe X-Received: by 2002:a05:600c:2046:: with SMTP id p6mr11074331wmg.110.1579376986471; Sat, 18 Jan 2020 11:49:46 -0800 (PST) Received: from Marijn-Arch-PC.localdomain (94-209-165-62.cable.dynamic.v4.ziggo.nl. [94.209.165.62]) by smtp.gmail.com with ESMTPSA id l15sm38210681wrv.39.2020.01.18.11.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 11:49:46 -0800 (PST) From: Marijn Suijten X-Google-Original-From: Marijn Suijten To: linux-bluetooth@vger.kernel.org Cc: luiz.von.dentz@intel.com, Marijn Suijten Subject: [BlueZ PATCH] audio: avrcp: Ignore peer RT supported_events when being the RT. Date: Sat, 18 Jan 2020 20:48:41 +0100 Message-Id: <20200118194841.439036-1-marijns95@gmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Marijn Suijten Remove the check of a received event against supported_events in avrcp_handle_register_notification, which is only called when BlueZ is the RT even though supported_events is only valid when BlueZ is the TG. supported_events is assigned in target_init with events that the corresponding RT on the other side of the Bluetooth connection supports, to ensure the local TG will never report anything unexpected in avrcp_handle_get_capabilities. This value is specific to what the target should support to be compatible with the peer RT, but a locally running RT has nothing to do with the external device being the RT. This addresses the case where Absolute Volume notification registrations are rejected when audio is played from an Android device to a computer running BlueZ. The Android BT stack report an RT of version 1.3 [1] which does not include Absolute Volume support. The RT on the Android device is not involved in such a playback session, instead the computer is the RT and the Android device the TG. This has been tested by disabling registration of the RT service in Android, to make the device a "pure" media player that cannot receive audio: target_init does not get called and supported_events stays 0 which would have caused any notification registration to be rejected in the above case. [1]: https://android.googlesource.com/platform/system/bt/+/android-10.0.0_r25/bta/av/bta_av_main.cc#712 --- Hi, I have a separate patch lying around that - instead of removing supported_events - splits it up in two variables; one for the target and another for the controller. Let me know if this extra safety is desired. According to the AVRCP 1.3 specification GetCapabilities is mandatory, which I have included in that patch. However the documentation also mentions that this function is only supposed to be called by the CT meaning that the call in target_init (introduced in 27efc30f0) is not valid. What is your view on this? Unfortunately even the small pair of in-ears I have lying around report AVRCP TG functionality while they are not nearly capable of being a target/media-source, so I have not been able to confirm how a pure RT device would respond in such case. - Marijn Suijten profiles/audio/avrcp.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 7fb8af608..820494d2a 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -1529,10 +1529,6 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session, if (len != 5) goto err; - /* Check if event is supported otherwise reject */ - if (!(session->supported_events & (1 << pdu->params[0]))) - goto err; - switch (pdu->params[0]) { case AVRCP_EVENT_STATUS_CHANGED: len = 2; -- 2.25.0