diff pcm/main.c @ 5:7233c10af3ad

pcm: hook in stdin select mechanism
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 23 Jun 2024 18:33:09 +0000
parents c03ec046471f
children
line wrap: on
line diff
--- a/pcm/main.c	Sun Jun 23 17:58:32 2024 +0000
+++ b/pcm/main.c	Sun Jun 23 18:33:09 2024 +0000
@@ -19,6 +19,7 @@
 #include <osmocom/e1d/proto_clnt.h>
 
 #include "../libutil/open_ts.h"
+#include "../libutil/stdin_handler.h"
 #include "globals.h"
 
 struct osmo_e1dp_client *g_client;
@@ -27,7 +28,7 @@
 static const char *e1d_socket_path = E1DP_DEFAULT_SOCKET;
 static const char *timeslot_spec;
 static void *g_ctx;
-static struct osmo_fd ts_ofd;
+static struct osmo_fd ts_ofd, stdin_ofd;
 
 static void process_cmdline(int argc, char **argv)
 {
@@ -70,6 +71,10 @@
 	osmo_fd_setup(&ts_ofd, ts_fd, OSMO_FD_READ, ts_fd_cb, NULL, 0);
 	OSMO_ASSERT(osmo_fd_register(&ts_ofd) == 0);
 
+	osmo_fd_setup(&stdin_ofd, 0, OSMO_FD_READ, stdin_select_cb,
+			handle_user_cmd, 0);
+	OSMO_ASSERT(osmo_fd_register(&stdin_ofd) == 0);
+
 	while (1) {
 		osmo_select_main(0);
 	}