Skip to contentSkip to conversation

rt2x00: Firmware loading vs. udev rules

DISCUSSION Pascal Huerst 2 participants 2 messages Sep 29, 2015 – Oct 2, 2015

lore
Share & tools
lore
#0 lore raw

Hey Stanislaw, all,

on rt2x00 devices, firmware gets loaded in:

int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)

which is called, when we start the interface by:

ifconfig wlan0 up

I need to lower tx power of the device and created a udev rule for that:

KERNEL=="wlan0", RUN+="/usr/sbin/iw dev wlan0 set txpower fixed 1800"

Obviously this does not work, since the firmware is not loaded, yet.

Is there a reason, why the firmware is loaded so late and not earlier in probe or so?
Can this be done in any other proper way I don't know about? I think the device should be ready for any operation, when the udev rule triggers, right?

regards
Pascal

#1 lore raw

Hi

Quoted 6 lines · Pascal Huerst

on rt2x00 devices, firmware gets loaded in:

int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)

which is called, when we start the interface by:

Quoted 7 lines

ifconfig wlan0 up

I need to lower tx power of the device and created a udev rule for that:

KERNEL=="wlan0", RUN+="/usr/sbin/iw dev wlan0 set txpower fixed 1800"

Obviously this does not work, since the firmware is not loaded, yet.

Well, I don't think it will work even when you do this after firmware load due to issue on __ieee80211_recalc_txpower(), which do not work for drivers that don't use channel context. Command may finish without an error but tx power setting in driver will not be changed.

Quoted 2 lines

Is there a reason, why the firmware is loaded so late and not earlier in probe or so?

Don't enable things that are not used.

Quoted 3 lines

Can this be done in any other proper way I don't know about? I think the device should be ready for any operation, when the udev rule triggers, right?

Assuming channel context issue will be fixed, you can add script to /etc/NetworkManager/dispatcher.d/ or on older system
use one of /etc/sysconfig/network-scripts scripts. I think systemd also allow you to add a custom service, which can be triggered on network start.

Stanislaw