Fix libdebug to be used with all osmo-cc projects
This commit is contained in:
parent
6650631b4f
commit
daae95ee05
|
@ -5,7 +5,3 @@ noinst_LIBRARIES = libdebug.a
|
||||||
libdebug_a_SOURCES = \
|
libdebug_a_SOURCES = \
|
||||||
debug.c
|
debug.c
|
||||||
|
|
||||||
if HAVE_SDR
|
|
||||||
AM_CPPFLAGS += -DHAVE_SDR
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include "../libsample/sample.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "../libdisplay/display.h"
|
|
||||||
#include "../liboptions/options.h"
|
|
||||||
|
|
||||||
const char *debug_level[] = {
|
const char *debug_level[] = {
|
||||||
"debug ",
|
"debug ",
|
||||||
|
@ -79,6 +76,13 @@ struct debug_cat {
|
||||||
{ "mtp layer 2", "\033[1;33m" },
|
{ "mtp layer 2", "\033[1;33m" },
|
||||||
{ "mtp layer 3", "\033[1;36m" },
|
{ "mtp layer 3", "\033[1;36m" },
|
||||||
{ "MuP", "\033[1;37m" },
|
{ "MuP", "\033[1;37m" },
|
||||||
|
{ "router", "\033[1;35m" },
|
||||||
|
{ "stderr", "\033[1;37m" },
|
||||||
|
{ "ss5", "\033[1;34m" },
|
||||||
|
{ "isdn", "\033[1;35m" },
|
||||||
|
{ "misdn", "\033[0;34m" },
|
||||||
|
{ "dss1", "\033[1;34m" },
|
||||||
|
{ "sip", "\033[1;35m" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,22 +206,24 @@ void debug_list_cat(void)
|
||||||
int parse_debug_opt(const char *optarg)
|
int parse_debug_opt(const char *optarg)
|
||||||
{
|
{
|
||||||
int i, max_level = 0;
|
int i, max_level = 0;
|
||||||
char *dstring, *p;
|
char *dup, *dstring, *p;
|
||||||
|
|
||||||
for (i = 0; debug_level[i]; i++)
|
for (i = 0; debug_level[i]; i++)
|
||||||
max_level = i;
|
max_level = i;
|
||||||
|
|
||||||
dstring = options_strdup(optarg);
|
dup = dstring = strdup(optarg);
|
||||||
p = strsep(&dstring, ",");
|
p = strsep(&dstring, ",");
|
||||||
for (i = 0; i < p[i]; i++) {
|
for (i = 0; i < p[i]; i++) {
|
||||||
if (p[i] < '0' || p[i] > '9') {
|
if (p[i] < '0' || p[i] > '9') {
|
||||||
fprintf(stderr, "Only digits are allowed for debug level!\n");
|
fprintf(stderr, "Only digits are allowed for debug level!\n");
|
||||||
|
free(dup);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debuglevel = atoi(p);
|
debuglevel = atoi(p);
|
||||||
if (debuglevel > max_level) {
|
if (debuglevel > max_level) {
|
||||||
fprintf(stderr, "Debug level too high, use 'list' to show available levels!\n");
|
fprintf(stderr, "Debug level too high, use 'list' to show available levels!\n");
|
||||||
|
free(dup);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (dstring)
|
if (dstring)
|
||||||
|
@ -229,11 +235,13 @@ int parse_debug_opt(const char *optarg)
|
||||||
}
|
}
|
||||||
if (!debug_cat[i].name) {
|
if (!debug_cat[i].name) {
|
||||||
fprintf(stderr, "Given debug category '%s' unknown, use 'list' to show available categories!\n", p);
|
fprintf(stderr, "Given debug category '%s' unknown, use 'list' to show available categories!\n", p);
|
||||||
|
free(dup);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
debug_mask |= ((uint64_t)1 << i);
|
debug_mask |= ((uint64_t)1 << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(dup);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,32 +15,40 @@
|
||||||
#define DAMPS 8
|
#define DAMPS 8
|
||||||
#define DR2000 9
|
#define DR2000 9
|
||||||
#define DIMTS 10
|
#define DIMTS 10
|
||||||
#define DJOLLY 11
|
#define DMPT1327 11
|
||||||
#define DEURO 12
|
#define DJOLLY 12
|
||||||
#define DFRAME 13
|
#define DEURO 13
|
||||||
#define DCALL 14
|
#define DFRAME 14
|
||||||
#define DCC 15
|
#define DCALL 15
|
||||||
#define DDB 16
|
#define DCC 16
|
||||||
#define DTRANS 17
|
#define DDB 17
|
||||||
#define DDMS 18
|
#define DTRANS 18
|
||||||
#define DSMS 19
|
#define DDMS 19
|
||||||
#define DSDR 20
|
#define DSMS 20
|
||||||
#define DUHD 21
|
#define DSDR 21
|
||||||
#define DSOAPY 22
|
#define DUHD 22
|
||||||
#define DWAVE 23
|
#define DSOAPY 23
|
||||||
#define DRADIO 24
|
#define DWAVE 24
|
||||||
#define DAM791X 25
|
#define DRADIO 25
|
||||||
#define DUART 26
|
#define DAM791X 26
|
||||||
#define DDEVICE 27
|
#define DUART 27
|
||||||
#define DDATENKLO 28
|
#define DDEVICE 28
|
||||||
#define DZEIT 29
|
#define DDATENKLO 29
|
||||||
#define DSIM1 30
|
#define DZEIT 30
|
||||||
#define DSIM2 31
|
#define DSIM1 31
|
||||||
#define DSIMI 32
|
#define DSIM2 32
|
||||||
#define DSIM7 33
|
#define DSIMI 33
|
||||||
#define DMTP2 34
|
#define DSIM7 34
|
||||||
#define DMTP3 35
|
#define DMTP2 35
|
||||||
#define DMUP 36
|
#define DMTP3 36
|
||||||
|
#define DMUP 37
|
||||||
|
#define DROUTER 38
|
||||||
|
#define DSTDERR 39
|
||||||
|
#define DSS5 40
|
||||||
|
#define DISDN 41
|
||||||
|
#define DMISDN 42
|
||||||
|
#define DDSS1 43
|
||||||
|
#define DSIP 44
|
||||||
|
|
||||||
void get_win_size(int *w, int *h);
|
void get_win_size(int *w, int *h);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue