* [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name
@ 2018-02-12 16:00 Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 2/4] shared/btp: Change struct member order for device found as in btp Grzegorz Kolodziejczyk
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2018-02-12 16:00 UTC (permalink / raw)
To: linux-bluetooth
This patch fixes wrong naming of advertising instance data property.
---
tools/btpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/btpclient.c b/tools/btpclient.c
index 097732eb8..61bde820e 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -971,7 +971,7 @@ static void setup_ad_interface(struct l_dbus_interface *interface)
ad_serviceuuids_getter, NULL);
l_dbus_interface_property(interface, "ServiceData", 0, "a{sv}",
ad_servicedata_getter, NULL);
- l_dbus_interface_property(interface, "ManufacturerServiceData", 0,
+ l_dbus_interface_property(interface, "ManufacturerData", 0,
"a{qv}", ad_manufacturerdata_getter,
NULL);
l_dbus_interface_property(interface, "Includes", 0, "as",
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/4] shared/btp: Change struct member order for device found as in btp
2018-02-12 16:00 [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Grzegorz Kolodziejczyk
@ 2018-02-12 16:01 ` Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 3/4] tools/btpclient: Add passkey confirm ev and passkey confirm rsp cmd Grzegorz Kolodziejczyk
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2018-02-12 16:01 UTC (permalink / raw)
To: linux-bluetooth
This patch changes member order in device found struct definition to be
compatible with btp specification.
---
src/shared/btp.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/btp.h b/src/shared/btp.h
index 0b605be18..f0ac3a1ee 100644
--- a/src/shared/btp.h
+++ b/src/shared/btp.h
@@ -247,8 +247,8 @@ struct btp_new_settings_ev {
#define BTP_EV_GAP_DEVICE_FOUND 0x81
struct btp_device_found_ev {
- bdaddr_t address;
uint8_t address_type;
+ bdaddr_t address;
int8_t rssi;
uint8_t flags;
uint16_t eir_len;
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 3/4] tools/btpclient: Add passkey confirm ev and passkey confirm rsp cmd
2018-02-12 16:00 [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 2/4] shared/btp: Change struct member order for device found as in btp Grzegorz Kolodziejczyk
@ 2018-02-12 16:01 ` Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 4/4] tools/btpclient: Check if dev is connected in device found ev routine Grzegorz Kolodziejczyk
2018-02-13 8:15 ` [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Szymon Janc
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2018-02-12 16:01 UTC (permalink / raw)
To: linux-bluetooth
This patch adds passkey confirm command handler and passkey confirm
event.
---
tools/btpclient.c | 38 ++++++++++++++++++++++++++++++++++----
1 file changed, 34 insertions(+), 4 deletions(-)
diff --git a/tools/btpclient.c b/tools/btpclient.c
index 61bde820e..8b5794c8b 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -1700,12 +1700,42 @@ static struct l_dbus_message *ag_request_confirmation_call(struct l_dbus *dbus,
struct l_dbus_message *message,
void *user_data)
{
- struct l_dbus_message *reply;
+ struct btp_gap_passkey_confirm_ev ev;
+ struct btp_device *device;
+ struct btp_adapter *adapter;
+ const char *path, *str_addr, *str_addr_type;
+ uint32_t passkey;
- reply = l_dbus_message_new_method_return(message);
- l_dbus_message_set_arguments(reply, "");
+ l_dbus_message_get_arguments(message, "ou", &path, &passkey);
- return reply;
+ device = find_device_by_path(path);
+
+ if (!l_dbus_proxy_get_property(device->proxy, "Address", "s", &str_addr)
+ || !l_dbus_proxy_get_property(device->proxy, "AddressType", "s",
+ &str_addr_type)) {
+ l_info("Cannot get device properties");
+
+ return NULL;
+ }
+
+ ev.passkey = L_CPU_TO_LE32(passkey);
+ ev.address_type = strcmp(str_addr_type, "public") ?
+ BTP_GAP_ADDR_RANDOM :
+ BTP_GAP_ADDR_PUBLIC;
+ if (str2ba(str_addr, &ev.address) < 0) {
+ l_info("Incorrect device address");
+
+ return NULL;
+ }
+
+ adapter = find_adapter_by_device(device);
+
+ ag.pending_req = l_dbus_message_ref(message);
+
+ btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_PASSKEY_CONFIRM,
+ adapter->index, sizeof(ev), &ev);
+
+ return NULL;
}
static struct l_dbus_message *ag_request_authorization_call(struct l_dbus *dbus,
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 4/4] tools/btpclient: Check if dev is connected in device found ev routine
2018-02-12 16:00 [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 2/4] shared/btp: Change struct member order for device found as in btp Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 3/4] tools/btpclient: Add passkey confirm ev and passkey confirm rsp cmd Grzegorz Kolodziejczyk
@ 2018-02-12 16:01 ` Grzegorz Kolodziejczyk
2018-02-13 8:15 ` [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Szymon Janc
3 siblings, 0 replies; 5+ messages in thread
From: Grzegorz Kolodziejczyk @ 2018-02-12 16:01 UTC (permalink / raw)
To: linux-bluetooth
Device may be connected while device found event is generated thus thus
btp should generate additional device connected event also.
---
tools/btpclient.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/tools/btpclient.c b/tools/btpclient.c
index 8b5794c8b..cd2ac99af 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -2419,24 +2419,30 @@ failed:
static void btp_gap_device_found_ev(struct l_dbus_proxy *proxy)
{
+ struct btp_device *device = find_device_by_proxy(proxy);
+ struct btp_adapter *adapter = find_adapter_by_device(device);
struct btp_device_found_ev ev;
- const char *str;
+ struct btp_gap_device_connected_ev ev_conn;
+ const char *str, *addr_str;
int16_t rssi;
+ uint8_t address_type;
+ bool connected;
- if (!l_dbus_proxy_get_property(proxy, "Address", "s", &str) ||
- str2ba(str, &ev.address) < 0)
+ if (!l_dbus_proxy_get_property(proxy, "Address", "s", &addr_str) ||
+ str2ba(addr_str, &ev.address) < 0)
return;
if (!l_dbus_proxy_get_property(proxy, "AddressType", "s", &str))
return;
- ev.address_type = strcmp(str, "public") ? BTP_GAP_ADDR_RANDOM :
+ address_type = strcmp(str, "public") ? BTP_GAP_ADDR_RANDOM :
BTP_GAP_ADDR_PUBLIC;
+ ev.address_type = address_type;
if (!l_dbus_proxy_get_property(proxy, "RSSI", "n", &rssi))
- return;
-
- ev.rssi = rssi;
+ ev.rssi = 0x81;
+ else
+ ev.rssi = rssi;
/* TODO Temporary set all flags */
ev.flags = (BTP_EV_GAP_DEVICE_FOUND_FLAG_RSSI |
@@ -2446,9 +2452,17 @@ static void btp_gap_device_found_ev(struct l_dbus_proxy *proxy)
/* TODO Add eir to device found event */
ev.eir_len = 0;
- btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_DEVICE_FOUND,
- BTP_INDEX_NON_CONTROLLER,
+ btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_DEVICE_FOUND, adapter->index,
sizeof(ev) + ev.eir_len, &ev);
+
+ if (l_dbus_proxy_get_property(proxy, "Connected", "b", &connected) &&
+ connected) {
+ ev_conn.address_type = address_type;
+ str2ba(addr_str, &ev_conn.address);
+
+ btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_DEVICE_CONNECTED,
+ adapter->index, sizeof(ev_conn), &ev_conn);
+ }
}
static void btp_gap_device_connection_ev(struct l_dbus_proxy *proxy,
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name
2018-02-12 16:00 [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Grzegorz Kolodziejczyk
` (2 preceding siblings ...)
2018-02-12 16:01 ` [PATCH BlueZ 4/4] tools/btpclient: Check if dev is connected in device found ev routine Grzegorz Kolodziejczyk
@ 2018-02-13 8:15 ` Szymon Janc
3 siblings, 0 replies; 5+ messages in thread
From: Szymon Janc @ 2018-02-13 8:15 UTC (permalink / raw)
To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth
Hi Grzegorz,
On Monday, 12 February 2018 17:00:59 CET Grzegorz Kolodziejczyk wrote:
> This patch fixes wrong naming of advertising instance data property.
> ---
> tools/btpclient.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/btpclient.c b/tools/btpclient.c
> index 097732eb8..61bde820e 100644
> --- a/tools/btpclient.c
> +++ b/tools/btpclient.c
> @@ -971,7 +971,7 @@ static void setup_ad_interface(struct l_dbus_interface
> *interface) ad_serviceuuids_getter, NULL);
> l_dbus_interface_property(interface, "ServiceData", 0, "a{sv}",
> ad_servicedata_getter, NULL);
> - l_dbus_interface_property(interface, "ManufacturerServiceData", 0,
> + l_dbus_interface_property(interface, "ManufacturerData", 0,
> "a{qv}", ad_manufacturerdata_getter,
> NULL);
> l_dbus_interface_property(interface, "Includes", 0, "as",
Patches 1 and 2 are now applied, thanks.
--
pozdrawiam
Szymon Janc
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-13 8:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-12 16:00 [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 2/4] shared/btp: Change struct member order for device found as in btp Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 3/4] tools/btpclient: Add passkey confirm ev and passkey confirm rsp cmd Grzegorz Kolodziejczyk
2018-02-12 16:01 ` [PATCH BlueZ 4/4] tools/btpclient: Check if dev is connected in device found ev routine Grzegorz Kolodziejczyk
2018-02-13 8:15 ` [PATCH BlueZ 1/4] tools/btpclient: Fix ad property manufacturer data name Szymon Janc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.