Contribution of bluez patches
Hello,
attached you can find two patches, which we want to contribute to bluez. I created the patches based on current master. If you need any further information please don't hesitate to contact me.
Kind regards,
Thorsten Klein
BSH Hausgeräte GmbH
Software-Developer
Im Gewerbepark B10
93059 Regensburg
Tel.: +49 (941) 8994-2490
www.bsh-group.com
BSH Hausgeräte GmbH, Carl-Wery-Str. 34, 81739 Munich, Germany
Chairman of the Supervisory Board: Prof. Dr. Stefan Asenkerschbaumer
Board of Management: Uwe Raschke (Chairman), Dr. Gerhard Dambach, Matthias Ginthum, Dr. Silke Maurer Registered Office: Munich; Registry Court: Amtsgericht München, HRB 75534 WEEE-Reg.-No. DE 57986696
This message is for the sole use of the intended recipient(s) and may contain trade secrets or other confidential and privileged information. Any unauthorized use, copy, disclosure or distribution is prohibited. If you are not the intended recipient, please inform us immediately by reply email and delete this message, including any attachment or copies thereof, from your system.
From 934220b874978ef9ff0d10a411d9c6909a3d1995 Mon Sep 17 00:00:00 2001
Message-Id: <934220b874978ef9ff0d10a411d9c6909a3d1995.1585812800.git.thorsten.klein@bshg.com>
From: "Schachschal, Maximilian (BSH)" <[email protected]>
Date: Thu, 2 Apr 2020 09:33:11 +0200
Subject: [PATCH] ManufacturerData field added to ScanResponse
Keys are the Manufacturer ID to associate with the data.
--- doc/advertising-api.txt | 6 ++++++ src/advertising.c | 25 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-)
doc/advertising-api.txt +6 -0
@@ -51,6 +51,12 @@ Properties string Type the Advertising Data. Keys are the Manufacturer ID to associate with the data. + dict ManufacturerDataScanResponse [Experimental] + + Manufactuer Data fields to include in + the Scan Response. Keys are the Manufacturer ID + to associate with the data. + array{string} SolicitUUIDs Array of UUIDs to include in "Service Solicitation"
src/advertising.c +19 -6
@@ -328,12 +328,12 @@ fail: }static bool parse_manufacturer_data (DBusMessageIter *iter, -struct btd_adv_client *client) +struct btd_ad *ad) {DBusMessageIter entries;if (!iter) { -bt_ad_clear_manufacturer_data (client->data); +bt_ad_clear_manufacturer_data (ad);return true; }
@@ -342,7 +342,7 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,dbus_message_iter_recurse (iter, &entries); -bt_ad_clear_manufacturer_data (client->data); +bt_ad_clear_manufacturer_data (ad);while (dbus_message_iter_get_arg_type (&entries) ==DBUS_TYPE_DICT_ENTRY ) {
@@ -373,7 +373,7 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,DBG ("Adding ManufacturerData for %04x" , manuf_id); -if (!bt_ad_add_manufacturer_data (client->data, manuf_id, +if (!bt_ad_add_manufacturer_data (ad, manuf_id, manuf_data, len)) goto fail;
@@ -383,10 +383,22 @@ static bool parse_manufacturer_data(DBusMessageIter *iter,return true; fail: -bt_ad_clear_manufacturer_data (client->data); +bt_ad_clear_manufacturer_data (ad);return false; } +static bool parse_manufacturer_data_adv (DBusMessageIter *iter, +struct btd_adv_client *client) +{ +return parse_manufacturer_data (iter, client->data); +} + +static bool parse_manufacturer_data_scan (DBusMessageIter *iter, +struct btd_adv_client *client) +{ +return parse_manufacturer_data (iter, client->scan); +} +static bool parse_service_data (DBusMessageIter *iter,struct btd_adv_client *client) {
@@ -941,7 +953,8 @@ static struct adv_parser { { "Type", parse_type }, { "ServiceUUIDs", parse_service_uuids }, { "SolicitUUIDs", parse_solicit_uuids }, - { "ManufacturerData", parse_manufacturer_data }, + { "ManufacturerData", parse_manufacturer_data_adv }, + { "ManufacturerDataScanResponse", parse_manufacturer_data_scan }, { "ServiceData", parse_service_data }, { "Includes", parse_includes }, { "LocalName", parse_local_name },
Signature · 1 line
2.7.4
From b268108bbd91bbb24c732d9ec125d31cc3edb250 Mon Sep 17 00:00:00 2001
Message-Id: <b268108bbd91bbb24c732d9ec125d31cc3edb250.1585812376.git.thorsten.klein@bshg.com>
From: "Ryll, Jan (BSH)" <[email protected]>
Date: Thu, 2 Apr 2020 09:26:10 +0200
Subject: [PATCH] fix dbus error code in case of invalid offset
(org.bluez.Error.InvalidOffset)
--- client/gatt.c | 4 ++++ 1 file changed, 4 insertions(+)
client/gatt.c +4 -0
@@ -2276,6 +2276,10 @@ static DBusMessage *chrc_write_value(DBusConnection *conn, DBusMessage *msg,if (prep_authorize)return g_dbus_create_reply (msg,DBUS_TYPE_INVALID ); +if (offset >= (chrc->max_val_len)) +return g_dbus_create_error (msg, +"org.bluez.Error.InvalidOffset" ,NULL ); +if (write_value (&chrc->value_len, &chrc->value, value, value_len, offset, chrc->max_val_len)) return g_dbus_create_error(msg,
Signature · 1 line
2.7.4