From patchwork Fri Sep 29 13:07:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vibhav Pant X-Patchwork-Id: 727720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8455AE71D2B for ; Fri, 29 Sep 2023 13:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbjI2NIH (ORCPT ); Fri, 29 Sep 2023 09:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbjI2NIH (ORCPT ); Fri, 29 Sep 2023 09:08:07 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B195B7 for ; Fri, 29 Sep 2023 06:08:05 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4064876e8b8so39252355e9.0 for ; Fri, 29 Sep 2023 06:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695992883; x=1696597683; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Sxc4agaIOHDfdQGAhSf2b1+Pi5vZPV6mJGvc4RbSvv4=; b=iHmqtN3VD4fANclurlBzoVtOv7sXxS/+p49C92DWRNjbtfIlw/3qpJvlFpKHwYnwfo yK8e1Hc/F/g2mDfiWmUv7jwhvs/CxFrDHjyB6kaYYoXbTJAmUFnI5U3s8KGDKN4NIMSC zpeiW2UYPmH+x3Jyu5H+1s+A2q+KvA1BQzF5XZLkFX7ApL6U3LmipEBfd1n77iwvbNW8 34zAtXqsWN4GI2dbWzs9QVsL42rLGL4tzjVvP6+d6oKd1rcqxD0b6m/6wUUHIrKC3Ft2 KXL4XOoAutVnW/voo9uK5V4LuZe/csT/97s9jhGsSLqkceNWSS4wOcajJlj9F+4tu5DH 00OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695992883; x=1696597683; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Sxc4agaIOHDfdQGAhSf2b1+Pi5vZPV6mJGvc4RbSvv4=; b=JbUtTc23ZuaN85jS4cacjf3QIFdR+1NEVq56dTDyN0Ozc2t05s1PfiuKo5CUAy98Sm 1a91DHJKtPg1b8yQgjbBRcwPamM70tLGUX1PwP0trE9ZSpRpGKOgVyWDKYNPOhHlHAZr hGOFRYQgBR980PdRO6dxWhuzH5JaRWNXkj/yRHFBHSGsbeR90GoHSvs7nUii1fvMVsY3 Dy5RxM0tR6rMMm714PUc18d/E5/IYIhAXg19gy9rDI+Oa7Lqz3T1ArJgtW6CrSz7Zric UAJ2ya6WJN0xvFRl+u1Drw9s+xiYmEkxB1Q9Pby1vMJYWSjl5c+kXPzU/ey17mc0Aybo T+nw== X-Gm-Message-State: AOJu0YxYFUMQ9qERQ7xYieIWJo2A4FCI/e9KuDYCC4ldJ2t8vau3oCCS aPf0vcsjD53e8Q6HjkuDiZJ13G9u0KNleQ== X-Google-Smtp-Source: AGHT+IHLc4o8vBrhiPxdHyqb3umeeiKJrMbn9rCVVrJpZCVvczrNJRhifRm8hfnAZQT6LVOWIDRKyg== X-Received: by 2002:a7b:ce8b:0:b0:402:98cd:a3e9 with SMTP id q11-20020a7bce8b000000b0040298cda3e9mr3887186wmj.32.1695992882014; Fri, 29 Sep 2023 06:08:02 -0700 (PDT) Received: from vibhavp-vivobook.lan ([2401:4900:1c53:793f:bf1d:92a:6f4f:5e80]) by smtp.gmail.com with ESMTPSA id a6-20020a05600c224600b00403b63e87f2sm1409099wmm.32.2023.09.29.06.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 06:08:01 -0700 (PDT) From: vibhavp@gmail.com To: linux-bluetooth@vger.kernel.org Cc: Vibhav Pant Subject: [PATCH BlueZ v2 1/2] adapter: Add Version and Manufacturer props to org.bluez.Adapter1. Date: Fri, 29 Sep 2023 18:37:24 +0530 Message-ID: <20230929130742.146571-1-vibhavp@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Vibhav Pant This allows DBus clients to find an adapter's version and manufacturer company code without querying the management API. --- src/adapter.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 8a7c53a9e..8c267d418 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -260,6 +260,7 @@ struct btd_adapter { bdaddr_t bdaddr; /* controller Bluetooth address */ uint8_t bdaddr_type; /* address type */ + uint8_t version; /* controller core spec version */ uint32_t dev_class; /* controller class of device */ char *name; /* controller device name */ char *short_name; /* controller short name */ @@ -3540,6 +3541,29 @@ static gboolean property_experimental_exists(const GDBusPropertyTable *property, return !queue_isempty(adapter->exps); } +static gboolean property_get_manufacturer(const GDBusPropertyTable *property, + DBusMessageIter *iter, + void *user_data) +{ + struct btd_adapter *adapter = user_data; + dbus_uint16_t val = adapter->manufacturer; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &val); + + return TRUE; +} + +static gboolean property_get_version(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *user_data) +{ + struct btd_adapter *adapter = user_data; + uint8_t val = adapter->version; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &val); + + return TRUE; +} + static DBusMessage *remove_device(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -3898,6 +3922,8 @@ static const GDBusPropertyTable adapter_properties[] = { { "Roles", "as", property_get_roles }, { "ExperimentalFeatures", "as", property_get_experimental, NULL, property_experimental_exists }, + { "Manufacturer", "q", property_get_manufacturer }, + { "Version", "y", property_get_version }, { } }; @@ -10164,6 +10190,8 @@ static void read_info_complete(uint8_t status, uint16_t length, adapter->supported_settings = btohl(rp->supported_settings); adapter->current_settings = btohl(rp->current_settings); + adapter->version = rp->version; + clear_uuids(adapter); clear_devices(adapter); From patchwork Fri Sep 29 13:07:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vibhav Pant X-Patchwork-Id: 728224 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 445CDE71D21 for ; Fri, 29 Sep 2023 13:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbjI2NIL (ORCPT ); Fri, 29 Sep 2023 09:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbjI2NIK (ORCPT ); Fri, 29 Sep 2023 09:08:10 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8BC1A4 for ; Fri, 29 Sep 2023 06:08:08 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-406402933edso57543885e9.2 for ; Fri, 29 Sep 2023 06:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695992887; x=1696597687; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i463V6Kf95PbSaQD87pqeomJqLahMJGQW7ThJvb+fAQ=; b=iCoYDyFhyBNzlmoIJ0ig/TsfthjR8NEd7eOlEnNXyuu3GIXMQ6MxbHKplxslFoVJoF UOc+nNK3biILDhhTtXStxShpbX0Wy+yC9tCHNMvJQoDw66fBC4/LvosN4gVce/NY8jTM vYoVqH9aG3R7R/eM9KU01Nak7NQbs+O6mExsaW3H18DEGFulvNVRMV2w+5PmWTIa2yhB N86TfAeEJ2HgWENbNLQkmiIJF6wWJnvKR5S46n9rMQE360VhSUXdDAGsn35ipXDn7a18 sw9kvWuemea1mUp3U048WKFcFVG2vsiK9JRCB29jx4Rb0XiifEZXGQKzVQ89YxahIdML 6z6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695992887; x=1696597687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i463V6Kf95PbSaQD87pqeomJqLahMJGQW7ThJvb+fAQ=; b=khp22N8JChZpklfJyrI9p63d5+5dzi6MKEt8FFwMj0srHXuPQY9d39HX72OhMvlA9p 3FLgEOysUHv2RnRVH6zF08ycMGAZSLYiF1gtHDoawR4vQjGPOLDgQF5ILr4jwV/4ypXr 1wF/jpUs8v3xac1fdn268PxWwiSXio+E0SJxBIpgyPdB1VO8wiqV0pEEGD+oLHNWHVtS USeHpsdRbjbFv0Bbtah9MKNUAL0xaPJzMcy/z1Mu1ZYEqhPb6NAcVN30oRrBc9kqq63N 5SPcgymYM524O8sUCU3Zl+MSdBdcsf2uoZPF4aqa/Ke6sU21P5BMd/t0Ojy7G9KJyk9g qnqg== X-Gm-Message-State: AOJu0YxDtBowbaM6daRFQYMvdyGj0RP0SefU9bgTbAsN/cSBZFkZ787D ultdWR1wGWwJ3esCC1t6r0vEz7LIBLNIhQ== X-Google-Smtp-Source: AGHT+IEn8vQ9NdEH+MILKTqqK3gMK/7aDEwHjOCwdKtlKJn58qeDKcNkuLyHlR14LlS+4l7V6C70GA== X-Received: by 2002:a05:600c:293:b0:401:1b58:72f7 with SMTP id 19-20020a05600c029300b004011b5872f7mr4106225wmk.38.1695992885979; Fri, 29 Sep 2023 06:08:05 -0700 (PDT) Received: from vibhavp-vivobook.lan ([2401:4900:1c53:793f:bf1d:92a:6f4f:5e80]) by smtp.gmail.com with ESMTPSA id a6-20020a05600c224600b00403b63e87f2sm1409099wmm.32.2023.09.29.06.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 06:08:05 -0700 (PDT) From: vibhavp@gmail.com To: linux-bluetooth@vger.kernel.org Cc: Vibhav Pant Subject: [PATCH BlueZ v2 2/2] adapter-api: Add docs for properties Manufacturer and Version. Date: Fri, 29 Sep 2023 18:37:25 +0530 Message-ID: <20230929130742.146571-2-vibhavp@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230929130742.146571-1-vibhavp@gmail.com> References: <20230929130742.146571-1-vibhavp@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Vibhav Pant --- doc/adapter-api.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt index d38ce7171..10c290c62 100644 --- a/doc/adapter-api.txt +++ b/doc/adapter-api.txt @@ -360,3 +360,14 @@ Properties string Address [readonly] List of 128-bit UUIDs that represents the experimental features currently enabled. + + uint16 Manufacturer [readonly] + + The manufacturer of the device, as a uint16 company + identifier defined by the Core Bluetooth Specification. + + byte Version [readonly] + + The Bluetooth version supported by the device, as a + core version code defined by the Core Bluetooth + Specification.