Linux – disabling power save option on wifi device

linuxpower-managementwireless-networking

I use usb wifi dongles that have AR9271 chipset and use compat driver 3.9.1 – ath9k_htc. I use the wifi units to create an ad-hoc wlan.

When there is no communication for a while, the nodes leave the network and goes to sleeping mode. That cause a problem in case a node sends a UDP packet, the sleeping ones cannot receive it. they just rejoin the network in the first package and rejoining takes some time. Therefore I misses some messages to receive.

how can I disable that no node would leave the network no matter what?

For some reasons I looking for another method than iw dev wlan0 set power_save off. It would be perfect if it is possible to do it via wpa_supplicant (2.0) or anything else.

Best Answer

Creating a udev rule that automatically turns off power savings mode when the device is plugged in might take the edge off.

Create /etc/udev/rules.d/70-wifi-powersave.rules:

ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/bin/iw dev %k set power_save off"

You may need to reload udev or reboot for the change to take effect, of course.

Perhaps there are wireless network management daemons and/or utilities that provide the same functionality (i.e. click a checkbox or pass --power-save), but I couldn't find anything. If you did find such a program, they'd most likely be wrapping the same call to iw you're trying to avoid.

The ath9k_htc kernel module website does offer a little information though:

Disabled Features

ath9k_htc uses the Autosleep feature of the wireless card. Basic PS support has been implemented in the driver, but it is disabled by default.

This part may be of use to you too:

AP/P2P Modes

Patches enabling P2P/AP modes have been merged in wireless-testing, it would be part of the driver from Linux 3.0. Using only one VIF (Virtual Interface) running in AP mode would be a good idea for now, multiple interface support has not been tested extensively. Note: PowerSave is not properly supported yet.

Source: https://wiki.archlinux.org/index.php/Power_saving#Network_interfaces

Source: http://wireless.kernel.org/en/users/Drivers/ath9k_htc

Related Question