diff mbox series

[v2,1/9] adapter: Add btd_adapter_find_device_by_fd

Message ID 20220826232031.20391-2-luiz.dentz@gmail.com
State New
Headers show
Series Initial BAP support | expand

Commit Message

Luiz Augusto von Dentz Aug. 26, 2022, 11:20 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds btd_adapter_find_device_by_fd that lookup a device by a fd
socket destination address.
---
 src/adapter.c | 33 +++++++++++++++++++++++++++++++++
 src/adapter.h |  1 +
 2 files changed, 34 insertions(+)

Comments

bluez.test.bot@gmail.com Aug. 27, 2022, 12:20 a.m. UTC | #1
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.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=671660

---Test result---

Test Summary:
CheckPatch                    FAIL      20.82 seconds
GitLint                       PASS      10.08 seconds
Prep - Setup ELL              PASS      24.04 seconds
Build - Prep                  PASS      0.78 seconds
Build - Configure             PASS      7.74 seconds
Build - Make                  PASS      900.80 seconds
Make Check                    PASS      11.63 seconds
Make Check w/Valgrind         PASS      257.30 seconds
Make Distcheck                PASS      217.27 seconds
Build w/ext ELL - Configure   PASS      7.88 seconds
Build w/ext ELL - Make        PASS      78.54 seconds
Incremental Build w/ patches  PASS      810.07 seconds
Scan Build                    WARNING   824.36 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[v2,3/9] shared/bap: Add initial code for handling BAP
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.
#370: FILE: src/shared/bap.c:19:
+ *  License along with this library; 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.
#371: FILE: src/shared/bap.c:20:
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA$

WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#1743: FILE: src/shared/bap.c:1392:
+		/* Fallthrough */

WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#1749: FILE: src/shared/bap.c:1398:
+		/* Fallthrough */

WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#1762: FILE: src/shared/bap.c:1411:
+		/* Fallthrough */

WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#1768: FILE: src/shared/bap.c:1417:
+		/* Fallthrough */

ERROR:SPACING: space required before the open parenthesis '('
#4469: FILE: src/shared/bap.c:4118:
+			switch(lpac->type) {

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed))
#5149: FILE: src/shared/bap.h:16:
+#define __packed __attribute__((packed))

WARNING:SPACING: Unnecessary space before function pointer arguments
#5256: FILE: src/shared/bap.h:123:
+	int (*select) (struct bt_bap_pac *pac, struct bt_bap_pac_qos *qos,

WARNING:SPACING: Unnecessary space before function pointer arguments
#5259: FILE: src/shared/bap.h:126:
+	int (*config) (struct bt_bap_stream *stream, struct iovec *cfg,

WARNING:SPACING: Unnecessary space before function pointer arguments
#5262: FILE: src/shared/bap.h:129:
+	void (*clear) (struct bt_bap_stream *stream, void *user_data);

/github/workspace/src/12956713.patch total: 3 errors, 8 warnings, 5278 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.

/github/workspace/src/12956713.patch has style problems, please review.

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

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

[v2,4/9] profiles: Add initial code for bap plugin
ERROR:SPACING: space prohibited before that close parenthesis ')'
#618: FILE: profiles/audio/bap.c:490:
+						{ "properties", "a{sv}" } ),

ERROR:INITIALISED_STATIC: do not initialise statics to 0
#1428: FILE: profiles/audio/bap.c:1300:
+static unsigned int bap_id = 0;

WARNING:SPACING: Unnecessary space before function pointer arguments
#2354: FILE: profiles/audio/transport.c:116:
+	void			(*set_state) (struct media_transport *transport,

/github/workspace/src/12956709.patch total: 2 errors, 1 warnings, 2836 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.

/github/workspace/src/12956709.patch has style problems, please review.

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

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

[v2,8/9] client/player: Add support for PACS endpoints
ERROR:SPACING: space prohibited before that close parenthesis ')'
#631: FILE: client/player.c:1886:
+					GDBUS_ARGS({ "cfg", "ay" } ),

ERROR:SPACING: space prohibited before that close parenthesis ')'
#634: FILE: client/player.c:1889:
+					GDBUS_ARGS({ "properties", "a{sv}" } ),

ERROR:SPACING: space prohibited before that close parenthesis ')'
#635: FILE: client/player.c:1890:
+					GDBUS_ARGS({ "properties", "a{sv}" } ),

/github/workspace/src/12956714.patch total: 3 errors, 0 warnings, 799 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.

/github/workspace/src/12956714.patch has style problems, please review.

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

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


##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
client/player.c:1757:25: warning: Dereference of null pointer
        iov_append(&cfg->caps, preset->data.iov_base, preset->data.iov_len);
                               ^~~~~~~~~~~~~~~~~~~~~
1 warning generated.
profiles/audio/media.c:1450:6: warning: 8th function call argument is an uninitialized value
        if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:2996:3: warning: Use of memory after it is freed
                release_endpoint(adapter->endpoints->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:2999:3: warning: Use of memory after it is freed
                media_player_destroy(adapter->players->data);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index b453e86a03c1..51b099daefdf 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1383,6 +1383,39 @@  struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
 	return adapter_create_device(adapter, addr, addr_type);
 }
 
+struct btd_device *btd_adapter_find_device_by_fd(int fd)
+{
+	bdaddr_t src, dst;
+	uint8_t dst_type;
+	GIOChannel *io = NULL;
+	GError *gerr = NULL;
+	struct btd_adapter *adapter;
+
+	io = g_io_channel_unix_new(fd);
+	if (!io)
+		return NULL;
+
+	bt_io_get(io, &gerr,
+			BT_IO_OPT_SOURCE_BDADDR, &src,
+			BT_IO_OPT_DEST_BDADDR, &dst,
+			BT_IO_OPT_DEST_TYPE, &dst_type,
+			BT_IO_OPT_INVALID);
+	if (gerr) {
+		error("bt_io_get: %s", gerr->message);
+		g_error_free(gerr);
+		g_io_channel_unref(io);
+		return NULL;
+	}
+
+	g_io_channel_unref(io);
+
+	adapter = adapter_find(&src);
+	if (!adapter)
+		return NULL;
+
+	return btd_adapter_find_device(adapter, &dst, dst_type);
+}
+
 sdp_list_t *btd_adapter_get_services(struct btd_adapter *adapter)
 {
 	return adapter->services;
diff --git a/src/adapter.h b/src/adapter.h
index b09044edda70..f38f473b79d7 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -86,6 +86,7 @@  struct btd_device *btd_adapter_find_device(struct btd_adapter *adapter,
 							uint8_t dst_type);
 struct btd_device *btd_adapter_find_device_by_path(struct btd_adapter *adapter,
 						   const char *path);
+struct btd_device *btd_adapter_find_device_by_fd(int fd);
 
 void btd_adapter_update_found_device(struct btd_adapter *adapter,
 					const bdaddr_t *bdaddr,