From patchwork Thu May 21 18:00:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA5CC912 for ; Thu, 21 May 2020 18:01:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 905B5207D3 for ; Thu, 21 May 2020 18:01:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="P4TQsLj1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729187AbgEUSBX (ORCPT ); Thu, 21 May 2020 14:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728888AbgEUSBX (ORCPT ); Thu, 21 May 2020 14:01:23 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3997C061A0E for ; Thu, 21 May 2020 11:01:22 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id a13so3141945pls.8 for ; Thu, 21 May 2020 11:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=MFO+E2oPIKbUN1g/6GJpK5+R9fJDP4WX5hJngZf8lr4=; b=P4TQsLj135jzfjxhtahY1DB3XLGHr3C8lrmyWCh7QkvdL4d++UF0DJr3tzlhHznGId gdPPqX3/K8VFNVJsOVX9uOMfR6J8X2BIDjVdXDDGItkkBJxiBJMIE9O/+bmGUhhhFje9 7YQ7NDW+6DAxS8F2l0f0Bl9exHUtqiZUgLBd0= 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; bh=MFO+E2oPIKbUN1g/6GJpK5+R9fJDP4WX5hJngZf8lr4=; b=dRe8bb1HC17IEl1VkJ8hwkuzx4/JCU23rLNO0uo5VcUh1icnSrXWZSKlkHLdojz0hz GkenWyL50YBT65tlqNn7LdYT1x6nssyqKLRfACe8Eh3DxrvbVrovyo6sG6p6sHmlrre2 SaU7RC4m8WW4JokHylNOutbFoXrwbY3tamUXtmb7u/J/7qt7Y4BENil1pWhHTVjx8bvU KS/MhlaiNb9EiEd1lec5wGs5huqo8bDtGGuF6+0CX2Txo+NUPQbTqe6nXje4t/Iuaqv0 YGjLSf4efsIjpB1HrB9E0BLRYKaL+MeIuKMessm1xZvO0yQCwR4Vz46Ihdmfh4AmluI3 sXAQ== X-Gm-Message-State: AOAM5328naDDJrTNLIQI9+IJfTpBZOrmDdJKQOiR+qQDAjrdyIp27Z2Z rEMEhfy2ZC9ihOaaKJtB9MGyfBWyQOw= X-Google-Smtp-Source: ABdhPJwMVhLMtUqunRLnVo18ls/dW2cdYfdW16jnj4Ws6y9qS/CytKjlpv0g9KL1bZ077ZLLImKcug== X-Received: by 2002:a17:902:7281:: with SMTP id d1mr11172693pll.78.1590084081233; Thu, 21 May 2020 11:01:21 -0700 (PDT) Received: from localhost.localdomain (c-73-231-41-185.hsd1.ca.comcast.net. [73.231.41.185]) by smtp.googlemail.com with ESMTPSA id h4sm4845975pfo.3.2020.05.21.11.01.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 11:01:20 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Eric Caruso Subject: [PATCH v3 1/3] device: Add device type property Date: Thu, 21 May 2020 11:00:59 -0700 Message-Id: <20200521180101.8223-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Eric Caruso This allows us to gather information about whether a device supports BR/EDR, BLE, or both. It appears as DBus Property "Types" on the org.bluez.Device1 interface. --- src/device.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/device.c b/src/device.c index 7b0eb256e..2b5a7f2e8 100644 --- a/src/device.c +++ b/src/device.c @@ -745,6 +745,32 @@ static gboolean property_get_address_type(const GDBusPropertyTable *property, return TRUE; } +static gboolean dev_property_get_types(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct btd_device *device = data; + const char *type; + + DBusMessageIter array; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array); + + if (device->bredr) { + type = "bredr"; + dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &type); + } + + if (device->le) { + type = "le"; + dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING, &type); + } + + dbus_message_iter_close_container(iter, &array); + + return TRUE; +} + static gboolean dev_property_get_name(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -2759,6 +2785,7 @@ static const GDBusMethodTable device_methods[] = { static const GDBusPropertyTable device_properties[] = { { "Address", "s", dev_property_get_address }, { "AddressType", "s", property_get_address_type }, + { "Types", "as", dev_property_get_types, NULL, NULL }, { "Name", "s", dev_property_get_name, NULL, dev_property_exists_name }, { "Alias", "s", dev_property_get_alias, dev_property_set_alias }, { "Class", "u", dev_property_get_class, NULL, From patchwork Thu May 21 18:01:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563703 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0BF8912 for ; Thu, 21 May 2020 18:01:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF716207FB for ; Thu, 21 May 2020 18:01:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Az8o8PIW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729196AbgEUSBZ (ORCPT ); Thu, 21 May 2020 14:01:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728888AbgEUSBZ (ORCPT ); Thu, 21 May 2020 14:01:25 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CB3DC061A0E for ; Thu, 21 May 2020 11:01:25 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id ci21so3469493pjb.3 for ; Thu, 21 May 2020 11:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GmaJF7nOa6Y9+nFEhxxc6SRQTQCSt7W0TAl3VOq5HbE=; b=Az8o8PIWEGNe7/ZkB7OUnsRaDV9kZ4IEHQWk341yuIG0MDkxrpfQDUjK46pkbBLz3a IIJjjEtNF56d7EJrO/vQLnfyXYkUJpdabFoWYbCJ/hotjWHICwFx7eAiwqffZkTu//8S 9UDuXbeUdahkp5ukRmdLxl4+eBA1kmthcWjpg= 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:in-reply-to :references; bh=GmaJF7nOa6Y9+nFEhxxc6SRQTQCSt7W0TAl3VOq5HbE=; b=nO2tDxixBlbWSQAB8CcAYftXEc9nBXOGlDbpxwXEQTObdTkS16zQhlWQ1xAzWBQ1TV e0orZxyHCcJJVnJxPNIPuqbRW1NZFCxgtkUJOvisn8UC6PKK8jtlnTdrJ6LYBltyZoAH oiFaJJyDfFCqZzIHX+Xr7M539fjltY7J7mVgahg46I8mcxqMB4uTLUU2ETOxtYjUqFZs DuovH9r2GOHwR4wwTMIx6OAON4p44SSMDARfX7ZRmfhYNHrEICbLDkhW6tiN/2W6bRiS 3OwR2GBH9BZuVOsq4pBst0G1KXP4oikqTYYH0oFXsilX9Hv7ca+A9oAxxJfE6WHATRPW Z2Cw== X-Gm-Message-State: AOAM531urkWZdqolEcOJVxqcUU23OQWQnE2WeuUD1OmmVE+R4fkHKOQz vn/bRtdI7iecuZjRgDy8QA09Jdcv5sY= X-Google-Smtp-Source: ABdhPJy8yr4ToZxSciNJg88AbEiAJoJsvqLnhe/ngOawYlQoPKgCjtn23Cp0F6n7jk3BtGwkUPF2VA== X-Received: by 2002:a17:902:690c:: with SMTP id j12mr10982032plk.5.1590084082602; Thu, 21 May 2020 11:01:22 -0700 (PDT) Received: from localhost.localdomain (c-73-231-41-185.hsd1.ca.comcast.net. [73.231.41.185]) by smtp.googlemail.com with ESMTPSA id h4sm4845975pfo.3.2020.05.21.11.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 11:01:22 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH v3 2/3] doc/device-api: Add Types property to org.bluez.Device1 Date: Thu, 21 May 2020 11:01:00 -0700 Message-Id: <20200521180101.8223-2-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521180101.8223-1-sonnysasaka@chromium.org> References: <20200521180101.8223-1-sonnysasaka@chromium.org> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- doc/device-api.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/device-api.txt b/doc/device-api.txt index 65d8fee37..32a146321 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -137,6 +137,11 @@ Properties string Address [readonly] "public" - Public address "random" - Random address + array{string} Types [readonly] + + The core configurations supported by this remote device. + It can contain "le" and "bredr". + string Name [readonly, optional] The Bluetooth remote name. This value can not be From patchwork Thu May 21 18:01:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563705 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C92D4912 for ; Thu, 21 May 2020 18:01:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B128B207D3 for ; Thu, 21 May 2020 18:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BZ+QGpyc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729202AbgEUSB0 (ORCPT ); Thu, 21 May 2020 14:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728888AbgEUSBZ (ORCPT ); Thu, 21 May 2020 14:01:25 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A4AC061A0E for ; Thu, 21 May 2020 11:01:25 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id ci23so3448858pjb.5 for ; Thu, 21 May 2020 11:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6W8qc7zgMj7u+zWVK53n2ZqkCOak7mVuv8kyGS4iGmk=; b=BZ+QGpyceqYcev746zJuRRJfF+PxMlKijUNgZUnXKwTpkwFLz3mx0+IkyqCC7U7xmd lS7K4cxsgm6oaHd5Ybh4wqMVQlHh8BRexl5rAw2NNr77l8/Dnn3J2LqMY3ZXO4P13atS Vw4GLl/G44WCTJ4Bv+AOyY14ySQhtVgVpBg7g= 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:in-reply-to :references; bh=6W8qc7zgMj7u+zWVK53n2ZqkCOak7mVuv8kyGS4iGmk=; b=AMLnVfDQPmK8WzlV/igJzCQuz6sX4VSneLY00Pszz3jcK9IFBpnnpivIaPju5Ugw+R KEIkwzvnI1qwgHKsbDgkOcNEqdnUqeOyLph/Fno+F7p3T3tFPAoatVraFy+Hy3NfAkl7 VF3DKn1qgW+6rRX1DOmqJV/5hyOgR2xp/ChRXTqg3g3/fdy9cr1sLKtnRNYnyqX52osh py7w7IsMCGagLUkUxE+wbXSF+80Ukh4cghnAXfLR+jqv6SDmBoaKOxn7H5q1r/sKTC38 OV9wGIM6pDhQZ4i8F10n0cFOIIysj+9vV4dCGh1kB2v2ei2RnXVYbV+6Oe80zDEBNZWD 0csw== X-Gm-Message-State: AOAM532vjBqZyrKa7wm91xb3o8WRWvteMaRP3Dxet5wD2GO5Dp9ipGMI CmA+P4haiPutIB+6qDLl5JG0v0VYOyQ= X-Google-Smtp-Source: ABdhPJweLfSBekRY5zT+wMecHSe4O7AnxQo9qQXx79uAgKDVDhc6AorRemFElWoU0gMwN0uPE97qTw== X-Received: by 2002:a17:902:549:: with SMTP id 67mr10558426plf.115.1590084083820; Thu, 21 May 2020 11:01:23 -0700 (PDT) Received: from localhost.localdomain (c-73-231-41-185.hsd1.ca.comcast.net. [73.231.41.185]) by smtp.googlemail.com with ESMTPSA id h4sm4845975pfo.3.2020.05.21.11.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 11:01:23 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH v3 3/3] client: Print device property "Types" Date: Thu, 21 May 2020 11:01:01 -0700 Message-Id: <20200521180101.8223-3-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521180101.8223-1-sonnysasaka@chromium.org> References: <20200521180101.8223-1-sonnysasaka@chromium.org> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- client/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.c b/client/main.c index 422da5593..dd8c28cb3 100644 --- a/client/main.c +++ b/client/main.c @@ -1628,6 +1628,7 @@ static void cmd_info(int argc, char *argv[]) bt_shell_printf("Device %s\n", address); } + print_property(proxy, "Types"); print_property(proxy, "Name"); print_property(proxy, "Alias"); print_property(proxy, "Class");