comparison 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
comparison
equal deleted inserted replaced
4:2ce0ed560a34 5:7233c10af3ad
17 #include <osmocom/core/select.h> 17 #include <osmocom/core/select.h>
18 #include <osmocom/core/application.h> 18 #include <osmocom/core/application.h>
19 #include <osmocom/e1d/proto_clnt.h> 19 #include <osmocom/e1d/proto_clnt.h>
20 20
21 #include "../libutil/open_ts.h" 21 #include "../libutil/open_ts.h"
22 #include "../libutil/stdin_handler.h"
22 #include "globals.h" 23 #include "globals.h"
23 24
24 struct osmo_e1dp_client *g_client; 25 struct osmo_e1dp_client *g_client;
25 int ts_fd; 26 int ts_fd;
26 27
27 static const char *e1d_socket_path = E1DP_DEFAULT_SOCKET; 28 static const char *e1d_socket_path = E1DP_DEFAULT_SOCKET;
28 static const char *timeslot_spec; 29 static const char *timeslot_spec;
29 static void *g_ctx; 30 static void *g_ctx;
30 static struct osmo_fd ts_ofd; 31 static struct osmo_fd ts_ofd, stdin_ofd;
31 32
32 static void process_cmdline(int argc, char **argv) 33 static void process_cmdline(int argc, char **argv)
33 { 34 {
34 extern int optind; 35 extern int optind;
35 extern char *optarg; 36 extern char *optarg;
68 ts_fd = open_e1d_ts(g_client, timeslot_spec); 69 ts_fd = open_e1d_ts(g_client, timeslot_spec);
69 70
70 osmo_fd_setup(&ts_ofd, ts_fd, OSMO_FD_READ, ts_fd_cb, NULL, 0); 71 osmo_fd_setup(&ts_ofd, ts_fd, OSMO_FD_READ, ts_fd_cb, NULL, 0);
71 OSMO_ASSERT(osmo_fd_register(&ts_ofd) == 0); 72 OSMO_ASSERT(osmo_fd_register(&ts_ofd) == 0);
72 73
74 osmo_fd_setup(&stdin_ofd, 0, OSMO_FD_READ, stdin_select_cb,
75 handle_user_cmd, 0);
76 OSMO_ASSERT(osmo_fd_register(&stdin_ofd) == 0);
77
73 while (1) { 78 while (1) {
74 osmo_select_main(0); 79 osmo_select_main(0);
75 } 80 }
76 } 81 }