# HG changeset patch # User Mychaela Falconia # Date 1719167589 0 # Node ID 7233c10af3adebdd099eb20889f14aa2f3c6fb0b # Parent 2ce0ed560a34ed3a20def7925d02732138b38a1b pcm: hook in stdin select mechanism diff -r 2ce0ed560a34 -r 7233c10af3ad pcm/Makefile --- a/pcm/Makefile Sun Jun 23 17:58:32 2024 +0000 +++ b/pcm/Makefile Sun Jun 23 18:33:09 2024 +0000 @@ -1,5 +1,5 @@ PROG= itt-pcm-one -OBJS= main.o read_ts.o +OBJS= main.o read_ts.o user_cmd.o LIBUTIL=../libutil/libutil.a include ../config.defs diff -r 2ce0ed560a34 -r 7233c10af3ad pcm/globals.h --- a/pcm/globals.h Sun Jun 23 17:58:32 2024 +0000 +++ b/pcm/globals.h Sun Jun 23 18:33:09 2024 +0000 @@ -7,3 +7,4 @@ extern uint8_t readbuf[160]; int ts_fd_cb(struct osmo_fd *ofd, unsigned int what); +void handle_user_cmd(int argc, char **argv); diff -r 2ce0ed560a34 -r 7233c10af3ad pcm/main.c --- 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 #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); } diff -r 2ce0ed560a34 -r 7233c10af3ad pcm/user_cmd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pcm/user_cmd.c Sun Jun 23 18:33:09 2024 +0000 @@ -0,0 +1,19 @@ +/* + * In this module we handle user-issued stdin commands during + * itt-pcm-one running session. + */ + +#include +#include +#include +#include +#include + +#include + +#include "globals.h" + +void handle_user_cmd(int argc, char **argv) +{ + /* to be filled */ +}