Skip to content

Home Wi-Fi: keep the car's Wi-Fi checksum in step, so the client starts - #419

Open
AwsomeFox wants to merge 4 commits into
release/2.0from
wifi/wpa-checksum
Open

AwsomeFox wants to merge 4 commits into
release/2.0from
wifi/wpa-checksum

Conversation

@AwsomeFox

@AwsomeFox AwsomeFox commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stack: 1 of 5 (then #420 → #422 → #423 → #424; #421 is separate). Small and standalone.

Problem

On an Ioniq 5 US 260507 (rc.10) Home Wi-Fi never joined: the keeper switched the hotspot off and asked for the client, logcat said Failed to start supplicant! / Wi-Fi will not be enabled, and the state stayed searching.

The stock libhardware_legacy.so keeps /data/misc/wifi/wpa_supplicant_crc32.conf next to the networks file: the CRC-32 of wpa_supplicant.conf, 8 upper-case hex digits, no newline (ensure_crc_config_file_exists, wpa_crc32_calc). If the file is missing or stale it refuses to start the supplicant. wifi.sh join/forget edit the networks file directly and never updated it.

Also, join with no config yet used printf, which isn't on the unit.

Fix

  • WifiAp crc <conf>: computes it, writes it only when it differs (system:wifi 660, as the library makes it), prints it.
  • wifi.sh: crc_fix after every edit (put_net) and before each client on.
  • A first network starts from the car's own template (/system/etc/wifi/wpa_supplicant.conf), as the library does when it creates the file.

Tested

  • WifiApTest checks the format against the car's own pair: its template → 54931C7F, the value its library wrote.
  • homewifi-test.sh: join and forget update it, it's checked before switching, and a first network comes from the template.
  • On the car, by hand: with the checksum fixed, the client started and joined in seconds. Not yet with this exact build.

On a car without this check in its library the file is simply unused.

🤖 Generated with Claude Code

The stock Wi-Fi library (seen on an Ioniq 5 US 260507) starts the car's Wi-Fi client only when
/data/misc/wifi/wpa_supplicant_crc32.conf holds the CRC-32 of wpa_supplicant.conf (8 upper-case
hex digits). wifi.sh's join and forget edited the networks file and left it stale: logcat said
"Wi-Fi will not be enabled" and home Wi-Fi stayed "searching". WifiAp crc writes it (only when it
differs, owned system:wifi 660); wifi.sh runs it after every edit and before switching the
client on. The test checks it against the pair the car's library wrote for its own template.

A first network no longer needs printf (not on the unit): the config starts from the car's own
template (/system/etc/wifi/wpa_supplicant.conf), as its library does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crc_fix no longer hides WifiAp's output and status: a failure is said in
the keeper's log and in join's and forget's answer. WifiAp.crc checks
chown and chmod, names the one that failed, and leaves the old checksum
file as it was. join builds the whole config text (from the existing
file, the car's template, or the two default lines) before put_net,
instead of first writing the template to wpa_supplicant.conf as root.

Tested off-car only (homewifi-test.sh, bash; no mksh here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AwsomeFox
AwsomeFox marked this pull request as ready for review November 28, 2026 15:50
@AwsomeFox
AwsomeFox requested a review from a team as a code owner November 28, 2026 15:50
@isaacwisdom
isaacwisdom added this pull request to stack #443 November 28, 2026 17:44
isaacwisdom
isaacwisdom previously approved these changes Nov 28, 2026

@isaacwisdom isaacwisdom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found.

@VysseCodes VysseCodes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The checksum write (%08X, system:wifi, 660) and running crc_fix after put_net and before client on match what the car's Wi-Fi library expects.

One small thing: no_route() is added here but first called in #420. Please move it to #420 so each PR stands on its own.

Merge order for the Wi-Fi/catalogue stack: #419 → #420 → #422 → #423 → #457 → #458 → #424.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AwsomeFox added a commit that referenced this pull request Nov 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AwsomeFox added a commit that referenced this pull request Nov 30, 2026
…wner DROPs on rmnet, no_route here)

- route_up: route_localnet is set to 0 before HMGAPI_HOMELO is flushed for a new DNS server,
  so 127/8 from wlan0 is never unguarded (test: every flush sees 0).
- HMGAPI_HOMECELL also drops the home group's and the home apps' traffic on rmnet+ by owner,
  so the block holds if the mark rule is lost; mods_ok counts its rules.
- no_route() moves here from #419, which never called it.
- The comments and changelog no longer claim a repair has no gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AwsomeFox

Copy link
Copy Markdown
Contributor Author

Done in f77477a: no_route() moved to #420, which first calls it. Home Wi-Fi tests pass on both.

DY-Jeong added a commit to DY-Jeong/HMG-API that referenced this pull request Dec 1, 2026
…ksum in step, so the client starts

From AwsomeFox/wifi/wpa-checksum (Open-HMG#419).
@AwsomeFox
AwsomeFox removed this pull request from stack #443 December 1, 2026 16:43
@AwsomeFox
AwsomeFox changed the base branch from main to release/2.0 December 1, 2026 16:43
@AwsomeFox
AwsomeFox added this pull request to stack #467 December 1, 2026 16:43
The only conflict was CHANGELOG.md: this branch's Unreleased entry goes
above release/2.0's new 1.1.0 entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants