Skip to contentSkip to conversation

: adapter: Add Version and Manufacturer props to org.bluez.Adapter1.

PATCH Superseded [email protected] 3 participants 3 messages Sep 19, 2023 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : adapter: Add Version and Manufacturer props to org.bluez.Adapter1.

From: Vibhav Pant <[email protected]>

This allows DBus clients to find an adapter's version and manufacturer company code without querying the management API.

---
 doc/adapter-api.txt | 11 +++++++++++
 src/adapter.c       | 28 ++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
doc/adapter-api.txt +0 -0
index d38ce7171..10c290c62 100644
@@ -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.

src/adapter.c +0 -0
index 5ebfc4752..8f67a6826 100644
@@ -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 },
{ }
};

@@ -10162,6 +10188,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);

Signature · 1 line
2.42.0
#1 lore raw

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch fragment without header at line 9: @@ -3540,6 +3541,29 @@ static gboolean
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to [email protected]

Hi Vibhav,

Quoted 5 lines · On Tue, Sep 19, 2023 at 12:59 PM <[email protected]> wrote:

From: Vibhav Pant <[email protected]>

This allows DBus clients to find an adapter's version and manufacturer company code without querying the management API.

We don't use Signed-off-by on userspace.

Quoted 26 lines
---
 doc/adapter-api.txt | 11 +++++++++++
 src/adapter.c       | 28 ++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
doc/adapter-api.txt +0 -0
index d38ce7171..10c290c62 100644
@@ -360,3 +360,14 @@ Properties string Address [readonly]
 
                        List of 128-bit UUIDs that represents the

experimental
features currently enabled.

doc/adapter-api.txt +4 -0
+
+               uint16 Manufacturer [readonly]
+
+                       The manufacturer of the device, as a uint16

company
+ identifier defined by the Core Bluetooth
Specification.

doc/adapter-api.txt +4 -0
+
+               byte Version [readonly]
+
+                       The Bluetooth version supported by the device,
Quoted 4 lines

as a
+ core version code defined by the Core
Bluetooth
+ Specification.

Documentation should be submitted in a separate patch.

Quoted 77 lines
src/adapter.c +0 -0
index 5ebfc4752..8f67a6826 100644
@@ -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 */

src/adapter.c +14 -0
@@ -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)

src/adapter.c +9 -0
+{
+       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)
{

src/adapter.c +2 -0
@@ -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 },
        { }

};

src/adapter.c +2 -1
@@ -10162,6 +10188,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

Signature · 1 line
Luiz Augusto von Dentz