Message ID | 89ceb9e5d67485c19d0f139ac0825cf008491ebb.camel@gmail.com |
---|---|
State | New |
Headers | show |
Series | [BlueZ] : adapter: Add Version and Manufacturer props to org.bluez.Adapter1. | expand |
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
Hi Vibhav, On Tue, Sep 19, 2023 at 12:59 PM <vibhavp@gmail.com> wrote: > > From: Vibhav Pant <vibhavp@gmail.com> > > 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. > Signed-off-by: Vibhav Pant <vibhavp@gmail.com> > --- > doc/adapter-api.txt | 11 +++++++++++ > src/adapter.c | 28 ++++++++++++++++++++++++++++ > 2 files changed, 39 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. Documentation should be submitted in a separate patch. > diff --git a/src/adapter.c b/src/adapter.c > index 5ebfc4752..8f67a6826 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 }, > { } > }; > > @@ -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 > > >
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. diff --git a/src/adapter.c b/src/adapter.c index 5ebfc4752..8f67a6826 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