Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3980819rdh; Fri, 29 Sep 2023 07:57:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzMuoOwkRxtXy8ioqi/qBxPYLVNRvi/2Z8FnxTgXTu2MwsWYCw3JXJmaniQ74oA4RDWdBR X-Received: by 2002:a17:90a:bd8d:b0:268:e5db:6e19 with SMTP id z13-20020a17090abd8d00b00268e5db6e19mr4062298pjr.20.1695999460591; Fri, 29 Sep 2023 07:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695999460; cv=none; d=google.com; s=arc-20160816; b=XdDq5gQJ4+OJhfQRc0r3VE14aCcYJ7gjopwL+0MZburnr0ClZIbbgTTx0EwDjgm/Vz fVOHFbL34n4Aw09W8qzeACouvtvvRdmFjuBI2pMVLds4rN6u9ku8E/tMByZ09YaAX0Az oIsxjhlrSfPrjbIC/GXT/yAM97SOqfM3p178qKf6eM0dBbe1qdZLJDXQpLhv8YXq5agA qxFDCVha+TDc7LlO05IKlNv5I8Hz3Bgd6K/HlSHigitgdHV/kIX4e98JwoxZ8qigKUFI j3PhWA6iFjucsYzjAihh6uguzX0IrUeNHWEJWclea421xncyzTKQvzsHTEW+38L7k6VL /sqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Sxc4agaIOHDfdQGAhSf2b1+Pi5vZPV6mJGvc4RbSvv4=; fh=CDj/v80jYUpbYKSX5IWGDr0v6Ys3Zy2yAPcDJrDd65I=; b=SEVVpLF5236cKv6ZUjnzOgKKKEtizAmH+KpslqRSOprqf/pdirbok/Q1nm/gdY2oLP 6PxcLUoG/mVSlR6S5n2JzNqLKn9Cz0Xxts2v2cWY5JslwiQv4oGwC6nI6Oz87asgZImF u3wQ+SiEk8olimeFBrTY3geAQy5l0Zz80Q96tAv6nl51/v52CMXoTOmXsCjAg0lGYFrT hXYcjUuXo9IIgPw5H/JlFNsUQtjS1yxZ0tboW1KAx4YA6xCQacjSR36+94Y2CBHeU376 iDg2zdJGLWU6BxUeQBI2mgvalUbKednBBQtISawYWsRSzoJE/5J++Xx01QpCbU3v7NpG KIAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iHmqtN3V; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id my10-20020a17090b4c8a00b002773cc10d3csi1860584pjb.78.2023.09.29.07.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:57:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iHmqtN3V; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AEFB18293C66; Fri, 29 Sep 2023 06:08:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233066AbjI2NIH (ORCPT + 99 others); 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-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 06:08:10 -0700 (PDT) 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); -- 2.42.0