Calibre's author_sort field carries the curated "Surname, Forename"
form for each author -- distinct from the display string in authors,
and the only reliable way to get surname-ordering right for compound
names, particles, and inverted-naming cultures (CJK, Hungarian).
slim() currently strips this field when writing the device-side
.metadata.calibre after a wireless transfer, even when desktop Calibre
includes it in the transfer payload. Downstream plugins that want
correct surname ordering can't get at it for libraries synced via the
Calibre Companion plugin -- reported in the Bookshelf koplugin issue
tracker by a user with ~2250 books all showing empty author_sort
after sync, despite their desktop Calibre having the field populated
on every book.
Add "author_sort" to the used_metadata whitelist so it's preserved on
the device-side file. Books without the field continue to load
cleanly (slim's "or rapidjson.null" handles missing fields); on-disk
size grows by a small per-book constant.
search_used_metadata stays unchanged -- search displays the author
string, not the sort form.
The externalkeyboard plugin was unconditionally disabled on Kindle
because it gates on Kobo-specific OTG sysfs paths (ci_hdrc.0/role,
usbc0/otg_role). However, the keyboard detection and hotplug handling
machinery (findAndSetupKeyboards, onEvdevInputInsert, setupKeyboard)
is already fully generic — it uses fbink_input which works on Kindle.
With the companion koreader-base patch adding a uevent listener to
input-kindle.h, EvdevInputInsert events now fire on Kindle when UHID
devices are created (e.g., by kindle-hid-passthrough). This patch
lets the plugin load on Kindle to handle those events.
Changes:
- Replace the OTG-only gate with a check that allows Kindle through
- Guard OTG role management (init, menu, onExit) behind has_otg_role
so it only runs on platforms with OTG sysfs knobs
- On Kindle init, scan for any keyboards already present
- Hide OTG menu items on Kindle (only show Help)
Kobo behavior is completely unchanged.
Closes: https://github.com/koreader/koreader/issues/14359
Send a metadata object (filename, title, authors) with progress sync
requests when the user opts in via a new 'Send document metadata' toggle
(default off). The metadata is silently ignored by the official sync
server but can be used by custom sync servers.
Closes#13810
Ref: #8764
Creating the cover image delays rotation a little bit (half a second,
even if cached), although it could be several seconds on some PocketBook
devices since #14985 which synchronously invokes `sync` after creating
the cover.
To work around this, skip creating the image in the onSetRotationMode
event hook if "Rotate image" is disabled as the resulting image would be
exactly the same. The speedup is noticeable even if the cover cache gets
hit.
(The issue with synchronous `sync` taking several seconds will be fixed
later once we figure out whether any PocketBook devices actually need
the `sync` or not.)
Related: https://github.com/koreader/koreader/issues/15177
Related: https://github.com/koreader/koreader/pull/14985
Otherwise calibre wil raise an error when its nil:
```
calibre, version 9.4.0
ERROR: Error: Error communicating with device
'uuid'
Traceback (most recent call last):
File "calibre/gui2/device.py", line 110, in run
File "calibre/gui2/device.py", line 581, in _books
File "calibre/devices/smart_device_app/driver.py", line 58, in _synchronizer
File "calibre/devices/smart_device_app/driver.py", line 1316, in books
KeyError: 'uuid'
```
When an OPDS catalog entry's URL resolves to a sub_table with only one
element, sub_table[2] returns nil, causing a crash on the subsequent
item.acquisitions access. Fall back to sub_table[1] when index 2 is nil.