How to enable ACS (automatic channel selection) on start

Hi Morse,

Trying to enable ACS at every reboot.

Setup: MM6108 module over SDIO, version 0-rel_1_11_2_2024_Feb_26, hostapd_s1g v2.11-devel, kernel 5.15.71 , country US. enable_survey module param is Y.

Do i need morse_cli to do this or is there another way?

Many thanks!

@halow_darkness setting channel=0 in your hostapd.conf file should enable ACS on start of hostapd.

Thanks very much for getting back to me.

Here is the result of setting channel = 0. :frowning:

pi@raspberrypi:~$ sudo cp /home/pi/wifi-halow-ap.conf /home/pi/wifi-halow-ap.conf.bak
sudo sed -i 's/^CHANNEL=.*/CHANNEL=0/' /home/pi/wifi-halow-ap.conf
sudo systemctl restart wifi-halow-ap.service
journalctl -u wifi-halow-ap.service -n 30 --no-pager
cat /etc/morsemicro-mm610x/conf/ap_halow.conf | grep channel
Job for wifi-halow-ap.service failed because the control process exited with error code.
See "systemctl status wifi-halow-ap.service" and "journalctl -xeu wifi-halow-ap.service" for details.
Jul 20 13:10:10 hostapd_s1g[359213]: wlan1: STA associated (aid 1)
Jul 20 13:10:10 hostapd_s1g[359213]: wlan1: STA RADIUS: starting accounting session
Jul 20 13:10:10 hostapd_s1g[359213]: wlan1: STA WPA: pairwise key handshake completed (RSN)
Jul 20 13:10:19 hostapd_s1g[359213]: wlan1: STA associated (aid 2)
Jul 20 13:10:19 hostapd_s1g[359213]: wlan1: STA RADIUS: starting accounting session
Jul 20 13:10:19 hostapd_s1g[359213]: wlan1: STA WPA: pairwise key handshake completed (RSN)
Jul 20 22:44:40 systemd[1]: Stopping wifi-halow-ap.service - WiFi HaLow Access Point...
Jul 20 22:44:41 systemd[1]: wifi-halow-ap.service: Deactivated successfully.
Jul 20 22:44:41 systemd[1]: Stopped wifi-halow-ap.service - WiFi HaLow Access Point.
Jul 20 22:44:41 systemd[1]: Starting wifi-halow-ap.service - WiFi HaLow Access Point...
Jul 20 22:44:41 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Starting WiFi HaLow AP configuration...
Jul 20 22:44:41 wifi-halow-ap[504852]: Starting WiFi HaLow AP configuration...
Jul 20 22:44:41 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Waiting for wlan1 interface...
Jul 20 22:44:41 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Interface wlan1 is available
Jul 20 22:44:41 wifi-halow-ap[504855]: Interface wlan1 is available
Jul 20 22:44:41 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Stopping any existing AP processes...
Jul 20 22:44:41 wifi-halow-ap[504856]: Stopping any existing AP processes...
Jul 20 22:44:42 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Starting HaLow AP: SSID=MorseMicro, Channel=0, BW=16 MHz
Jul 20 22:44:42 wifi-halow-ap[504864]: Starting HaLow AP: SSID=MorseMicro, Channel=0, BW=16 MHz
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: Unknown S1G operating class 0
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: invalid 802.11ah S1G configuration of operating class, country code and channel
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: s1g mapped ht channel 58
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: 2 errors found in configuration file '/etc/morsemicro-mm610x/conf/ap_halow.conf'
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: Failed to set up interface with /etc/morsemicro-mm610x/conf/ap_halow.conf
Jul 20 22:44:42 wifi-halow-ap-start.sh[504869]: Failed to initialize interface
Jul 20 22:44:42 wifi-halow-ap-start.sh[504851]: [wifi-halow-ap] Error: wifi-halow.sh failed with exit code 1
Jul 20 22:44:42 wifi-halow-ap[504870]: Error: wifi-halow.sh failed with exit code 1
Jul 20 22:44:42 systemd[1]: wifi-halow-ap.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 20 22:44:42 systemd[1]: wifi-halow-ap.service: Failed with result 'exit-code'.
Jul 20 22:44:42 systemd[1]: Failed to start wifi-halow-ap.service - WiFi HaLow Access Point.
channel=16
pi@raspberrypi:~$

Errors appear to show a configuration problem. Can you share
/etc/morsemicro-mm610x/conf/ap_halow.conf?

Also, 1.11 is quite an old version. Are you able to update?

Thanks for the quick response.

Config below pasted directly from the gateway, both the source we template from and the generated file hostapd actually runs on:

/home/pi/wifi-halow-ap.conf (source):

# /home/pi/wifi-halow-ap.conf
SSID="MorseMicro"
CHANNEL=70
BANDWIDTH=16
SECURITY="wpa3-sae"
PASSWORD="<redacted>"
INTERFACE="wlan1"
IP_ADDRESS="192.168.200.1/24"

/etc/morsemicro-mm610x/conf/ap_halow.conf (generated, what hostapd_s1g actually loads):

# /etc/morsemicro-mm610x/conf/ap_halow.conf (generated)
ctrl_interface=/var/run/hostapd_s1g
interface=wlan1
driver=nl80211
hw_mode=a
ieee80211ah=1
channel=16
op_class=70
country_code=US
ssid=MorseMicro
dtim_period=40
s1g_prim_chwidth=0
s1g_prim_1mhz_chan_index=0
ap_max_inactivity=65536
wpa=2
wpa_key_mgmt=SAE
sae_password=<redacted>
rsn_pairwise=CCMP
ieee80211w=2
sae_pwe=2

One more data point that might be relevant to whether this is config or version-related: separately from the ACS issue, morse_cli -i wlan1 version and morse_cli -i wlan1 hw_version both fail identically with NL80211, code -28: Failed to rcvmsgs, reproducible whether the AP is running or fully stopped. Wanted to flag that pattern in case it points at the same root cause as the ACS issue rather than a separate one.

Unfortunately it is not possible for me to update at this time.

Thanks again for the fast turnaround.

So from what you’ve shown, the CHANNEL field in the config you template from maps to the op_class of the hostap config?

BANDWIDTH appears to be mapping to the hostap channel config instead.

A bit confusing.

Can you confirm what the generated hostap config looked like when you set CHANNEL=0 in your template config? I suspect it will have made op_class=0 which is an invalid configuration.

For ACS, try CHANNEL=70 and BANDWIDTH=0 :woozy_face: . Though it might make sense to modify the script doing the mapping if you are able to.

Thanks for getting back to me so quickly.

As you noted and we did too…when I set CHANNEL=0 in our template, the generated ap_halow.conf came out with op_class=0, and hostapd_s1g failed exactly as you’d expect:

Unknown S1G operating class 0
invalid 802.11ah S1G configuration of operating class, country code and channel
2 errors found in configuration file '/etc/morsemicro-mm610x/conf/ap_halow.conf'
Failed to set up interface with /etc/morsemicro-mm610x/conf/ap_halow.conf

Also when we tried your suggested fix (CHANNEL=70, BANDWIDTH=0 → generates op_class=70, channel=0) before your reply, since we’d worked out the same mapping. That one gets past the op_class validation, but fails differently with no ACS survey appearing to start (no ACS-STARTED or related log lines at all), and instead it fails immediately at the driver level:

Starting HaLow AP: SSID=..., Channel=70, BW=0 MHz
Failed to set channel: error(-1)
morse: Failed to execute morse_cli to set channel parameters on ifname wlan1 (2)
Failed to set the channel (2)

It looks like channel=0 is being handed straight to morse_cli’s literal channel-set call rather than being recognized as the ACS trigger. We also tried the string form (channel=acs_survey) in place of 0 , same identical failure.

For reference, software versions here: morse_cli/morse.ko both report rel_1_11_2_2024_Feb_26, hostapd_s1g v2.11-devel. Separately (may or may not be related) — morse_cli -i wlan1 version and hw_version both fail with NL80211, code -28: Failed to rcvmsgs, reproducible with the AP both running and stopped, while every channel-set call works fine. Wasn’t sure if that’s expected on 1.11 or points at the same underlying gap.