Commit Graph

38 Commits (37a01100b7a4733ae26871c4d929114aff8ea143)

Author SHA1 Message Date
NiLuJe 37a01100b7
Various Wi-Fi QoL improvements (#6424)
* Revamped most actions that require an internet connection to a new/fixed backend that allows forwarding the initial action and running it automatically once connected. (i.e., it'll allow you to set "Action when Wi-Fi is off" to "turn_on", and whatch stuff connect and do what you wanted automatically without having to re-click anywhere instead of showing you a Wi-Fi prompt and then not doing anything without any other feedback).
* Speaking of, fixed the "turn_on" beforeWifi action to, well, actually work. It's no longer marked as experimental.
* Consistently use "Wi-Fi" everywhere.
* On Kobo/Cervantes/Sony, implemented a "Kill Wi-Fi connection when inactive" system that will automatically disconnect from Wi-Fi after sustained *network* inactivity (i.e., you can keep reading, it'll eventually turn off on its own). This should be smart and flexible enough not to murder Wi-Fi while you need it, while still not keeping it uselessly on and murdering your battery.
(i.e., enable that + turn Wi-Fi on when off and enjoy never having to bother about Wi-Fi ever again).
* Made sending `NetworkConnected` / `NetworkDisconnected` events consistent (they were only being sent... sometimes, which made relying on 'em somewhat problematic).
* restoreWifiAsync is now only run when really needed (i.e., we no longer stomp on an existing working connection just for the hell of it).
* We no longer attempt to kill a bogus non-existent Wi-Fi connection when going to suspend, we only do it when it's actually needed.
* Every method of enabling Wi-Fi will now properly tear down Wi-Fi on failure, instead of leaving it in an undefined state.
* Fixed an issue in the fancy crash screen on Kobo/reMarkable that could sometime lead to the log excerpt being missing.
* Worked-around a number of sneaky issues related to low-level Wi-Fi/DHCP/DNS handling on Kobo (see the lengthy comments [below](https://github.com/koreader/koreader/pull/6424#issuecomment-663881059) for details). Fix #6421 
Incidentally, this should also fix the inconsistencies experienced re: Wi-Fi behavior in Nickel when toggling between KOReader and Nickel (use NM/KFMon, and run a current FW for best results).
* For developers, this involves various cleanups around NetworkMgr and NetworkListener. Documentation is in-line, above the concerned functions.
4 years ago
Martín Fernández 32207523b0
emulator: add fake network manager (#6314) 4 years ago
Martín Fernández 3856f04445 android: switch to connectivity manager
Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
4 years ago
poire-z 0599c440cc [RTL UI] Bidi-wrap filenames, paths, urls, metadata
bidi.lua:
- Revert "Alias everything to Bidi.nowrap() when in LTR UI,
  as using LTR isolates seems uneeded when already LTR" (part
  of a628714f) which was a wrong assumption: we need proper
  wrappers for all things paths. Enhance some of these wrappers.
- Fix GetText RTL wrapping which was losing empty lines and
  trailing \n.

- Wrap all paths, directories, filenames in the code with
  these wrappers.
- Wrap all book metadata (title, authors...) with BD.auto(),
  as it helps fixing some edge cases (like open/close quotation
  marks which are not considered as bracket types by FriBiDi).
  (Needed some minor logic changes in CoverBrowser.)

- Tweak hyphenation menu text
- Update forgotten SortWidget for UI mirroring
- KoptConfig: update "justification" index for RTL re-ordering,
  following the recent addition of the page_gap_height option.
4 years ago
Frans de Jonge 6ed58346a1
[i18n] Add translator notes (#5250)
Thanks to <https://github.com/koreader/koreader/pull/5237> we can now  extract the knowledge currently embedded in Transifex and put it directly in our source. This positively affects <https://github.com/koreader/koreader/issues/3754>.

Translation instructions and knowledge that comes out of localization-related questions should be preserved in the source, because Transifex is too ephemeral. For example, the links from <https://github.com/koreader/koreader/pull/2290> are no longer accessible. Even when they are, it's quite useful to have this information around while dealing with the code as well, and I also hope it'll be informative to contributors who seldom visit Transifex.

This commit also makes a few minor changes to obviate the need for comments where possible.
5 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
5 years ago
NiLuJe e9eca55d90
Minor auto_restore_wifi tweaks (#5143)
* Try to make sure restoreWifiAsync eventually sends a NetworkConnected
event...

re: #5109

* Take a page from @shermp's book, and make sure wpa_supplicant managed to
connect to the AP before acquiring an IP.
Tear down WiFi modules in case of failure.
c.f., https://github.com/shermp/Kobo-UNCaGED/pull/21

* Don't let restore-wifi-async.sh enable WiFi behind our back when we're
killing it to start Nickel...

* Don't even call ping if there's no default gw
5 years ago
NiLuJe 2ab3e48286 Make sure we only pass a single IP to ping
For some mysterious reason, I have a duplicate default gateway on my
Forma, one with no metrics, and a proper one.
This ensures we pick the proper one.

I'm fairly sure this is temporary insanity on the part of my device,
but, still, it can't hurt.

route -n:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG    208    0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     208    0        0 eth0

ip r:
default via 192.168.0.1 dev eth0
default via 192.168.0.1 dev eth0  metric 208
192.168.0.0/24 dev eth0  src 192.168.0.49  metric 208
5 years ago
NiLuJe 89e002f236
Minor networking fixes on legacy Kindles (#5059)
* Allow toggling WiFi & Suspend on legacy Kindles
* Fix ping invocations on Legacy Kindles
* Don't crash when disabling WiFi on legacy Kindles
5 years ago
tob1az 89c17092e8 [feat] PocketBook: implement Wi-Fi connection toggling (#4775)
Partially resolves #4747. Will enable switching Wi-Fi on/off in the menu and getting the network status. However, a new Wi-Fi session lasts ~100 seconds and then terminates automatically, apparently, to save the energy. I believe it can be prolonged by some networking activity. Also it is not shut down if the auto suspension is disabled.
5 years ago
NiLuJe 869b8aebd1 [Cervantes, Kobo] Stricter WiFi callback (#4616)
* Double-checks that the connection was successful, and forcefully kills WiFi if it didn't, to avoid leaving stuff in an inconsistent state.

Should fix #2183

* Limit the turnOffWifi call to devices where it might make some sense to
do
5 years ago
Martín Fernández 04e17424d0 display network settings based on device capabilities + fix android basic network info 5 years ago
NiLuJe 011370882f [chore] Some Wi-Fi tweaks (#4564)
* On Kobo, kill WiFi on startup if we detect an inconsistent state...

Untested, not terribly pretty.

The other solution is to slow down the Wi-Fi meny by doing the same
check for the "Wi-Fi connection" checkbox as in the later wifi_status
one...

* Don't enable auto_restore_wifi by default

It's liable to silently murder batteries for no good reason, given that
we prompt to enable WiFi by default when needed, and we otherwise have
no actual need to keep WiFi on in the background.

re #2215 (in particular, this directly contradicts @houqp in
https://github.com/koreader/koreader/pull/2215#discussion_r74696133 ;)).
5 years ago
NiLuJe 4ea05ce0a7 Implement workarounds for/from #4387 to better handle WiFi menu
corner-cases on some Kobo devices

Fix #4387
5 years ago
Sergey Avseyev 973e61557b [cervantes] automatically restore wifi connection (#4463) 5 years ago
Sergey Avseyev 12c8d4fd17 [cervantes] wifi: try to connect to known network before listing (#4462)
Defines new function reconnectOrShowNetworkMenu(), which iterates over
available networks ordered by signal power, and check if we can connect
to saved SSIDs. If we can, then skip network list dialog.
5 years ago
Martín Fdez e98b0c8ec8 wireless: use sysfs, do not ping 6 years ago
Martín Fernández 1e69fae7bc [feat] Add support for BQ/Fnac devices (#4294)
Adds support for devices found in https://blog.bq.com/es/bq-ereaders-developers-program/. Tested on BQ Cervantes 4 (last BQ device from 2017).

It adds a new touch input event handler (discussed in #4275) which should work on other single touch devices (ie: Kobo Touch, Mini, Glo, Aura HD) but wasn't tested.

Includes base bump with: [feat] Add BQ/Fnac device support (https://github.com/koreader/koreader-base/pull/745)
6 years ago
Matias N 94d8f2d397 Sony PRSTUX support (#4198)
* Sony PRSTUX support
6 years ago
poire-z 850be52177
Keep some menus open when Tap or Hold (#4189)
TouchMenu: added options to menu items with the following defaults:
    keep_menu_open = false
    hold_keep_menu_open = true
So, default for Tap callback is to close menu, and for Hold callback
to keep menu open.
In both cases, provide the TouchMenu instance as the 1st argument to
the callback functions (instead of a refresh_menu_func I added in #3941)
so the callback can do more things, like closing, refreshing,
changing menu items text and re-ordering...

ReaderZooming: show symbol for default (like it was done for
ReaderFont, ReaderHyphenation...)
TextEditor plugin: update the previously opened files list in real
time, so the menu can be kept open and used as the TextEditor main
interface.
SSH plugin: keep menu open and update the Start/Stop state in real time
ReadTimer plugin: tried to do what feels right (but I don't use it)

Also remove forgotten cp in the move/paste file code
6 years ago
NiLuJe 75df3fcea3
Dismiss Wi-Fi scan popup after connection (#4055)
* Add a config switch to automatically dismiss the WiFi scan popup on connect
6 years ago
onde2rock c0e80461ff [feat] Integrated Dropbear SSH server (#3842)
* Add a menu item to start an ssh server

* Add blank login option
6 years ago
Frans de Jonge 680b53e347
[fix] NetworkManager:isConnected() exit code check (#3795)
Fixes #3794.
6 years ago
mwoz123 1d0a5b4aa3 [feat] Add NetworkManager:beforeWifiAction() to enable optional auto-connect (#3482) 6 years ago
Frans de Jonge 21274f5e92
[feat] Add NetworkManager:isConnected() (#3593)
This enables connecting to calibre and FTP without Internet connectivity.
6 years ago
mwoz123 a01271b8a6 [Android] Wifi status in footer (#3396)
Implemented through the Android API so it's reasonably cheap.
7 years ago
mwoz123 ff3d8f3df7 Android NetworkManager (#3386) 7 years ago
Frans de Jonge 199b6aba51 [fix] NetworkManager: check DNS from dns.msftncsi.com instead of www.example.com (#3150)
Sometimes www.example.com doesn't resolve. Fixes #3142.
7 years ago
Frans de Jonge 773e24fc79 (chore) some require sorting. 7 years ago
Frans de Jonge 1c25d0fd1b Language: improve confirmboxes
Generic "OK" buttons should be avoided. Thanks to @lightonflux for pointing this out https://github.com/koreader/koreader/issues/2555#issuecomment-291039945
7 years ago
Qingping Hou 098ceeb95b fix: use psk for network authentication
also migrate to latest ljwpaclient with breaking api change
7 years ago
Qingping Hou bd43e59fe7 fix: disable network info menu when device is not connected 8 years ago
Zijie He f36f8cb464 KOSync plugin should respect onNetworkConnected and onFlushSettings events 8 years ago
Qingping Hou ad711d8033 minor: show wifi scan error in UI 8 years ago
Zijie He 9b66bf1149 Restore WIFI state when koreader starts. 8 years ago
Hzj_jie da2c57f93a Automatically connect WIFI after Kobo has been resumed (#2215)
* Add bash scripts to control WIFI / IP, so we can share them with frontend/device/kobo/device.lua.

* add test cases
8 years ago
Hzj_jie ccbf8eac0c Add a network info page (#2187)
Add network info page
8 years ago
Qingping Hou 20eb36a03d feat: add network management UI for kobo 8 years ago