Skip to contentSkip to conversation

btp: Update connect event structure

PATCH Applied [email protected] 3 participants 5 messages Aug 29, 2020 – Sep 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 btp: Update connect event structure

From: Tedd Ho-Jeong An <[email protected]>

This patch updates the connect event struct to align withe the btp spec.

Opcode 0x82 - Device Connected event
Controller Index: <controller id>
Event parameters: Address_Type (1 octet)
Address (6 octets) Connection Interval (2 octets) Connection Latency (2 octets) Supervision Timeout (2 octets)

---
 src/shared/btp.h | 3 +++
 1 file changed, 3 insertions(+)
src/shared/btp.h +3 -0
index f0ac3a1ee..cc71a71df 100644
@@ -259,6 +259,9 @@ struct btp_device_found_ev {
 struct btp_gap_device_connected_ev {
 	uint8_t address_type;
 	bdaddr_t address;
+	uint16_t connection_interval;
+	uint16_t connection_latency;
+	uint16_t supervision_timeout;
 } __packed;
 
 #define BTP_EV_GAP_DEVICE_DISCONNECTED		0x83
Signature · 1 line
2.25.4
#1 lore raw

PATCH v3 2/3 tools/btpclientctl: Add btpclient test application

From: Tedd Ho-Jeong An <[email protected]>

This patch adds a test application for btpclient, which exercises the BTP API.

---
 .gitignore           |    1 +
 Makefile.tools       |    6 +-
 tools/btpclientctl.c | 2372 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 2378 insertions(+), 1 deletion(-)
 create mode 100644 tools/btpclientctl.c
.gitignore +1 -0
index eabdb273f..f4fb5db28 100644
@@ -120,6 +120,7 @@ tools/btconfig
 tools/btmgmt
 tools/btsnoop
 tools/btpclient
+tools/btpclientctl
 tools/btmon-logger
 tools/bluetooth-logger.service
 peripheral/btsensor
Makefile.tools +5 -1
index 9b9236609..07dfbf4e8 100644
@@ -492,11 +492,15 @@ test_scripts += test/sap_client.py test/bluezutils.py \
 		test/test-gatt-profile test/test-mesh test/agent.py
 
 if BTPCLIENT
-noinst_PROGRAMS += tools/btpclient
+noinst_PROGRAMS += tools/btpclient tools/btpclientctl
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
 tools_btpclient_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-ell.la $(ell_ldadd)
 tools_btpclient_DEPENDENCIES = lib/libbluetooth-internal.la $(ell_dependencies)
 tools/btpclient.$(OBJEXT): src/libshared-ell.la ell/internal
+
+tools_btpclientctl_SOURCES = tools/btpclientctl.c client/display.c
+tools_btpclientctl_LDADD = src/libshared-mainloop.la src/libshared-glib.la \
+				lib/libbluetooth-internal.la -lreadline
 endif
tools/btpclientctl.c new file +2372 -0

2,372 lines not on this page · raw message

Signature · 1 line
2.25.4
#2 lore raw

RE: [V3,2/3] tools/btpclientctl: Add btpclient test application

This is 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 we are preparing for reviewing the patches, we found the following issue/warning.

Test Result:
checkpatch Failed

Outputs:
WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #48: FILE: tools/btpclientctl.c:1:
+/*

ERROR:FSF_MAILING_ADDRESS: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. #66: FILE: tools/btpclientctl.c:19:
+ * along with this program; if not, write to the Free Software$

ERROR:FSF_MAILING_ADDRESS: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. #67: FILE: tools/btpclientctl.c:20:
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA$

WARNING:TYPO_SPELLING: 'arguement' may be misspelled - perhaps 'argument'? #207: FILE: tools/btpclientctl.c:160:
+ bt_shell_printf("Invalid arguement %s\n", argv[1]);

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #2332: FILE: tools/btpclientctl.c:2285:
+static const char *help[] = {

- total: 2 errors, 3 warnings, 2395 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v3 3/3 btpclient: Fix gap reset not sending response

In reply to [email protected]

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the GAP reset command to response the default settings after resetting the stack.

---
 tools/btpclient.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)
tools/btpclient.c +19 -15
index f9c693056..38e326670 100644
@@ -521,6 +521,19 @@ static void reset_unreg_agent_reply(struct l_dbus_proxy *proxy,
 	ag.registered = false;
 }
 
+static void update_current_settings(struct btp_adapter *adapter,
+							uint32_t new_settings)
+{
+	struct btp_new_settings_ev ev;
+
+	adapter->current_settings = new_settings;
+
+	ev.current_settings = L_CPU_TO_LE32(adapter->current_settings);
+
+	btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index,
+							sizeof(ev), &ev);
+}
+
 static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
 								void *user_data)
 {
@@ -528,6 +541,7 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
 	const struct l_queue_entry *entry;
 	uint8_t status;
 	bool prop;
+	uint32_t default_settings;
 
 	if (!adapter) {
 		status = BTP_ERROR_INVALID_INDEX;
@@ -570,10 +584,13 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,
 			goto failed;
 		}
 
-	adapter->current_settings = adapter->default_settings;
+	default_settings = adapter->default_settings;
+
+	update_current_settings(adapter, default_settings);
 
 	/* TODO for we assume all went well */
-	btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index, 0, NULL);
+	btp_send(btp, BTP_GAP_SERVICE, BTP_OP_GAP_RESET, index,
+				sizeof(default_settings), &default_settings);
 	return;
 
 failed:
@@ -644,19 +661,6 @@ failed:
 	btp_send_error(btp, BTP_GAP_SERVICE, index, status);
 }
 
-static void update_current_settings(struct btp_adapter *adapter,
-							uint32_t new_settings)
-{
-	struct btp_new_settings_ev ev;
-
-	adapter->current_settings = new_settings;
-
-	ev.current_settings = L_CPU_TO_LE32(adapter->current_settings);
-
-	btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_NEW_SETTINGS, adapter->index,
-							sizeof(ev), &ev);
-}
-
 static void btp_gap_set_connectable(uint8_t index, const void *param,
 					uint16_t length, void *user_data)
 {
Signature · 1 line
2.25.4
maintainer Applied
#4 lore raw
In reply to [email protected]

Hi Tedd,

Quoted 31 lines · On Fri, Aug 28, 2020 at 5:12 PM <[email protected]> wrote:

From: Tedd Ho-Jeong An <[email protected]>

This patch updates the connect event struct to align withe the btp spec.

Opcode 0x82 - Device Connected event
Controller Index: <controller id>
Event parameters: Address_Type (1 octet)
Address (6 octets) Connection Interval (2 octets) Connection Latency (2 octets) Supervision Timeout (2 octets)

---
 src/shared/btp.h | 3 +++
 1 file changed, 3 insertions(+)
src/shared/btp.h +3 -1
index f0ac3a1ee..cc71a71df 100644
@@ -259,6 +259,9 @@ struct btp_device_found_ev {
 struct btp_gap_device_connected_ev {
        uint8_t address_type;
        bdaddr_t address;
+       uint16_t connection_interval;
+       uint16_t connection_latency;
+       uint16_t supervision_timeout;
 } __packed;
 
 #define BTP_EV_GAP_DEVICE_DISCONNECTED         0x83
--
Quoted 2 lines

2.25.4

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz