From c7dc62e35e6058f8a0702323c606bfb5a1ea1651 Mon Sep 17 00:00:00 2001 From: mlinton Date: Tue, 22 Dec 2020 16:30:24 -0700 Subject: [PATCH] Add ability to set channels using Nexmon Nexmon firmware --- network/net_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/network/net_linux.go b/network/net_linux.go index b56788b0..01d2f7a0 100644 --- a/network/net_linux.go +++ b/network/net_linux.go @@ -40,7 +40,14 @@ func SetInterfaceChannel(iface string, channel int) error { if curr == channel { return nil } - + if core.HasBinary("nexutil") { + Debug("SetInterfaceChannel(%s, %d) nexutil based", iface, channel) + out, err := core.Exec("nexutil", []string{"-i -s 30 -v", fmt.Sprintf("%d", channel)}) + if err != nil { + return err + } else if out != "" { + return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out) + } if core.HasBinary("iw") { Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel) out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)})