Proposal: pre-flight checks for Wi-Fi interface & AP capability before starting hotspot

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
linux, python

Research direction

The issue does not name project files or tests; start by locating where the app invokes hostapd and how it handles a missing WIFI_INTERFACE. Read the related bring-up guide in issue #1 for the reported failure modes. Done means the agreed pre-flight checks give a clear error when AP mode or the configured interface is missing; the optional Zero-CD switching proposal needs its own scope decision.

Written by the indexing model from the issue text.

Description

Background

While bringing up a USB Wi-Fi adapter (Tenda, AICSemi AIC8800D80) on a robot
host (custom kernel 6.5.2-rt8, NetworkManager 1.36) I ran into several
failure modes that happen before smart-wifi's own code path starts. The
full troubleshooting story is documented in #1 (USB Wi-Fi adapter
bring-up guide).

Summary of the gap: smart-wifi assumes WIFI_INTERFACE already exists and
is AP-capable. When that assumption fails, the UI surfaces a generic
hostapd failure while the root cause is 2鈥? layers below (adapter in
Zero-CD storage mode, driver not bound to the USB ID, or chipset without
AP interface mode).

Proposals

1. AP capability pre-flight check

Before invoking hostapd, verify the interface actually supports AP mode:

iw list | grep -A 12 'Supported interface modes'   # must contain '* AP'

If missing, fail fast with a clear message ("interface wlan0 does not
support AP mode") instead of a hostapd error that users will stare at
without a clue.

2. Interface diagnostic hints when WIFI_INTERFACE is missing

When the configured interface does not exist (iw dev shows nothing for
it), the web UI could suggest the two most common root causes:

  • adapter stuck in Zero-CD (MSC) mode 鈥?enumerated as usb-storage;
    an eject re-enumerates it as a Wi-Fi device (ID changes!);
  • driver missing 鈥?modinfo <module> ID table does not contain the
    adapter's vendor:product ID.

A "Diagnostics" panel with lsusb / iw dev / iw list output (read-only)
would cover most bring-up cases without turning smart-wifi into a driver
installer.

3. Optional: auto mode-switch for Zero-CD adapters

If the adapter exposes a usb-storage interface, automatically send a SCSI
eject (equivalent of eject /dev/sdX) before reporting "no wireless
interface". This is what usb_modeswitch does; for most current adapters
the plain eject is sufficient. Feature-flagged, off by default 鈥?switching
SCSI devices is outside the comfort zone of a Wi-Fi manager.

Verified facts from the field

  • Zero-CD switch: a69c:5730 (aicsemi "Aic MSC") 鈫?eject /dev/sda 鈫? re-enumerates as 2604:0023 (Tenda AIC 8800D80). Verified.
  • Forced driver binding via new_id on an ID the driver does not know
    caused an instant kernel NULL-pointer oops (aic8800_fdrv). System ended
    half-alive (lsusb/ps hung). Verified 鈥?do not recommend new_id anywhere
    in docs.
  • AIC8800D80/D80C-class chips need an out-of-tree driver on stock Ubuntu
    kernels; actively maintained sources:
    shenmintao/aic8800d80, Kiborgik/aic8800dc-linux-patched (DKMS).

Happy to contribute the read-only diagnostics panel (proposal 1+2) if there
is interest 鈥?the checks are cheap (iw, lsusb parsing).

Dominant language
Python
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.