fix: using iw instead of iwconfig whenever possible (fixes #657)

This commit is contained in:
Simone Margaritelli 2019-11-25 11:59:04 +01:00
commit 2f3390cf36
2 changed files with 24 additions and 6 deletions

View file

@ -285,7 +285,14 @@ func ActivateInterface(name string) error {
}
func SetInterfaceTxPower(name string, txpower int) error {
if core.HasBinary("iwconfig") {
if core.HasBinary("iw") {
Debug("SetInterfaceTxPower(%s, %d) iw based", name, txpower)
if _, err := core.Exec("iw", []string{"dev", name, "set", "txpower", fmt.Sprintf("%dmBm",
txpower)}); err != nil {
return err
}
} else if core.HasBinary("iwconfig") {
Debug("SetInterfaceTxPower(%s, %d) iwconfig based", name, txpower)
if out, err := core.Exec("iwconfig", []string{name, "txpower", fmt.Sprintf("%d", txpower)}); err != nil {
return err
} else if out != "" {