-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkManager: Enable "before wifi action" support on every hasWifiToggle platform #10669
Conversation
Lightly tested (on a 5.9.7 PW2), so if you have time to spare, feel free to give it a spin, @hius07 ;). |
As expected, the network activity check is hilarious on Kindle, because tmd is losing its damn mind in the background xD.
Ya don't say ;o). |
@@ -624,7 +634,8 @@ end | |||
function NetworkMgr:getPowersaveMenuTable() | |||
return { | |||
text = _("Disable Wi-Fi connection when inactive"), | |||
help_text = _([[This will automatically turn Wi-Fi off after a generous period of network inactivity, without disrupting workflows that require a network connection, so you can just keep reading without worrying about battery drain.]]), | |||
help_text = Device:isKindle() and _([[This is unlikely to function properly on a stock Kindle, given how chatty the framework is.]]) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works just fine for those of us that run frameworkless :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not over here (the numbers above were from a frameworkless session) ;o).
It's an old device that has almost never been online, which probably plays a part here, but even after letting it sit connected in the framework for a bit, which calmed tmd down somewhat, I still get deltas of ~360 (EDIT: ~250 today)..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have iptables rules that only allows outgoing connections on the local lan (i dont need any helpful connections by amazon) so that is why it works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi in case you have any other suggestions. https://hosted.weblate.org/translate/koreader/koreader/en/?checksum=4f0eae549f1bd665#comments
The English can probably be improved but "talkative, communicative..." is indeed correct. :-) It means the Kindle framework is constantly communicating with Amazon servers or something along those lines.
In Dutch I provisionally translated it as "sends/broadcasts much information," which would likely be clearer in English too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's probably a bit jargony. I can't quite think of something else as succinct, though; so the alternative would be to explain it, i.e., that the native system already triggers a lot of network activity on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's probably clearer. "given how much network activity the framework generates" or something.
(Draft, got some more stuff to test/fix tomorrow). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 10 files at r1, 1 of 2 files at r2, 1 of 3 files at r4, 2 of 2 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Frenzie, @pazos, @poire-z, and @yparitcher)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Frenzie, @pazos, @poire-z, and @yparitcher)
Okay, re-tested on a PW2 & a H2O, this ought to be ready now ;). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @yparitcher from a discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Frenzie, @pazos, and @poire-z)
We can implement on some platforms without full manager support That also implies actually running it onResume via NetworkListener, instead of the Generic Power event handler...
That was hard.
Although the fact that an implementation detail (i.e., that Kindle doesn't use a script) leaksthrough there is... not great.
Makes the report somewhat more accurate
NetworkConnected event...
We have a verbose script on ntx, but nothing on Kindle, for instance
Boy be chatty.
I'm... not sure there was ever anything else, but I only have a vague recollection of writing this, and I've already fixed dumb things about it in this PR, so, who knows xD.
That was less painful than I expected (p4merge ftw!)
d9e6687
to
5ba0f9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Frenzie, @pazos, and @poire-z)
The toggles are interactive there, so, that's not great... We'll see how NetworkMgr's connectivity check fares there, it might need to be nerfed on Android, too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r9, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Frenzie, @pazos, and @poire-z)
* 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 #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).
so as not to break the beforeWifiction shenanigans... Which is most of them, only the Emulator subclass sets it, for... reasons. (That Emulator quirk is also why we can't simply scrap the whole thing to use NetworkMgr's default imps). Fix koreader#12203 (thanks to @benoit-pierre for spotting that one). This was clearly an oversight on my part when working on koreader#10669
…s, (#12217) so as not to break the beforeWifiction shenanigans... Which is most of them, only the Emulator subclass sets it, for... reasons. (That Emulator quirk is also why we can't simply scrap the whole thing to use NetworkMgr's default imps). Fix #12203 (thanks to @benoit-pierre for spotting that one). This was clearly an oversight on my part when working on #10669
* 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).
…s, (koreader#12217) so as not to break the beforeWifiction shenanigans... Which is most of them, only the Emulator subclass sets it, for... reasons. (That Emulator quirk is also why we can't simply scrap the whole thing to use NetworkMgr's default imps). Fix koreader#12203 (thanks to @benoit-pierre for spotting that one). This was clearly an oversight on my part when working on koreader#10669
It used to be limited to
hasWifiManager
platforms for some reason (spoiler: that reason was probably I couldn't be arsed to test it on Kindle, and/or it would have been clunky and messy before @yparitcher's cleanup of the network status checks).Anyway, it's fairly trivial to do now, and, as #10605 showed, we kinda need it, as I was stuck in lala-land assuming everybody had it already, and KOSync is a broken mess without it ^^. (Plus, it really has no technical ties to any kind of NetworkMgr backend).
This involves some minor NetworkMgr refactors, and a few fixes along the way.
(Fix #10678)
To recap:
This change is