From aa0e3c4bbe12f02ddb3a0a2e69b3b4f0b30b9b79 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 9 Jun 2021 13:57:23 +0200 Subject: iwinfo: nl80211: add support for printing the device path for a phy Will be used to replace the shell code from mac80211.sh Signed-off-by: Felix Fietkau --- iwinfo_cli.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'iwinfo_cli.c') diff --git a/iwinfo_cli.c b/iwinfo_cli.c index 8691f31..456c67a 100644 --- a/iwinfo_cli.c +++ b/iwinfo_cli.c @@ -875,6 +875,16 @@ static void lookup_phy(const struct iwinfo_ops *iw, const char *section) } +static void lookup_path(const struct iwinfo_ops *iw, const char *phy) +{ + const char *path; + + if (!iw->phy_path || iw->phy_path(phy, &path) || !path) + return; + + printf("%s\n", path); +} + int main(int argc, char **argv) { int i, rv = 0; @@ -934,6 +944,10 @@ int main(int argc, char **argv) } else { + if (!strcmp(argv[2], "path")) { + lookup_path(iw, argv[3]); + return 0; + } switch (argv[2][0]) { case 'p': -- cgit v1.2.1