diff mbox series

[BlueZ,3/3] bap: don't consider TX timestamps as errors

Message ID 9b5dc8ea2e6727e9b83e10cc7bd76c85b5a13c54.1744144760.git.pav@iki.fi
State New
Headers show
Series [BlueZ,1/3] shared/io: add watcher to be used with TX timestamping | expand

Commit Message

Pauli Virtanen April 8, 2025, 8:42 p.m. UTC
Use io_add_err_watch to avoid considering TX timestamps as errors in the
transport io channel.
---

Notes:
    v2:
    - use new API

 profiles/audio/bap.c | 22 ++++++++--------------
 src/shared/bap.c     |  2 ++
 2 files changed, 10 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index a37e62f76..fd9b751cc 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -39,6 +39,7 @@ 
 #include "src/btd.h"
 #include "src/dbus-common.h"
 #include "src/shared/util.h"
+#include "src/shared/io.h"
 #include "src/shared/att.h"
 #include "src/shared/queue.h"
 #include "src/shared/gatt-db.h"
@@ -1868,8 +1869,7 @@  static void recreate_cig(struct bap_setup *setup)
 	queue_foreach(sessions, recreate_cig_session, &info);
 }
 
-static gboolean setup_io_disconnected(GIOChannel *io, GIOCondition cond,
-							gpointer user_data)
+static void setup_io_disconnected(int cond, void *user_data)
 {
 	struct bap_setup *setup = user_data;
 
@@ -1882,8 +1882,6 @@  static gboolean setup_io_disconnected(GIOChannel *io, GIOCondition cond,
 	/* Check if connecting recreate IO */
 	if (!is_cig_busy(setup->ep->data, setup->qos.ucast.cig_id))
 		recreate_cig(setup);
-
-	return FALSE;
 }
 
 static void bap_connect_bcast_io_cb(GIOChannel *chan, GError *err,
@@ -1964,8 +1962,7 @@  static void setup_connect_io(struct bap_data *data, struct bap_setup *setup,
 		return;
 	}
 
-	setup->io_id = g_io_add_watch(io, G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-						setup_io_disconnected, setup);
+	setup->io_id = io_glib_add_err_watch(io, setup_io_disconnected, setup);
 
 	setup->io = io;
 	setup->cig_active = !defer;
@@ -2024,8 +2021,7 @@  static void setup_connect_io_broadcast(struct bap_data *data,
 		return;
 	}
 
-	setup->io_id = g_io_add_watch(io, G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-					setup_io_disconnected, setup);
+	setup->io_id = io_glib_add_err_watch(io, setup_io_disconnected, setup);
 
 	setup->io = io;
 
@@ -2691,9 +2687,8 @@  static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,
 
 	if (!setup->io) {
 		io = g_io_channel_unix_new(fd);
-		setup->io_id = g_io_add_watch(io,
-					      G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-					      setup_io_disconnected, setup);
+		setup->io_id = io_glib_add_err_watch(io, setup_io_disconnected,
+									setup);
 		setup->io = io;
 	} else
 		io = setup->io;
@@ -2736,9 +2731,8 @@  static void bap_connecting_bcast(struct bt_bap_stream *stream, bool state,
 
 	if (!setup->io) {
 		io = g_io_channel_unix_new(fd);
-		setup->io_id = g_io_add_watch(io,
-				G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-				setup_io_disconnected, setup);
+		setup->io_id = io_glib_add_err_watch(io, setup_io_disconnected,
+									setup);
 		setup->io = io;
 	} else
 		io = setup->io;
diff --git a/src/shared/bap.c b/src/shared/bap.c
index be35c2e60..3758aa000 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2779,6 +2779,8 @@  static struct bt_bap_stream_io *stream_io_new(struct bt_bap *bap, int fd)
 
 	DBG(bap, "fd %d", fd);
 
+	io_set_ignore_errqueue(io, true);
+
 	sio = new0(struct bt_bap_stream_io, 1);
 	sio->bap = bap;
 	sio->io = io;