public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: KeithG <ys3al35l@gmail.com>,
	iwd@lists.linux.dev, connman@lists.linux.dev
Subject: Re: How to elegantly engage/disengage AP mode
Date: Tue, 18 Feb 2025 05:38:22 -0800	[thread overview]
Message-ID: <af619c24-18c2-488e-ba0d-69bb2d517ba7@gmail.com> (raw)
In-Reply-To: <CAG17S_Nkb6jH_aBfAzWiqVqY7PUZ5rQJsHo3WzvfPtBa0E57iA@mail.gmail.com>

Hi Keith,

On 2/17/25 4:58 PM, KeithG wrote:
> Hi. I am soliciting ideas on how to elegantly engage/disengage AP mode
> when configuration is needed on a headless device.
>
> What we do now: We use connman as our connection manager with iwd
> handling wlan duties. At first boot our headless RPi based appliance
> checks to see if it has a valid ethernet address on either the wlan or
> the ethernet. If not, it creates an AP on a made up MAC address and
> launches (with either IWD or Hostapd) an AP to allow a connection to
> configure the internet. This works fine and we can use this to
> configure the RPi and when we select a valid SSID with connman and
> type in the password, it brings the AP down and connects to the SSID.
> All good.
>
> The problem: What happens if the SSID goes away either because we
> moved the Pi or the SSID goes away? What we would like is it to scan
> for a known SSID and reconnect if it finds one, (which it already
> does) and if ones does not appear, to restart AP mode so we can
> connect to it. If it finds an SSID while we are connecting, continue
> to set up, but if the SSID reappears and no-one has connected, to then
> shut down AP and re-connect to the SSID.
>
> Question: Are there any elegant ways of doing this? We currently use
> scripts and such to look at connmanctl and iwctl, but could start
> digging into dbus, to monitor what is going on if needed. We thought
> this may have been solved previously and wanted to ask here.
>
> Any ideas? This seems like something that would be useful for just
> about any headless internet connected device.

I'm not too sure there is anything more that IWD could really do to 
support this use case. At the moment I think your main limiting factor 
is trying to use command line utilities + scripts to create this 
application. These tools aren't API stable and never will be so your 
always going to have maintenance if something changes. DBus on the other 
hand is API stable and you can rely on the APIs to stay consistent 
between IWD releases.

Based on other smart devices I have used, this is what I would do:

  - Device starts up, check if there are any known network profiles.

     - If yes, let autoconnect do its thing. At this point your "done" 
already.

     - If no, start AP mode and wait for a connection/configuration.

- Have a "reset" button on the device and when pressed/held down erase 
the known network profile and reboot

Doing the above you don't have to handle any special logic of the 
configured AP disappearing. Once the profile is configured that is the 
network and the device should connect to it unless reset.

Thanks,

James


      reply	other threads:[~2025-02-18 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18  0:58 How to elegantly engage/disengage AP mode KeithG
2025-02-18 13:38 ` James Prestwood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af619c24-18c2-488e-ba0d-69bb2d517ba7@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=connman@lists.linux.dev \
    --cc=iwd@lists.linux.dev \
    --cc=ys3al35l@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox