summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-01-06 05:30:30 +0100
committerPatrick McHardy <kaber@trash.net>2011-01-06 05:30:30 +0100
commitba7d686499a3689ed65c452e8dbaf5b291bf9dc7 (patch)
tree6c269a88c6e839812cb1b5236859249bfa12ef67
parent979a156671020c1e21bbc714d9fbd5ba2443f7da (diff)
dectmon: add option for enabling audio dumpingHEADmaster
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--include/dectmon.h1
-rw-r--r--src/main.c12
-rw-r--r--src/nwk.c3
3 files changed, 13 insertions, 3 deletions
diff --git a/include/dectmon.h b/include/dectmon.h
index 0b4f84c..764059c 100644
--- a/include/dectmon.h
+++ b/include/dectmon.h
@@ -14,6 +14,7 @@ enum {
DECTMON_DUMP_MAC = 0x1,
DECTMON_DUMP_DLC = 0x2,
DECTMON_DUMP_NWK = 0x4,
+ DECTMON_DUMP_AUDIO = 0x8,
};
extern const char *auth_pin;
diff --git a/src/main.c b/src/main.c
index 4646940..931605c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -157,7 +157,7 @@ static void dect_debug(enum dect_debug_subsys subsys, const char *fmt,
}
}
-#define OPTSTRING "c:sm:d:n:p:l:d:h"
+#define OPTSTRING "c:sm:d:n:a:p:l:w:h"
enum {
OPT_CLUSTER = 'c',
@@ -165,6 +165,7 @@ enum {
OPT_DUMP_MAC = 'm',
OPT_DUMP_DLC = 'd',
OPT_DUMP_NWK = 'n',
+ OPT_AUDIO = 'a',
OPT_AUTH_PIN = 'p',
OPT_LOGFILE = 'l',
OPT_DUMPFILE = 'w',
@@ -177,6 +178,7 @@ static const struct option dectmon_opts[] = {
{ .name = "dump-mac", .has_arg = true, .flag = 0, .val = OPT_DUMP_MAC, },
{ .name = "dump-dlc", .has_arg = true, .flag = 0, .val = OPT_DUMP_DLC, },
{ .name = "dump-nwk", .has_arg = true, .flag = 0, .val = OPT_DUMP_NWK, },
+ { .name = "audio", .has_arg = true, .flag = 0, .val = OPT_AUDIO, },
{ .name = "auth-pin", .has_arg = true, .flag = 0, .val = OPT_AUTH_PIN, },
{ .name = "logfile", .has_arg = true, .flag = 0, .val = OPT_LOGFILE, },
{ .name = "dumpfile", .has_arg = true, .flag = 0, .val = OPT_DUMPFILE, },
@@ -200,6 +202,7 @@ static void dectmon_help(const char *progname)
" -m/--dump-mac=yes/no Dump MAC layer messages (default: no)\n"
" -d/--dump-dlc=yes/no Dump DLC layer messages (default: no)\n"
" -n/--dump-nwk=yes/no Dump NWK layer messages (default: yes)\n"
+ " -a/--audio=yes/no Enable audio playback (default: no)\n"
" -p/--auth-pin=PIN Authentication PIN for Key Allocation\n"
" -l/--logfile=NAME Log output to file\n"
" -d/--dumpfile=NAME Dump raw frames to file\n"
@@ -287,6 +290,9 @@ int main(int argc, char **argv)
case OPT_DUMP_NWK:
dumpopts = opt_yesno(optarg, dumpopts, DECTMON_DUMP_NWK);
break;
+ case OPT_AUDIO:
+ dumpopts = opt_yesno(optarg, dumpopts, DECTMON_DUMP_AUDIO);
+ break;
case OPT_AUTH_PIN:
auth_pin = optarg;
break;
@@ -311,7 +317,9 @@ int main(int argc, char **argv)
dect_event_ops_init(&ops);
dect_dummy_ops_init(&ops);
- //dect_audio_init();
+
+ if (dumpopts & DECTMON_DUMP_AUDIO)
+ dect_audio_init();
cli_init(stdin);
dect_set_debug_hook(dect_debug);
diff --git a/src/nwk.c b/src/nwk.c
index 0dcb3b7..e003a6f 100644
--- a/src/nwk.c
+++ b/src/nwk.c
@@ -343,7 +343,8 @@ static void dect_pt_track_audio(struct dect_handle *dh,
break;
/* fall through */
case DECT_CC_CONNECT:
- if (pt->ah == NULL)
+ if (dumpopts & DECTMON_DUMP_AUDIO &&
+ pt->ah == NULL)
pt->ah = dect_audio_open();
break;
case DECT_CC_RELEASE: