From patchwork Thu May 21 17:55:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563681 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 D6A3B912 for ; Thu, 21 May 2020 17:56:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEA24207D3 for ; Thu, 21 May 2020 17:56:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DveW9sRL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728208AbgEUR4K (ORCPT ); Thu, 21 May 2020 13:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728013AbgEUR4K (ORCPT ); Thu, 21 May 2020 13:56:10 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404C8C061A0E for ; Thu, 21 May 2020 10:56:09 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id s69so3453448pjb.4 for ; Thu, 21 May 2020 10:56:09 -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=DveW9sRLz/phr8VwN/gRQ3taKZclG3hRRTbbvg371FgkivwF8znzKxmfXwq6qVSI2Y n/+I8htDqzMKG3tCCpRI0l7MmAOwDYyMRtXa0gwwUWuKZgbUJIge/gSZX7RMl66Kw6SZ h0I7BwcUQfM5GbYER+e5Ua+kRpfpa10jMByjU= 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=hxi68qhq4awbzNl7QaLf45aT/zCYh3Yv8/s+2hXDc4EfJuk6P4LDEkJrDBZNVgo92n v+vvqJBMOehT0XuPHqqFogj8HTIQAlw60+b7a4N+5Zc93KOdS5CQjhZaF4XDDSiaidpn JzB5TtUYz3Wf0MhLodiVHJ9du4W9UtJJGvmk8h9838ngeBndpLNWtztvL53j9f3425NB 8MAM5BxVflHg8hyojG7gOLe5YBTWxeKn2pFmbEUh3m0EAwsBkx/FZRQ9lVpb7B8UckT9 jlCg0gOYZX+x8uGzRT0ypIM3P9/uuivqPhahQV9MwqoMSTh8B/y6iHdpaPWL5Sajr5WN EAnw== X-Gm-Message-State: AOAM531AMbKJxMQHW9YEsIOxTYlZ/mD4MVwq7KKTv2jCHyUrz7bIHUr6 z4Emxn/j8BO5umAz06q2rwsqfsG8T3k= X-Google-Smtp-Source: ABdhPJyCmtWaGvUIeLgp9zWVtEzlLLaf8n8TDXIcXGs/Kl/KWj7zncfwiuW9jQKb8vs+MovAx5aWog== X-Received: by 2002:a17:902:b187:: with SMTP id s7mr11024512plr.60.1590083768465; Thu, 21 May 2020 10:56:08 -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 a16sm4881910pjs.23.2020.05.21.10.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 10:56:07 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Eric Caruso Subject: [PATCH v2 1/3] device: Add device type property Date: Thu, 21 May 2020 10:55:41 -0700 Message-Id: <20200521175543.7923-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 17:55:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563683 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 561C9912 for ; Thu, 21 May 2020 17:56:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34474207FB for ; Thu, 21 May 2020 17:56:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mGs+Mq4b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728975AbgEUR4O (ORCPT ); Thu, 21 May 2020 13:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728013AbgEUR4O (ORCPT ); Thu, 21 May 2020 13:56:14 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B563C061A0E for ; Thu, 21 May 2020 10:56:14 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id a13so3134517pls.8 for ; Thu, 21 May 2020 10:56:14 -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=/Z3lB2ps1Sz+hH9uANqYM5GmYI38A+1RffLNsWxLBxs=; b=mGs+Mq4b6FrrO8mownqel2X2HrQuI6o+WpxPUAnlJ370aidz3hkq3YNxx9WYEiHUV6 2ASanzagfwSkMo7O4wRpw2Suq8TNQK5reLIsCDCDqO76RQBc5/7RpVI6GpfcJLHVT8N6 nIvAy1sSJ1FNI/Vc6IbI3sVD3JEXN7KOK9PQE= 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=/Z3lB2ps1Sz+hH9uANqYM5GmYI38A+1RffLNsWxLBxs=; b=C65nP8UIgSYvXGT0RtXPstZgogwMRCRKC5rzYBGGPBV8znHSWoLJBlBhae8dBlsc5X sYSnFz4wR0wQ6VhJkfBozskuByJqTiVgfI/hYigrVNKMLCyIuhGQMrWPXAixfGYKFyc5 FdBQz2mfkEsPu6qKZVp2MHvH3o4nxA4QtMPWAvfShzbm3vrGm/rJ2IWrZw7C1tUoakyn SzTw+anmuMkBMYnW44WYk9YEGlTwPMrqKOFOlwCUE04DlZKRHeFWBO8IEWv1Wp21uEcK RjE5CYkaUSxZz+WPhtR8vEZCPIPhNhjHQ5/ZS/zblyFYt+QDLYeN1ZBAl6L+b4iC/ABT rdbw== X-Gm-Message-State: AOAM530PSXEw2ABSdnAQpu/d1/luv9uo5zr0Feloe0ueKzW6kKQUUuw9 Yqh7BHMdzrlc294lhqhLW0+stz3Z2aw= X-Google-Smtp-Source: ABdhPJxWYfFAUXQHpGtlPDk9NGs2z4LXK+hoyX8kGREBJLyBy4oH1DOTsnbNbW9yxnlT+AGHJCItAQ== X-Received: by 2002:a17:902:c403:: with SMTP id k3mr10841725plk.12.1590083773335; Thu, 21 May 2020 10:56:13 -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 a16sm4881910pjs.23.2020.05.21.10.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 10:56:12 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH v2 2/3] doc/device-api: Add Types property to org.bluez.Device1 Date: Thu, 21 May 2020 10:55:42 -0700 Message-Id: <20200521175543.7923-2-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521175543.7923-1-sonnysasaka@chromium.org> References: <20200521175543.7923-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..ceb68d2f6 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -158,6 +158,11 @@ Properties string Address [readonly] The Bluetooth class of device of the remote device. + string Type [readonly, optional] + + The carriers supported by this remote device. If it + exists, it can be one of "BR/EDR", "LE", or "DUAL". + uint16 Appearance [readonly, optional] External appearance of device, as found on GAP service. From patchwork Thu May 21 17:55:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonny Sasaka X-Patchwork-Id: 11563685 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 4A759912 for ; Thu, 21 May 2020 17:56:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2826820759 for ; Thu, 21 May 2020 17:56:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="IJya71+U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729067AbgEUR4Q (ORCPT ); Thu, 21 May 2020 13:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728013AbgEUR4Q (ORCPT ); Thu, 21 May 2020 13:56:16 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918CEC061A0E for ; Thu, 21 May 2020 10:56:16 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id r10so3518655pgv.8 for ; Thu, 21 May 2020 10:56:16 -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=IJya71+UeSfV9HFroYHqENIObrqpUwb+7P49kbkqDXvxumPykPBuHmg1U8k0KrffKq xMLR1KMjni977YlgMm4hzXcryUSl7d/NyV1Aa9ntmiqzApWGIhfMVLXxxjkrYwzST6GE Trvm0q/gKQkJAyQL6QtZVAP4BolBRWWltf8Kk= 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=hEqCSgDXYqiqOLeO42TRvzrFFAsmPl10MuVEck4xRfwiA4BpT8Kj007+A2wBox8UQB zfOM0VsGXbcV0C505Lyiy8qvaMVJJgdhu27fWG+0QknrtUAi6XKghF1bma0NLOLO/s7y BZ/T6rDoZ6ww9yMYpvc+oMymEm1z6gnVr/gjNGo+Wf9AK65RPe6T9Uq5VoqMesQiZhbP 0T/AdMJA0VA1ApLvUErOP+X006ewqYLdnoNFFWOXvscf9wjHM0oPBNbqwlzolbiR2HHz 5eRMGpNKA0Ypg7FVABV860SlcRu1Xd2KIBHznjZn8UqX6b5S0EXEV0gG4o9tl/jKK5KC sC9w== X-Gm-Message-State: AOAM532rfh9CoEHjWsTTjfLbgjyxLqHUT5tqWHsPtmw1Sy4oBi8ZoTQ4 qu+1N3Ye4QsOKlS8yORvRhV3RGsJqKQ= X-Google-Smtp-Source: ABdhPJzpoDGwHPVsD1UQyS9KKX0nQUjnc5uP8iPmwmofcmk2bVADQcAp8tYO+ge6FuIOaepmu9MXGw== X-Received: by 2002:a63:e143:: with SMTP id h3mr10290692pgk.85.1590083775889; Thu, 21 May 2020 10:56:15 -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 a16sm4881910pjs.23.2020.05.21.10.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 10:56:15 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH v2 3/3] client: Print device property "Types" Date: Thu, 21 May 2020 10:55:43 -0700 Message-Id: <20200521175543.7923-3-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521175543.7923-1-sonnysasaka@chromium.org> References: <20200521175543.7923-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");