Skip to content

Kindle: Add wifi selector#12056

Merged
Frenzie merged 82 commits into
koreader:masterfrom
notmarek:master
Jun 25, 2024
Merged

Kindle: Add wifi selector#12056
Frenzie merged 82 commits into
koreader:masterfrom
notmarek:master

Conversation

@notmarek

@notmarek notmarek commented Jun 20, 2024

Copy link
Copy Markdown
Contributor

#12040, this is not final, i still need to add https://github.com/notmarek/openlipclua to the base, and i have no idea how to go about it


This change is Reviewable

Comment thread frontend/device/kindle/device.lua Outdated
Comment thread frontend/device/kindle/device.lua Outdated
@notmarek

Copy link
Copy Markdown
Contributor Author

Found a bug where my lipc handle commits suicide 😅 probably a bug in my underlying library

jonnyl2 and others added 8 commits June 21, 2024 14:53
Screenshot dialog could not be interacted with in Text editor. Closes koreader#12066.
We can't actually tell whether anything happened, good or bad,
so don't let it kill the potentially in-progress attempt.

We lose the notifications if you force the scan list via a long-press,
but that's another kettle of fish...

None of this was really designed for an async backend ;).
@notmarek

Copy link
Copy Markdown
Contributor Author

Whatever magic you did @NiLuJe seems to have fixed it, i assume it has to do with not letting enableWifi abort the connection since that's the only thing i didn't try, thanks!

@NiLuJe

NiLuJe commented Jun 22, 2024

Copy link
Copy Markdown
Member

I have a bunch of other changes to test, FWIW, because there's some stupidity left-over from #10669 that ties into that very change ;).

(It's also not really Kindle-specific, I'm pretty sure that scan window leads to funky stuff pretty much everywhere...).

@notmarek

Copy link
Copy Markdown
Contributor Author

Oh btw for password = network.known == "yes" and "HIDDEN", should i actually pull the password or is that a bad idea?

@NiLuJe

NiLuJe commented Jun 22, 2024

Copy link
Copy Markdown
Member

Oh btw for password = network.known == "yes" and "HIDDEN", should i actually pull the password or is that a bad idea?

I think you're supposed to, yeah. I'm pretty sure we only use that to pre-fill the password input field; and we will save that in plaintext, FWIW.

@NiLuJe

This comment was marked as outdated.

@NiLuJe NiLuJe added this to the 2024.06 milestone Jun 24, 2024
NiLuJe and others added 2 commits June 24, 2024 23:10
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Comment thread frontend/device/kindle/device.lua
notmarek

This comment was marked as spam.

@Frenzie Frenzie merged commit 4c4cfa2 into koreader:master Jun 25, 2024
@Frenzie Frenzie added the Kindle label Jun 25, 2024
@NiLuJe

NiLuJe commented Jun 25, 2024

Copy link
Copy Markdown
Member

(Commit history archived in the kindle-wifi-ui-openlipc branch ;).

@mergen3107

Copy link
Copy Markdown
Contributor

@notmarek
Is this UI supposed to show up only when there were no network connections?
I have connection to eduroam network, and I don't know how to "forget" it in Kindle Menu.

Also, this one is a simple username/password UI?
eduroam needs all kinds of parameters for Enterprise settings, so this PR is probably won't work for me :D

@NiLuJe

NiLuJe commented Jun 28, 2024

Copy link
Copy Markdown
Member

It's the standard UI, and behaves roughly like the stock ones, i.e., unless it can connect to a previously setup preferred netwokr, you get shown a network list.

And, indeed, eduroam would require manual labor to setup ;).

