Skip to content

Commit d471f09

Browse files
authored
fix(wifi): disable brcmfmac power save to prevent occasional drops (#8)
The brcmfmac driver (CM4 onboard WiFi) ships with power saving on; the chip occasionally sleeps and fails to recover, requiring a manual nmcli reconnect (verified on hardware: 'Power save: on', journal shows 'Couldn't initialize supplicant interface: Name owner lost'). Ship /etc/NetworkManager/conf.d/wifi-powersave-off.conf (wifi.powersave=2) in the image so all connections have power save disabled, and document the symptom/root cause/fix in MAINTAINING.
1 parent 446312e commit d471f09

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

MAINTAINING.ja.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,30 @@ timedatectl timesync-status # ServerName=ntp.nict.jp / synced になれば OK
203203
systemd-networkd-wait-online` を実行し、上記 `timesyncd.conf.d` を配置しておけば、
204204
以降のイメージはこの問題を最初から回避できる。
205205

206+
### WiFi 不安定(brcmfmac パワーセーブ)
207+
208+
**症状**: WiFi が稀に切断される。`nmcli` で再接続すると復旧する。
209+
210+
**原因**: `brcmfmac` ドライバ(CM4 内蔵 WiFi)のデフォルトで省電力
211+
モード(`Power save: on`)が有効になっており、省電力状態でチップが
212+
スリープに入り、復帰に失敗して再接続が必要になる。
213+
214+
**対処(実機)**: NetworkManager でパワーセーブを恒久無効化する。
215+
216+
```sh
217+
# 即時(再起動まで有効)
218+
sudo iw dev wlan0 set power_save off
219+
220+
# 恒久(現在・将来の全接続に適用)
221+
sudo tee /etc/NetworkManager/conf.d/wifi-powersave-off.conf <<'EOF'
222+
[connection]
223+
wifi.powersave=2
224+
EOF
225+
```
226+
227+
**イメージ側で根治済み**: `scripts/customize.sh` がビルド時に上記の
228+
設定ファイルを書き込むため、新規イメージでは最初から無効化されている。
229+
206230
## 今後の方向性
207231

208232
- **カーネルの PKGBUILD 化**(ファイル注入をやめる)。pacman 管理下に入れば、

MAINTAINING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,30 @@ NetworkManager enablement, also run `systemctl disable systemd-networkd
216216
systemd-networkd.socket systemd-networkd-wait-online` and drop the
217217
`timesyncd.conf.d` file above, so future images avoid this out of the box.
218218

219+
### WiFi instability (brcmfmac power save)
220+
221+
**Symptom**: WiFi occasionally drops; reconnecting via `nmcli` restores it.
222+
223+
**Root cause**: the `brcmfmac` driver (CM4 onboard WiFi) has power saving
224+
enabled by default (`Power save: on`). In this state the driver occasionally
225+
puts the chip to sleep and fails to recover, requiring a manual reconnect.
226+
227+
**Fix (on device)**: disable power save permanently via NetworkManager.
228+
229+
```sh
230+
# Immediate (until reboot)
231+
sudo iw dev wlan0 set power_save off
232+
233+
# Permanent (applies to all connections, current and future)
234+
sudo tee /etc/NetworkManager/conf.d/wifi-powersave-off.conf <<'EOF'
235+
[connection]
236+
wifi.powersave=2
237+
EOF
238+
```
239+
240+
**Fixed in the image**: `scripts/customize.sh` writes the config file above
241+
at build time, so fresh images ship with WiFi power saving disabled.
242+
219243
## Future directions
220244

221245
- **Package the kernel as a PKGBUILD** instead of file-injection. Under pacman

scripts/customize.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ else
156156
echo "!! package install failed (continuing)"
157157
fi
158158

159+
# WiFi power management: the brcmfmac driver occasionally puts the chip to
160+
# sleep and fails to recover, causing rare WiFi drops that require a manual
161+
# reconnect. Disable power saving permanently for all connections.
162+
echo "==> [chroot] disabling WiFi power save (brcmfmac)"
163+
mkdir -p /etc/NetworkManager/conf.d
164+
cat > /etc/NetworkManager/conf.d/wifi-powersave-off.conf <<'EOF'
165+
[connection]
166+
wifi.powersave=2
167+
EOF
168+
159169
# --- Internal speaker amplifier enable -------------------------------
160170
# The uConsole's onboard speaker amplifier is gated by an enable GPIO
161171
# (BCM11 / gpiochip0 line 11). Headphones bypass the amp, so without this the

0 commit comments

Comments
 (0)