[24.10] Unable to disable radios using uci-defaults script

I am writing a custom OpenWRT image [24.10] and I need to disable uci control of the radios in order to support a MorseMicro WiFi-Halow device (This is an out-of-tree driver). I am able to successfully disable the radios at runtime using

uci set wireless.radio0.disabled='1'

uci commit wireless

But all of my attempts to do so using uci-defaults scripts have failed. After they run and the system boots, uci get wireless.radio0.disabled always returns 0. Is there a specific mechanism in 24.10 that triggers a forced re-detection regardless of the existing config? How can I permanently blacklist these physical paths from being managed by the standard wireless subsystem? Notice that all of the snippets below are triggered by an if statement which looks for the specific device.

Technical Details

OpenWrt 24.10 (Kernel 6.6.109)
OverlayFS (Verified rw via mount)

What I have tried

Dynamical disabling (Disable all radios using uci show wireless)

if lsusb | grep -q "325b:8100"; then
    RADIOS=$(uci show wireless | grep "=wifi-device" | cut -d. -f2 | cut -d= -f1)
   
    for R in $RADIOS; do
        uci set wireless.${R}.disabled='1'
    done
    uci commit wireless

Disable by index

if lsusb | grep -q "325b:8100"; then
   
    index=0
    while uci get wireless.radio${index} >/dev/null 2>&1; do
        uci set wireless.radio${index}.disabled='1'
        index=$((index + 1))
    done
    uci commit wireless

Brute force disable (hardcoded values)

if lsusb | grep -q "325b:8100"; then
    # 1. Manually disable specific radio indices to clear UCI management [cite: 533, 964]
    uci set wireless.radio0.disabled='1'
    uci set wireless.radio1.disabled='1'
    uci set wireless.radio2.disabled='1'
    uci set wireless.radio3.disabled='1'
    uci commit wireless

Wipe the entire wireless config

if lsusb | grep -q "325b:8100"; then
    true > /etc/config/wireless

Enter dummy values

if lsusb | grep -q "325b:8100"; then
    cat <<EOF > /etc/config/wireless
config wifi-device 'radio0'
    option type 'mac80211'
    option disabled '1'

config wifi-device 'radio1'
    option type 'mac80211'
    option disabled '1'
EOF

Probably 3rd party scripts do that... Nothing in openwrt makes parts of config change at random.

Do you mean that literally, or do you just want the radio(s) disabled?

The uci-defaults are burnt into the flash and reside in ROM, so your attempts must be put into a custom image eg via the Firmware Selector or the Imagebuilder.

So unless you have done this then yes, your attempts will fail.

That is fine, but an out of tree driver will not effect the existing "built into the image" drivers, so why do you need to disable them?

In addition, the default OpenWrt build will have wireless disabled anyway. So a simple answer will be "Don't enable the wireless, then you won't have to disable it".

Is there something you are not telling us?

1 Like

could be same issue as here, as i mention, this is often over looked ..

if you are just trying to disable all wireless .. perhaps a more effective approach would be

wifi down 

and to enable again

wifi up
1 Like

after reading your original post again ... my bet is on the permissions. any one of those scripts should do, test it manually fist, if it works from command line in should work from uci-defaults. Just make sure the script has executable permissions

Yes, I found that one out pretty quickly.

But the OP has not explained why/how he has enabled the radios in the first place, given "disabled" is the default.
I suspect he is trying to undo someone else's work in a non-standard image.

You are probably aware, so for the benefit of others; when building a package, the package makefile can set permissions, depending on what you are trying to do.

For example:

define Package/mypackage/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mypackage $(1)/usr/sbin
endef

The INSTALL_BIN function sets executable permissions after copying from the build dir to the target location.

1 Like

I'm just disabling UCI interaction with the radios. I am using a Morse Micro 802.11ah radio which is managed by wpa_supplicant_s1g. So we're just telling uci "don't touch this radio"

Yes this is a part of a custom image package which loads these uci-defaults scripts into the actual .gz firmware image. I have many other uci-defaults scripts that are working just fine such as firewall control, amixer sound control, etc.

I need to disable them because I am using the Morse Micro Wifi Halow card, and the standard UCI wireless system does not know how to correctly manage it. So, instead I am using wpa_supplicant_s1g. But for that to work you don't want uci to be fighting it.

However, I want the user to be able to hot-swap for standard 2.4GHz+ wireless modules, hence the if statement at the start of my examples. We first check to see if the HaLoW card is installed then and only then do we disable UCI on startup

As for what I'm not telling you, yes I am trying not to reveal all of the information about my design. But if there is specific information that would help address this issue, please let me know and I will divulge if possible.

i get what he's trying to do... but knowing what he has done so far, would be of great service to the discussion

I'm currently flashing the image with new permissions and will let you know if that solves it. Thanks

So, embarrassingly, I had forgotten to add the install line to my make file for the custom config package.

$(INSTALL_BIN) ./files/etc/uci-defaults/99-halow-config $(1)/etc/uci-defaults/

So, it was, indirectly, a permissions issue since that line will update permissions to be executable. But it was also just an oversight.

Thank you everyone for your help!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.