From 303b8b7757fc5c755ceeabe025cfc92a90bd694b Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 19 Aug 2013 23:11:16 -0700 Subject: [PATCH] monitor: Return btsnoop type when opening files --- monitor/btsnoop.c | 5 ++++- monitor/btsnoop.h | 2 +- monitor/control.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/monitor/btsnoop.c b/monitor/btsnoop.c index 49d399811..79997c4e0 100644 --- a/monitor/btsnoop.c +++ b/monitor/btsnoop.c @@ -165,7 +165,7 @@ void btsnoop_write(struct timeval *tv, uint16_t index, uint16_t opcode, do_write(tv, flags, data, size); } -int btsnoop_open(const char *path) +int btsnoop_open(const char *path, uint32_t *type) { struct btsnoop_hdr hdr; ssize_t len; @@ -216,6 +216,9 @@ int btsnoop_open(const char *path) break; } + if (type) + *type = btsnoop_type; + return 0; } diff --git a/monitor/btsnoop.h b/monitor/btsnoop.h index 044d1a2a9..cec976158 100644 --- a/monitor/btsnoop.h +++ b/monitor/btsnoop.h @@ -27,7 +27,7 @@ void btsnoop_create(const char *path); void btsnoop_write(struct timeval *tv, uint16_t index, uint16_t opcode, const void *data, uint16_t size); -int btsnoop_open(const char *path); +int btsnoop_open(const char *path, uint32_t *type); int btsnoop_read(struct timeval *tv, uint16_t *index, uint16_t *opcode, void *data, uint16_t *size); void btsnoop_close(void); diff --git a/monitor/control.c b/monitor/control.c index d4085efa1..8db33d685 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -810,9 +810,10 @@ void control_reader(const char *path) { unsigned char buf[MAX_PACKET_SIZE]; uint16_t index, opcode, pktlen; + uint32_t type; struct timeval tv; - if (btsnoop_open(path) < 0) + if (btsnoop_open(path, &type) < 0) return; open_pager(); -- 2.11.0