(My only experience with eduroam was quite a few years ago on macOS, so things may be slightly less ridiculous nowadays. But, FWIW, I'd never done that on an eReader, it was usually faster to setup a Wi-Fi hotspot on my phone).

@mergen3107

Copy link
Copy Markdown
Contributor

unless it can connect to a previously setup preferred netwokr, you get shown a network list.

Can I see network list even with existing network?

I noticed I have a very weird thing. Kindle connects to a different network that I probably accidentally hit one day.

While in KOReader, I turn on Wi-Fi, then it connects to this stupid network and I need to quit and setup eduroam all over again :D

This PR could have helped me save a few steps.

I vaguely remember something about /var/local/ folder and wpa-supplicant files I needed to wipe to forget all networks. Are there any gentler ways to forget networks on Kindle? :D

@NiLuJe

NiLuJe commented Jun 28, 2024

Copy link
Copy Markdown
Member

A long-press on the Wi-Fi menu entry will force the scan list to display (it won't prevent the connection attempt to go through, though, so you'll see the preferred network as "connected". Even though, on Kindle, it's sort of not actually entirely connected yet ^^).

I imagine you can forget about networks in the stock WiFi setting, though.

@mergen3107

Copy link
Copy Markdown
Contributor

A long-press on the Wi-Fi menu entry will force the scan list to display
Is this in KOReader?

@mergen3107

Copy link
Copy Markdown
Contributor

Lol, I figured out how to forget networks in Kindle. After it is connected, hit it again, and it will ask to forget the network xD

@mergen3107

Copy link
Copy Markdown
Contributor

I found a cosmetic bug.
I was at home, connected to home network OK.
Then went to school with eduroam, and it said that it is connecting to home network, but actually connected to eduroam OK.

@notmarek

notmarek commented Jul 2, 2024 via email

Copy link
Copy Markdown
Contributor Author

@mergen3107

mergen3107 commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

I still can't find a way to bring up a list of networks (Kindle Scribe).
Long pressing on the Wi-Fi Connection brings up a popup window that says

Wi-Fi is enabled, but you're currently not connected to a network.
How would you like to proceed?
Dismiss
Turn Wi-Fi off
Connect

However, that statement is wrong. Kindle is connected and I was able to update over the OTA and connected via sftp to PC.
(see below)

@notmarek

notmarek commented Jul 2, 2024 via email

Copy link
Copy Markdown
Contributor Author

@mergen3107

Copy link
Copy Markdown
Contributor

probably a kindle bug since the info is grabbed straight from lipc

@notmarek
Should I play around with pause times in between commands?

@mergen3107

Copy link
Copy Markdown
Contributor

However, that statement is wrong.

Oops, it seems network actually did not connect the second time :D

@mergen3107

Copy link
Copy Markdown
Contributor

OK, so some mysteries. I don't remember if that starting happening with this PR though.
Sorry for the spam (I can also start a new ticket if you guys insist).

  1. KOReader connects to eduroam first time in a day no problem.
  2. However, if I try connect and disconnect in a short time in between it couldn't connect anymore and I need to go Kindle's menu to reconfigure it again (account and password after a 2-min timeout, mainly).
  3. In some of those time when eduroam connection is failed KOReader connects to a different password-less network, which I never connected to before with Kindle at all.
    Does KOReader fallback to that network or something?

@NiLuJe

NiLuJe commented Jul 3, 2024

Copy link
Copy Markdown
Member

We don't do anything, it's all wifid.

Commodore64user pushed a commit to Commodore64user/KOReader_fork that referenced this pull request Aug 2, 2024
* Kindle: Implement a NetworkMgr backend loosely based on WpaClient in order to allow feature-parity with hasWifiManager platforms. This involves dealing with the native wifid over lipc (the native IPC system, based on DBus), through custom Lua bindings (https://github.com/notmarek/openlipclua), since the stock ones lack support for the needed hasharray data type.
* NetworkMgr: Clear up leftover hallucinations from koreader#10669, making `enableWifi` much simpler (and much more similar to `turnOnWifiAndWaitForConnection`).
* NetworkMgr: Made it clearer that `turnOnWifi` implementations *must* deal with `complete_callback`, as part of the aforementioned changes mean that it's *always* wrapped in a connectivity check, and we need that for proper event signaling.
* Android, Emu: Run `complete_callback` properly in `turnOnWifi`.
* Kindle: Support `powerd:isCharged()` on the PW2 (yes, this is random, it just happened to be my test device :D).
* NetworkMgr:disableWifi: Properly tear down any potential ongoing connection attempt (e.g., connectivity check).
* NetworkMgr:promptWifi: Make the "wifi enabled but not connected" popup clearer if there's an ongoing connection attempt, and gray out the "Connect" button in this case (as it would only lead to another "connection already in progress" popup anyway).
* NetworkMgr:reconnectOrShowNetworkMenu: Make *total* scanning failures fatal (they will lead to an immediate wifi teardown).
* NetworkMgr:reconnectOrShowNetworkMenu: Clear up the long-press behavior (which *always* shows the network list popup) so that it doesn't weirdly break all the things (technical term!).
* NetworkMgr:reconnectOrShowNetworkMenu: When we manage to connect to a preferred network on our own *before* showing the network list, make sure it is flagged as "connected" in said list.
* NetworkMgr:reconnectOrShowNetworkMenu: Make connection failures fatal in non-interactive workflows (they'll lead to a wifi teardown).
* NetworkSetting (the aforementioned network list widget): Clear NetworkMgr's "connection pending" flag on dismiss when nothing else will (i.e., when there's no connectivity check ticking).
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
* Kindle: Implement a NetworkMgr backend loosely based on WpaClient in order to allow feature-parity with hasWifiManager platforms. This involves dealing with the native wifid over lipc (the native IPC system, based on DBus), through custom Lua bindings (https://github.com/notmarek/openlipclua), since the stock ones lack support for the needed hasharray data type.
* NetworkMgr: Clear up leftover hallucinations from koreader#10669, making `enableWifi` much simpler (and much more similar to `turnOnWifiAndWaitForConnection`).
* NetworkMgr: Made it clearer that `turnOnWifi` implementations *must* deal with `complete_callback`, as part of the aforementioned changes mean that it's *always* wrapped in a connectivity check, and we need that for proper event signaling.
* Android, Emu: Run `complete_callback` properly in `turnOnWifi`.
* Kindle: Support `powerd:isCharged()` on the PW2 (yes, this is random, it just happened to be my test device :D).
* NetworkMgr:disableWifi: Properly tear down any potential ongoing connection attempt (e.g., connectivity check).
* NetworkMgr:promptWifi: Make the "wifi enabled but not connected" popup clearer if there's an ongoing connection attempt, and gray out the "Connect" button in this case (as it would only lead to another "connection already in progress" popup anyway).
* NetworkMgr:reconnectOrShowNetworkMenu: Make *total* scanning failures fatal (they will lead to an immediate wifi teardown).
* NetworkMgr:reconnectOrShowNetworkMenu: Clear up the long-press behavior (which *always* shows the network list popup) so that it doesn't weirdly break all the things (technical term!).
* NetworkMgr:reconnectOrShowNetworkMenu: When we manage to connect to a preferred network on our own *before* showing the network list, make sure it is flagged as "connected" in said list.
* NetworkMgr:reconnectOrShowNetworkMenu: Make connection failures fatal in non-interactive workflows (they'll lead to a wifi teardown).
* NetworkSetting (the aforementioned network list widget): Clear NetworkMgr's "connection pending" flag on dismiss when nothing else will (i.e., when there's no connectivity check ticking).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants