Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit 478887c

Browse files
committed
zephyr/modzephyr: Add shell_net_iface() function.
Calls out to Zephyr's shell, submodule "net", command "iface", and shows network interface information (if CONFIG_NET_SHELL is enabled).
1 parent 394c536 commit 478887c

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

zephyr/modzephyr.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,27 @@ STATIC mp_obj_t mod_stacks_analyze(void) {
4848
}
4949
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_stacks_analyze_obj, mod_stacks_analyze);
5050

51+
#ifdef CONFIG_NET_SHELL
52+
53+
//int net_shell_cmd_iface(int argc, char *argv[]);
54+
55+
STATIC mp_obj_t mod_shell_net_iface(void) {
56+
net_shell_cmd_iface(0, NULL);
57+
return mp_const_none;
58+
}
59+
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_shell_net_iface_obj, mod_shell_net_iface);
60+
61+
#endif // CONFIG_NET_SHELL
62+
5163
STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
5264
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zephyr) },
5365
{ MP_ROM_QSTR(MP_QSTR_is_preempt_thread), MP_ROM_PTR(&mod_is_preempt_thread_obj) },
5466
{ MP_ROM_QSTR(MP_QSTR_current_tid), MP_ROM_PTR(&mod_current_tid_obj) },
5567
{ MP_ROM_QSTR(MP_QSTR_stacks_analyze), MP_ROM_PTR(&mod_stacks_analyze_obj) },
68+
69+
#ifdef CONFIG_NET_SHELL
70+
{ MP_ROM_QSTR(MP_QSTR_shell_net_iface), MP_ROM_PTR(&mod_shell_net_iface_obj) },
71+
#endif
5672
};
5773

5874
STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);

zephyr/prj_base.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ CONFIG_INIT_STACKS=y
3232
# Required for usocket.pkt_get_info()
3333
CONFIG_NET_BUF_POOL_USAGE=y
3434

35+
# Required for usocket.shell_*()
36+
#CONFIG_NET_SHELL=y
37+
3538
# Uncomment to enable "INFO" level net_buf logging
3639
#CONFIG_NET_LOG=y
3740
#CONFIG_NET_DEBUG_NET_BUF=y

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy