comparison ater/read_ts.c @ 15:98ae717734d6

ater: starting skeleton
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Jun 2024 04:01:38 +0000
parents pcm/read_ts.c@ca351324187a
children 4ffe22f5b4b5
comparison
equal deleted inserted replaced
14:99426da5603d 15:98ae717734d6
1 /*
2 * The function in this module gets called from Osmocom select loop
3 * whenever the data socket to osmo-e1d is ready for reading.
4 */
5
6 #include <stdint.h>
7 #include <stdbool.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11
12 #include <osmocom/core/select.h>
13
14 #include "globals.h"
15
16 uint8_t readbuf[160];
17 FILE *record_file;
18
19 int ts_fd_cb(struct osmo_fd *ofd, unsigned int what)
20 {
21 int rc;
22
23 rc = read(ts_fd, readbuf, 160);
24 if (rc != 160) {
25 fprintf(stderr,
26 "error: read from ts returned %d instead of 160\n",
27 rc);
28 exit(1);
29 }
30 if (record_file)
31 fwrite(readbuf, 1, 160, record_file);
32 /* transmit_e1_ts(); */
33 return 0;
34 }