From 01648ba604f9d0c922193553cfcb36dae0bfddaf Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 29 Mar 2019 18:47:47 +0100 Subject: [PATCH] Move cli_device_status_phy() to functions.phy Signed-off-by: Michael Tremer --- src/functions/functions.phy | 38 +++++++++++++++++++++++++++++++++++++ src/network | 38 ------------------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/functions/functions.phy b/src/functions/functions.phy index ee0f2a2e..120117cc 100644 --- a/src/functions/functions.phy +++ b/src/functions/functions.phy @@ -21,6 +21,44 @@ PHY_DIR="/sys/class/ieee80211" +cli_device_status_phy() { + local phy="${1}" + assert phy_exists "${phy}" + + local address="$(phy_get_address "${phy}")" + cli_print_fmt1 1 "Address" "${address}" + + # Show kernel module + local driver="$(phy_get_driver "${phy}")" + if isset driver; then + cli_print_fmt1 1 "Driver" "${driver}" + fi + + cli_space + + local devices="$(phy_get_devices "${phy}")" + if isset devices; then + cli_headline 2 "Soft interfaces" + + local device + for device in ${devices}; do + cli_print 2 "* %s" "${device}" + done + cli_space + fi + + cli_headline 2 "Features" + + cli_print_fmt1 2 "Automatic Channel Selection" \ + "$(phy_supports_acs "${phy}" && print "Supported" || print "Not Supported")" + cli_print_fmt1 2 "DFS" \ + "$(phy_supports_dfs "${phy}" && print "Supported" || print "Not Supported")" + + cli_space + + return ${EXIT_OK} +} + phy_dir() { local phy=${1} diff --git a/src/network b/src/network index 3535133d..300ba945 100644 --- a/src/network +++ b/src/network @@ -251,44 +251,6 @@ cli_device_status_serial() { fi } -cli_device_status_phy() { - local phy="${1}" - assert phy_exists "${phy}" - - local address="$(phy_get_address "${phy}")" - cli_print_fmt1 1 "Address" "${address}" - - # Show kernel module - local driver="$(phy_get_driver "${phy}")" - if isset driver; then - cli_print_fmt1 1 "Driver" "${driver}" - fi - - cli_space - - local devices="$(phy_get_devices "${phy}")" - if isset devices; then - cli_headline 2 "Soft interfaces" - - local device - for device in ${devices}; do - cli_print 2 "* %s" "${device}" - done - cli_space - fi - - cli_headline 2 "Features" - - cli_print_fmt1 2 "Automatic Channel Selection" \ - "$(phy_supports_acs "${phy}" && print "Supported" || print "Not Supported")" - cli_print_fmt1 2 "DFS" \ - "$(phy_supports_dfs "${phy}" && print "Supported" || print "Not Supported")" - - cli_space - - return ${EXIT_OK} -} - cli_device_discover() { local device=${1} shift -- 2.39.2