From e156bd820e12739ec88517c4d805b401a455e439 Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Wed, 9 Sep 2015 11:35:50 +0200
Subject: [PATCH] examples: networking support for default example

Adds basic link layer functionality to the default example application.
---
 examples/default/Makefile | 10 ++++++++++
 examples/default/main.c   | 13 +++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/examples/default/Makefile b/examples/default/Makefile
index 0d524f94d6..b61bb59123 100644
--- a/examples/default/Makefile
+++ b/examples/default/Makefile
@@ -34,6 +34,16 @@ USEMODULE += shell_commands
 USEMODULE += ps
 USEMODULE += config
 
+# Use modules for networking
+# gnrc is a meta module including all required, basic gnrc networking modules
+USEMODULE += gnrc
+# use the default network interface for the board
+USEMODULE += gnrc_netif_default
+# automatically initialize the network interface
+USEMODULE += auto_init_gnrc_netif
+# the application dumps received packets to stdout
+USEMODULE += gnrc_pktdump
+
 FEATURES_OPTIONAL += config
 FEATURES_OPTIONAL += periph_rtc
 
diff --git a/examples/default/main.c b/examples/default/main.c
index d7ffc937f3..c43f9e7f5b 100644
--- a/examples/default/main.c
+++ b/examples/default/main.c
@@ -37,6 +37,11 @@
 #include "ltc4150.h"
 #endif
 
+#ifdef MODULE_NETIF
+#include "net/gnrc/pktdump.h"
+#include "net/gnrc.h"
+#endif
+
 int main(void)
 {
 #ifdef MODULE_LTC4150
@@ -47,6 +52,14 @@ int main(void)
     rtc_init();
 #endif
 
+#ifdef MODULE_NETIF
+    gnrc_netreg_entry_t dump;
+
+    dump.pid = gnrc_pktdump_getpid();
+    dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
+    gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
+#endif
+
     (void) puts("Welcome to RIOT!");
 
     char line_buf[SHELL_DEFAULT_BUFSIZE];
-- 
GitLab