Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4416869ybz; Tue, 28 Apr 2020 10:56:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLbqF5B/uVLR50woji4QViz0WCegf0g2GEuCpTd1/SA/SKGRzcLBIUR2Sb0bL+Ci2hodvg3 X-Received: by 2002:a05:6402:1713:: with SMTP id y19mr24645977edu.40.1588096611018; Tue, 28 Apr 2020 10:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588096611; cv=none; d=google.com; s=arc-20160816; b=UCoRwMD1oA4L9BCkipfYG8IRItLtPm4IrjtIPcpnckMTuniHN2qfTXK0YFKmVz3K4W uR4kd60Si5X0nSERjQpFToxe7ovt8x5ylmqXMmIXN9sfVDMxL8zPWab3aT4UYuKHzpk9 80sjVGkoMw+LvqNXreEKjWkN9jqKYc5NZo4v6jSUBrM5bqaG7oij6ZwceEVT4Zezj9se exuHmJsoFX+bJe+UlryK8WEUINNnanT8sIGL/pSW/nEqcRQ84cm0LILeE7cLlmp+ZPev 5ZeN+nT7+/hUy504PElQGvuTV6s1Cd56oDGZacUwjGxFNby7K3b5psTtj9pCioVObBgy l8wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=f0R4VBXhG00iRCTNKU5rfxSTUew8qyZojpFpvIc0vC0=; b=ib+QhN6U2m4b9C96oMoyQa9rZad8WU2l72tRtfzbjn9gWiOYKY0vMMoCztSgikENN9 c6RfUFQGqgOG1la6Lc/qrG/GFaZZrTBUX2gL5QSGkiRmaJCApWIbpzIDX9wOHDN/j4Zd FjO0Ny8NVZ/tT0kvdBuYhnBE+zbqmvjbw2MpijkZl+bSHnfxQFxG/DcJJgB8iconJ+tb bM/8JDzJEpMF2dS62bRJXH/caYIm3cmuQoqkg2RGXx6FU22C/TsF1R8j8XZ8sauwLvK6 KcKLc3l3U1gE15bMVLN/FSC31t7YQ9zTSF6pmv7cblUvSoMHdhdWw1p2feszh/uRSeuz o5JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=RQFy+vMn; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si2319550ejz.518.2020.04.28.10.56.07; Tue, 28 Apr 2020 10:56:51 -0700 (PDT) Received-SPF: pass (google.com: 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=fail header.i=@lechnology.com header.s=default header.b=RQFy+vMn; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728694AbgD1RwU (ORCPT + 99 others); Tue, 28 Apr 2020 13:52:20 -0400 Received: from vern.gendns.com ([98.142.107.122]:60664 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728426AbgD1RwU (ORCPT ); Tue, 28 Apr 2020 13:52:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=f0R4VBXhG00iRCTNKU5rfxSTUew8qyZojpFpvIc0vC0=; b=RQFy+vMnq3cSL0329WWbCyqAUg gl0n84n1OhblmpCjlkBZSsQI3VjG5LOCQZQBrSEExw4CksjWB2yCNdzNJPGgDtrwznWKAo0J5SWsb o9fOo7Gpq8hH1+ndkv2IZV7Gmgy//rst9PRq3wRM5ioR5mCvLYhW86UtRgpO3qyD7HTDvjN/apycL xRDN/JCA8lAhVDAijXM0EVSLTtc2rFpnsJKq5AD1Qg7CYuvt1BucGl2kVBDFZcD8P585ffyicVrTm GHkU7AlP4LJCgwZT5stHVpwIGXx/k3neoSOG8O+Yz1BBPHpNKkLx3nfXQ0gTlV2+hGXwbecN0WeW5 Se6i9P+w==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:39964 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jTUP3-0008Uf-Oe; Tue, 28 Apr 2020 13:52:17 -0400 From: David Lechner To: linux-bluetooth@vger.kernel.org Cc: David Lechner Subject: [PATCH BlueZ] src/gatt-client: allow "command" even when property not set Date: Tue, 28 Apr 2020 12:51:49 -0500 Message-Id: <20200428175149.1784-1-david@lechnology.com> X-Mailer: git-send-email 2.17.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This modifies the GATT client characteristic WriteValue D-Bus method to not check that the characteristic supports the requested type of write when the "type" option is set to "command". Before this change, if the "type" option was used and it was set to "reliable" or "request", then BlueZ would attempt the write even if the characteristic does not support that write type. On the other hand, if "type" was set to "command" or was not specified, the method would return a org.bluez.Error.NotSupported error without attempting to write. After this change, the WriteValue method will consistently always ignore the characteristic properties and attempt to write when the "type" option is used instead of having a different behavior for the "command" type. --- Related discussion: https://lore.kernel.org/linux-bluetooth/685ddf1b-c824-9c45-298f-97b70cbf975f@lechnology.com src/gatt-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index a9bfc2802..20c3fbec2 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -1050,8 +1050,8 @@ static DBusMessage *characteristic_write_value(DBusConnection *conn, return NULL; } - if ((type && strcasecmp(type, "command")) || offset || - !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP)) + if ((type && strcasecmp(type, "command")) || offset || (!type && + !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP))) goto fail; supported = true; -- 2.17.1