From 11877b4b6b781c97a9a2582d7b596d3659232040 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 4 Dec 2016 18:43:17 +0000 Subject: [PATCH 1/5] Add sensniff as a submodule --- .gitmodules | 3 +++ tools/sensniff | 1 + 2 files changed, 4 insertions(+) create mode 160000 tools/sensniff diff --git a/.gitmodules b/.gitmodules index af65c1bda..308d06c43 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ path = platform/stm32nucleo-spirit1/stm32cube-lib url = https://github.com/STclab/stm32nucleo-spirit1-lib +[submodule "tools/sensniff"] + path = tools/sensniff + url = https://github.com/g-oikonomou/sensniff.git diff --git a/tools/sensniff b/tools/sensniff new file mode 160000 index 000000000..0d57c1129 --- /dev/null +++ b/tools/sensniff @@ -0,0 +1 @@ +Subproject commit 0d57c1129b601d29a58bffe6e34803af5e1701af From 44edc187bc4ac435ea16adbdad662466881553d3 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 4 Dec 2016 18:43:41 +0000 Subject: [PATCH 2/5] Specify default baudrate for CC2538DK --- examples/sensniff/cc2538dk/target-conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/sensniff/cc2538dk/target-conf.h b/examples/sensniff/cc2538dk/target-conf.h index 56aadcb4b..f498bb00b 100644 --- a/examples/sensniff/cc2538dk/target-conf.h +++ b/examples/sensniff/cc2538dk/target-conf.h @@ -46,6 +46,8 @@ /*---------------------------------------------------------------------------*/ #if CC2538_IO_CONF_USB #define USB_SERIAL_CONF_ENABLE 1 +#else +#define UART0_CONF_BAUD_RATE 460800 #endif /*---------------------------------------------------------------------------*/ #define SENSNIFF_IO_DRIVER_H "pool/cc2538-io.h" From 7ef5902c3de8146f8c2eb370e026b0f4a95e0946 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 4 Dec 2016 18:51:57 +0000 Subject: [PATCH 3/5] Add the sniff make target We can now run make sniff and this will provide correct command line arguments for all supported devices. --- examples/sensniff/Makefile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/sensniff/Makefile b/examples/sensniff/Makefile index 0bc269162..afa1cd4b6 100755 --- a/examples/sensniff/Makefile +++ b/examples/sensniff/Makefile @@ -23,3 +23,23 @@ all: $(CONTIKI_PROJECT) CONTIKI = ../.. include $(CONTIKI)/Makefile.include + +PYTHON ?= python +SENSNIFF = $(CONTIKI)/tools/sensniff/sensniff.py + +ifeq ($(BAUDRATE),) + BAUDRATE = 460800 +endif + +SENSNIFF_FLAGS += -b $(BAUDRATE) + +ifneq ($(PORT),) + SENSNIFF_FLAGS += -d $(PORT) +endif + +sniff: +ifeq ($(wildcard $(SENSNIFF)), ) + $(error Could not find the sensniff script. Did you run 'git submodule update --init' ?") +else + $(PYTHON) $(SENSNIFF) $(SENSNIFF_FLAGS) +endif From aaf0d1eb86debe8393c716dc06f35442ef7fadc5 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 4 Dec 2016 19:03:57 +0000 Subject: [PATCH 4/5] Automatically specify a correct baudrate for jn516x --- examples/sensniff/jn516x/Makefile.jn516x | 1 + 1 file changed, 1 insertion(+) create mode 100644 examples/sensniff/jn516x/Makefile.jn516x diff --git a/examples/sensniff/jn516x/Makefile.jn516x b/examples/sensniff/jn516x/Makefile.jn516x new file mode 100644 index 000000000..3d53f4cc0 --- /dev/null +++ b/examples/sensniff/jn516x/Makefile.jn516x @@ -0,0 +1 @@ +BAUDRATE = 1000000 From bad3384365a2e3a3c262fe53f146a70318989918 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 4 Dec 2016 18:56:29 +0000 Subject: [PATCH 5/5] Update sensniff example documentation --- examples/sensniff/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/sensniff/README.md b/examples/sensniff/README.md index 140db4bc9..646111391 100644 --- a/examples/sensniff/README.md +++ b/examples/sensniff/README.md @@ -11,6 +11,12 @@ Running * Run sensniff on your host * Fire up wireshark and enjoy. +You can run sensniff manually, or you can simply run `make sniff` from within +this directory. If you choose the latter option, you may have to specify the +port where you device is connected by using the PORT variable. For example, if +your device is connected to `/dev/ttyUSB1` then you should run +`make PORT=/dev/ttyUSB1 sniff`. + Make sure your device's UART baud rate matches the `-b` argument passed to sensniff. I strongly recommend using at least 460800. This comment does not apply if your device is using native USB. @@ -44,7 +50,7 @@ The following radios have been tested: * CC2530/CC2531 * CC1200 -One you have the radio sorted out, you also need to configure character I/O. +Once you have the radio sorted out, you also need to configure character I/O. The firmware captures wireless frames and streams them over a serial line to the host where your device is connected. This can be achieved over UART or over CDC-ACM. The example makes zero assumptions about your hardware's capability, @@ -79,5 +85,12 @@ and: #define SENSNIFF_IO_DRIVER_H "header-with-my-own-defines.h" +* The build system will also try to include `platform/Makefile.platform`. You +can create this Makefile if you want to extend the build system e.g. by adding +source files to the build, or by specifying Make variables. A common reason why +you may wish to do so would be to specify your device's baudrate. In doing so, +`make sniff` will pass the correct value as the argument to `-b`. You do not +have to create this file if you don't need to do so. + That should be it!